hetzner.hcloud.storage_box module – Create and manage Storage Boxes in Hetzner.
Note
This module is part of the hetzner.hcloud collection (version 6.4.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.
Experimental: Storage Box support is experimental, breaking changes may occur within minor releases. See https://github.com/ansible-collections/hetzner.hcloud/issues/756 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 of the Storage Box. |
|
Whether access from outside the Hetzner network is allowed. Choices:
|
|
Whether the Samba subsystem is enabled. Choices:
|
|
Whether the SSH subsystem is enabled. Choices:
|
|
Whether the WebDAV subsystem is enabled. Choices:
|
|
Whether the ZFS snapshot folder is visible. Choices:
|
|
The endpoint for the Hetzner Cloud API. You can also set this option by using the Default: |
|
The endpoint for the Hetzner API. You can also set this option by using the Default: |
|
The token for the Hetzner Cloud API. You can also set this option by using the |
|
Protect the Storage Box from deletion. Choices:
|
|
ID of the Storage Box to manage. Required if no Storage Box If the ID is invalid, the module will fail. |
|
User-defined labels (key-value pairs) for the Storage Box. |
|
Name or ID of the Location for the Storage Box. Required if the Storage Box does not exist. |
|
Name of the Storage Box to manage. Required if no Storage Box Required if the Storage Box does not exist. |
|
Password for the Storage Box. Required if the Storage Box does not exist. |
|
Snapshot ID or Name to rollback to. Only used when |
|
Snapshot plan of the Storage Box. Use null to disabled the snapshot plan. |
|
Day of the month when the Snapshot Plan is executed. Null means every day. |
|
Day of the week when the Snapshot Plan is executed. Starts at 1 for Monday til 7 for Sunday. Null means every day. |
|
Hour when the Snapshot Plan is executed (UTC). |
|
Maximum amount of Snapshots that will be created by this Snapshot Plan. Older Snapshots will be deleted. |
|
Minute when the Snapshot Plan is executed (UTC). |
|
SSH public keys in OpenSSH format to inject into the Storage Box. |
|
State of the Storage Box.
Choices:
|
|
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 |
|---|---|
Details about the Storage Box. Returned: always |
|
Access settings of the Storage Box. Returned: always |
|
Whether access from outside the Hetzner network is allowed. Returned: always Sample: |
|
Whether the Samba subsystem is enabled. Returned: always Sample: |
|
Whether the SSH subsystem is enabled. Returned: always Sample: |
|
Whether the WebDAV subsystem is enabled. Returned: always Sample: |
|
Whether the ZFS snapshot folder is visible. Returned: always Sample: |
|
Protect the Storage Box from deletion. Returned: always Sample: |
|
ID of the Storage Box. Returned: always Sample: |
|
User-defined labels (key-value pairs) of the Storage Box. Returned: always Sample: |
|
Name of the Location of the Storage Box. Returned: always Sample: |
|
Name of the Storage Box. Returned: always Sample: |
|
FQDN of the Storage Box. Returned: always Sample: |
|
Snapshot plan of the Storage Box. Returned: when enabled |
|
Day of the month when the Snapshot Plan is executed. Null means every day. Returned: always Sample: |
|
Day of the week when the Snapshot Plan is executed. Null means every day. Returned: always Sample: |
|
Hour when the Snapshot Plan is executed (UTC). Returned: always Sample: |
|
Maximum amount of Snapshots that will be created by this Snapshot Plan. Returned: always Sample: |
|
Minute when the Snapshot Plan is executed (UTC). Returned: always Sample: |
|
Statistics of the Storage Box. Returned: always |
|
Current disk usage in bytes. Returned: always Sample: |
|
Current disk usage for data in bytes. Returned: always Sample: |
|
Current disk usage for snapshots in bytes. Returned: always Sample: |
|
Status of the Storage Box. Returned: always Sample: |
|
Name of the Storage Box Type. Returned: always Sample: |
|
Host system of the Storage Box. Returned: always Sample: |
|
User name of the Storage Box. Returned: always Sample: |