hetzner.hcloud.storage_box_subaccount module – Create and manage Storage Box Subaccounts 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_subaccount.

Synopsis

Aliases: hcloud_storage_box_subaccount

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 Subaccount.

reachable_externally

boolean

Whether access from outside the Hetzner network is allowed.

Choices:

  • false ← (default)

  • true

readonly

boolean

Whether the Subaccount is read-only.

Choices:

  • false ← (default)

  • true

samba_enabled

boolean

Whether the Samba subsystem is enabled.

Choices:

  • false ← (default)

  • true

ssh_enabled

boolean

Whether the SSH subsystem is enabled.

Choices:

  • false ← (default)

  • true

webdav_enabled

boolean

Whether the WebDAV subsystem is enabled.

Choices:

  • false ← (default)

  • true

api_endpoint

aliases: endpoint

string

The endpoint for the Hetzner Cloud API.

You can also set this option by using the HCLOUD_ENDPOINT environment variable.

Default: "https://api.hetzner.cloud/v1"

api_endpoint_hetzner

string

The endpoint for the Hetzner API.

You can also set this option by using the HETZNER_ENDPOINT environment variable.

Default: "https://api.hetzner.com/v1"

api_token

string / required

The token for the Hetzner Cloud API.

You can also set this option by using the HCLOUD_TOKEN environment variable.

description

string

Description of the Storage Box Subaccount.

home_directory

string

Home directory of the Storage Box Subaccount.

Required if the Storage Box Subaccount does not exist.

id

integer

ID of the Storage Box Subaccount to manage.

Required if no Storage Box Subaccount name is given.

If the ID is invalid, the module will fail.

labels

dictionary

User-defined labels (key-value pairs) for the Storage Box Subaccount.

name

string

Name of the Storage Box Subaccount to manage.

Required if no Storage Box Subaccount id is given.

Required if the Storage Box Subaccount does not exist.

Because the API resource does not have this property, the name is stored in the Storage Box Subaccount labels. This ensures that the module is idempotent, and removes the need to use different module arguments for create and update.

password

string

Password for the Storage Box Subaccount.

Required if the Storage Box Subaccount does not exist or when state=reset_password.

state

string

State of the Storage Box Subaccount.

reset_password is not idempotent.

Choices:

  • "absent"

  • "present" ← (default)

  • "reset_password"

storage_box

string / required

ID or Name of the parent Storage Box.

Using the ID is preferred, to reduce the amount of API requests.

See Also

See also

Documentation for Hetzner APIs

Complete reference for the Hetzner APIs.

Examples

- name: Create a Storage Box Subaccount
  hetzner.hcloud.storage_box_subaccount:
    storage_box: my-storage-box
    name: subaccount1
    home_directory: backups/subaccount1
    password: secret
    access_settings:
      reachable_externally: false
      ssh_enabled: true
      samba_enabled: false
      webdav_enabled: false
      readonly: false
    labels:
      env: prod
    state: present

- name: Reset a Storage Box Subaccount password
  hetzner.hcloud.storage_box_subaccount:
    storage_box: my-storage-box
    name: subaccount1
    password: secret
    state: reset_password

- name: Delete a Storage Box Subaccount by name
  hetzner.hcloud.storage_box_subaccount:
    storage_box: my-storage-box
    name: subaccount1
    state: absent

- name: Delete a Storage Box Subaccount by id
  hetzner.hcloud.storage_box_subaccount:
    storage_box: 497436
    id: 158045
    state: absent

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

hcloud_storage_box_subaccount

dictionary

Details about the Storage Box Subaccount.

Returned: always

access_settings

dictionary

Access settings of the Storage Box Subaccount.

Returned: always

reachable_externally

boolean

Whether access from outside the Hetzner network is allowed.

Returned: always

Sample: false

readonly

boolean

Whether the Subaccount is read-only.

Returned: always

Sample: false

samba_enabled

boolean

Whether the Samba subsystem is enabled.

Returned: always

Sample: false

ssh_enabled

boolean

Whether the SSH subsystem is enabled.

Returned: always

Sample: true

webdav_enabled

boolean

Whether the WebDAV subsystem is enabled.

Returned: always

Sample: false

created

string

Point in time when the Storage Box Subaccount was created (in RFC3339 format).

Returned: always

Sample: "2025-12-03T13:47:47Z"

description

string

Description of the Storage Box Subaccount.

Returned: always

Sample: "backups from subaccount1"

home_directory

string

Home directory of the Storage Box Subaccount.

Returned: always

Sample: "backups/subaccount1"

id

integer

ID of the Storage Box Subaccount.

Returned: always

Sample: 158045

labels

dictionary

User-defined labels (key-value pairs) of the Storage Box Subaccount.

Returned: always

Sample: {"env": "prod"}

name

string

Name of the Storage Box Subaccount.

Returned: always

Sample: "subaccount1"

server

string

FQDN of the Storage Box Subaccount.

Returned: always

Sample: "u514605-sub1.your-storagebox.de"

storage_box

integer

ID of the parent Storage Box.

Returned: always

Sample: 497436

username

string

Username of the Storage Box Subaccount.

Returned: always

Sample: "u514605-sub1"

Authors

  • Jonas Lammler (@jooola)