hetzner.hcloud.volume_attachment module – Manage the attachment of Hetzner Cloud Volumes
Note
This module is part of the hetzner.hcloud collection (version 5.2.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install hetzner.hcloud
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: hetzner.hcloud.volume_attachment
.
Synopsis
Attach and detach Volumes from Hetzner Cloud Servers.
Aliases: hcloud_volume_attachment
Requirements
The below requirements are needed on the host that executes this module.
python-dateutil >= 2.7.5
requests >=2.20
Parameters
Parameter |
Comments |
---|---|
The API Endpoint for the Hetzner Cloud. You can also set this option by using the Default: |
|
The API Token for the Hetzner Cloud. You can also set this option by using the |
|
Automatically mount the Volume in the Server. Choices:
|
|
Name or ID of the Hetzner Cloud Server to attach the Volume to. Required if |
|
State of the Volume. Choices:
|
|
Name or ID of the Hetzner Cloud Volume to attach/detach. |
See Also
See also
- Documentation for Hetzner Cloud API
Complete reference for the Hetzner Cloud API.
Examples
- name: Attach my-volume to my-server
hetzner.hcloud.volume_attachment:
volume: my-volume
server: my-server
- name: Detach my-volume from my-server
hetzner.hcloud.volume_attachment:
volume: my-volume
state: absent
- name: Attach my-volume using id to my-server with automount enabled
hetzner.hcloud.volume_attachment:
volume: 123456
server: my-server
automount: true
state: present
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
The relationship between a Server and a Volume Returned: always |
|
Name of the attached Server Returned: always Sample: |
|
Name of the Volume Returned: always Sample: |