hetzner.hcloud.storage_box module – Create and manage Storage Boxes in Hetzner.
Note
This module is part of the hetzner.hcloud collection (version 6.9.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.storage_box.
Synopsis
- Create, update and delete Storage Boxes in Hetzner.
- See the Storage Boxes API documentation for more details.
Aliases: hcloud_storage_box
Requirements
The below requirements are needed on the host that executes this module.
- python-dateutil >= 2.7.5
- requests >=2.20
Parameters
Parameter | Comments |
|---|---|
access_settings dictionary | Access settings of the Storage Box. |
|
reachable_externally boolean |
Whether access from outside the Hetzner network is allowed. Choices:
|
|
samba_enabled boolean |
Whether the Samba subsystem is enabled. Choices:
|
|
ssh_enabled boolean |
Whether the SSH subsystem is enabled. Choices:
|
|
webdav_enabled boolean |
Whether the WebDAV subsystem is enabled. Choices:
|
|
zfs_enabled boolean |
Whether the ZFS snapshot folder is visible. Choices:
|
api_endpoint aliases: endpoint string | The endpoint for the Hetzner Cloud API. You can also set this option by using the Default: |
api_endpoint_hetzner string | The endpoint for the Hetzner API. You can also set this option by using the Default: |
api_token string / required | The token for the Hetzner Cloud API. You can also set this option by using the |
delete_protection boolean | Protect the Storage Box from deletion. Choices:
|
id integer | ID of the Storage Box to manage. Required if no Storage Box If the ID is invalid, the module will fail. |
labels dictionary | User-defined labels (key-value pairs) for the Storage Box. |
location string | Name or ID of the Location for the Storage Box. Required if the Storage Box does not exist. |
name string | Name of the Storage Box to manage. Required if no Storage Box Required if the Storage Box does not exist. |
password string | Password for the Storage Box. Required if the Storage Box does not exist. |
snapshot string | Snapshot ID or Name to rollback to. Only used when |
snapshot_plan dictionary | Snapshot plan of the Storage Box. Use null to disabled the snapshot plan. |
|
day_of_month integer |
Day of the month when the Snapshot Plan is executed. Null means every day. |
|
day_of_week integer |
Day of the week when the Snapshot Plan is executed. Starts at 1 for Monday til 7 for Sunday. Null means every day. |
|
hour integer / required |
Hour when the Snapshot Plan is executed (UTC). |
|
max_snapshots integer / required |
Maximum amount of Snapshots that will be created by this Snapshot Plan. Older Snapshots will be deleted. |
|
minute integer / required |
Minute when the Snapshot Plan is executed (UTC). |
ssh_keys list / elements=string | SSH public keys in OpenSSH format to inject into the Storage Box. |
state string | State of the Storage Box.
Choices:
|
storage_box_type aliases: type string | Name or ID of the Storage Box Type for the Storage Box. Required if the Storage Box does not exist. |
See Also
See also
- Documentation for Hetzner APIs
-
Complete reference for the Hetzner APIs.
Examples
- name: Create a Storage Box
hetzner.hcloud.storage_box:
name: my-storage-box
storage_box_type: bx11
location: fsn1
password: my-secret
labels:
env: prod
state: present
- name: Create a Storage Box with access settings
hetzner.hcloud.storage_box:
name: my-storage-box
storage_box_type: bx11
location: fsn1
password: my-secret
access_settings:
reachable_externally: true
ssh_enabled: true
samba_enabled: false
webdav_enabled: false
zfs_enabled: false
state: present
- name: Create a Storage Box with snapshot plan
hetzner.hcloud.storage_box:
name: my-storage-box
storage_box_type: bx11
location: fsn1
password: my-secret
snapshot_plan:
max_snapshots: 10
hour: 3
minute: 30
state: present
- name: Disable a Storage Box snapshot plan
hetzner.hcloud.storage_box:
name: my-storage-box
snapshot_plan: null
state: present
- name: Reset a Storage Box password
hetzner.hcloud.storage_box:
name: my-storage-box
password: my-secret
state: reset_password
- name: Rollback a Storage Box to a Snapshot
hetzner.hcloud.storage_box:
name: my-storage-box
snapshot: 2025-12-03T13-47-47
state: rollback_snapshot
- name: Delete a Storage Box
hetzner.hcloud.storage_box:
name: my-storage-box
state: absent
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key | Description |
|---|---|
hcloud_storage_box dictionary | Details about the Storage Box. Returned: always |
|
access_settings dictionary |
Access settings of the Storage Box. Returned: always |
|
reachable_externally boolean |
Whether access from outside the Hetzner network is allowed. Returned: always Sample: |
|
samba_enabled boolean |
Whether the Samba subsystem is enabled. Returned: always Sample: |
|
ssh_enabled boolean |
Whether the SSH subsystem is enabled. Returned: always Sample: |
|
webdav_enabled boolean |
Whether the WebDAV subsystem is enabled. Returned: always Sample: |
|
zfs_enabled boolean |
Whether the ZFS snapshot folder is visible. Returned: always Sample: |
|
delete_protection boolean |
Protect the Storage Box from deletion. Returned: always Sample: |
|
id integer |
ID of the Storage Box. Returned: always Sample: |
|
labels dictionary |
User-defined labels (key-value pairs) of the Storage Box. Returned: always Sample: |
|
location string |
Name of the Location of the Storage Box. Returned: always Sample: |
|
name string |
Name of the Storage Box. Returned: always Sample: |
|
server string |
FQDN of the Storage Box. Returned: always Sample: |
|
snapshot_plan dictionary |
Snapshot plan of the Storage Box. Returned: when enabled |
|
day_of_month integer |
Day of the month when the Snapshot Plan is executed. Null means every day. Returned: always Sample: |
|
day_of_week integer |
Day of the week when the Snapshot Plan is executed. Null means every day. Returned: always Sample: |
|
hour integer |
Hour when the Snapshot Plan is executed (UTC). Returned: always Sample: |
|
max_snapshots integer |
Maximum amount of Snapshots that will be created by this Snapshot Plan. Returned: always Sample: |
|
minute integer |
Minute when the Snapshot Plan is executed (UTC). Returned: always Sample: |
|
stats dictionary |
Statistics of the Storage Box. Returned: always |
|
size integer |
Current disk usage in bytes. Returned: always Sample: |
|
size_data integer |
Current disk usage for data in bytes. Returned: always Sample: |
|
size_snapshots integer |
Current disk usage for snapshots in bytes. Returned: always Sample: |
|
status string |
Status of the Storage Box. Returned: always Sample: |
|
storage_box_type string |
Name of the Storage Box Type. Returned: always Sample: |
|
system string |
Host system of the Storage Box. Returned: always Sample: |
|
username string |
User name of the Storage Box. Returned: always Sample: |
Collection links
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/projects/ansible/latest/collections/hetzner/hcloud/storage_box_module.html