hcloud_volume – Create and manage block volumes on the Hetzner Cloud
hcloud_volume – Create and manage block volumes on the Hetzner Cloud
New in version 2.8.
Synopsis
- Create, update and attach/detach block volumes on the Hetzner Cloud.
Requirements
The below requirements are needed on the host that executes this module.
- hcloud-python >= 1.0.0
Parameters
Parameter | Choices/Defaults | Comments |
---|---|---|
api_token string / required |
This is the API Token for the Hetzner Cloud. | |
automount boolean |
|
Automatically mount the Volume. |
endpoint string |
Default: |
This is the API Endpoint for the Hetzner Cloud. |
format string |
|
Automatically Format the volume on creation Can only be used in case the Volume does not exists. |
id integer |
The ID of the Hetzner Cloud Block Volume to manage. Only required if no volume name is given | |
labels dictionary |
User-defined key-value pairs. | |
location string |
Location of the Hetzner Cloud Volume. Required if no server is given and Volume does not exists. | |
name string |
The Name of the Hetzner Cloud Block Volume to manage. Only required if no volume id is given or a volume does not exists. | |
server string |
Server Name the Volume should be assigned to. Required if no location is given and Volume does not exists. | |
size integer |
The size of the Block Volume. Required if volume does not yet exists. | |
state string |
|
State of the volume. |
See Also
Examples
- name: Create a volume
hcloud_volume:
name: my-volume
location: fsn1
size: 100
state: present
- name: Create a volume and format it with ext4
hcloud_volume:
name: my-volume
location: fsn
format: ext4
size: 100
state: present
- name: Mount a existing volume and automount
hcloud_volume:
name: my-volume
server: my-server
automount: yes
state: present
- name: Mount a existing volume and automount
hcloud_volume:
name: my-volume
server: my-server
automount: yes
state: present
- name: Ensure the volume is absent (remove if needed)
hcloud_volume:
name: my-volume
state: absent
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description | |
---|---|---|---|
hcloud_volume complex |
Always |
The block volume
| |
id integer |
Always |
ID of the volume
Sample: 12345 | |
labels dictionary |
Always |
User-defined labels (key-value pairs)
Sample: {'key': 'value', 'mylabel': 123} | |
location string |
Always |
Location name where the volume is located at
Sample: fsn1 | |
name string |
Always |
Name of the volume
Sample: my-volume | |
server string |
Always |
Server name where the volume is attached to
Sample: my-server | |
size integer |
Always |
Size in MB of the volume
Sample: 1337 |
Status
- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Community. [community]
Authors
- Christopher Schmitt (@cschmitt-hcloud)
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.8/modules/hcloud_volume_module.html