ansible / ansible.builtin / v2.9.25 / module / hcloud_volume Create and manage block volumes on the Hetzner Cloud. | "added in version" 2.8 of ansible.builtin" Authors: Christopher Schmitt (@cschmitt-hcloud) preview | supported by communityansible.builtin.hcloud_volume (v2.9.25) — module
pip
Install with pip install ansible==2.9.25
Create, update and attach/detach block volumes on the Hetzner Cloud.
- 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
id: description: - The ID of the Hetzner Cloud Block Volume to manage. - Only required if no volume I(name) is given type: int name: description: - The Name of the Hetzner Cloud Block Volume to manage. - Only required if no volume I(id) is given or a volume does not exists. type: str size: description: - The size of the Block Volume in GB. - Required if volume does not yet exists. type: int state: choices: - absent - present default: present description: - State of the volume. type: str format: choices: - xfs - ext4 description: - Automatically Format the volume on creation - Can only be used in case the Volume does not exists. type: str labels: description: - User-defined key-value pairs. type: dict server: description: - Server Name the Volume should be assigned to. - Required if no I(location) is given and Volume does not exists. type: str endpoint: default: https://api.hetzner.cloud/v1 description: - This is the API Endpoint for the Hetzner Cloud. type: str location: description: - Location of the Hetzner Cloud Volume. - Required if no I(server) is given and Volume does not exists. type: str api_token: description: - This is the API Token for the Hetzner Cloud. required: true type: str automount: description: - Automatically mount the Volume. type: bool
hcloud_volume: contains: id: description: ID of the volume returned: Always sample: 12345 type: int labels: description: User-defined labels (key-value pairs) returned: Always sample: key: value mylabel: 123 type: dict location: description: Location name where the volume is located at returned: Always sample: fsn1 type: str name: description: Name of the volume returned: Always sample: my-volume type: str server: description: Server name where the volume is attached to returned: Always sample: my-server type: str size: description: Size in GB of the volume returned: Always sample: 1337 type: int description: The block volume returned: Always type: complex