community.hrobot.storagebox_subaccount module – Create, update, or delete a subaccount for a storage box
Note
This module is part of the community.hrobot collection (version 2.5.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 community.hrobot.
To use it in a playbook, specify: community.hrobot.storagebox_subaccount.
New in community.hrobot 2.4.0
Synopsis
- Create, update, or delete a subaccount for a storage box.
Parameters
Parameter | Comments |
|---|---|
comment string | A custom comment for the subaccount. Is required when using |
external_reachability boolean | Enable or disable external reachability (from outside Hetzner’s networks). Choices:
|
hetzner_password string | The password for the Robot web-service user. If |
hetzner_token string added in community.hrobot 2.5.0 | The API token for the Robot web-service user. One of |
hetzner_user string | The username for the Robot web-service user. One of If |
homedirectory string | Home directory of the subaccount. Required only when creating a subaccount ( |
idempotence string | Select which attribute to use to check subaccount existence. If set to If set to Choices:
|
password string | Password to use or change. See Will be ignored if |
password_mode string | Controls how password updates are handled. If If If When a new subaccount is created, the password is set to the specified one if Choices:
|
rate_limit_retry_timeout integer added in community.hrobot 2.1.0 | Timeout (in seconds) for waiting when rate limit exceeded errors are returned. Set to Set to a negative value like Default: |
readonly boolean | Enable or disable read-only mode. Choices:
|
samba boolean | Enable or disable Samba. Choices:
|
ssh boolean | Enable or disable SSH access. Choices:
|
state string | Desired state of this subaccount. Choices:
|
storagebox_id integer / required | The ID of the storage box to query. |
username string | Username of the subaccount. Required when using If |
webdav boolean | Enable or disable WebDAV. Choices:
|
Attributes
Attribute | Support | Description |
|---|---|---|
action_group | Action groups: community.hrobot.api, community.hrobot.robot | Use |
check_mode | Support: full | Can run in |
diff_mode | Support: none | Will return details on what has changed (or possibly needs changing in |
idempotent | Support: partial The Hetzner API does not allow to create subaccounts with specific usernames. You can instead use The module is never idempotent if | When run twice in a row outside check mode, with the same arguments, the second invocation indicates no change. This assumes that the system controlled/queried by the module has not changed in a relevant way. |
Notes
Note
- When passwords are autogenerated by the API (by omitting the
passwordfield), the resulting password is returned.
Examples
---
- name: Create a new subaccount with random password
community.hrobot.storagebox_subaccount:
storagebox_id: 123456
homedirectory: "/backups/project1"
samba: true
ssh: true
webdav: false
comment: "Backup for Project 1"
- name: Create a subaccount with custom password
community.hrobot.storagebox_subaccount:
storagebox_id: 123456
username: "backup1"
password: "s3cretPass123"
homedirectory: "/data/backup1"
readonly: false
samba: true
ssh: false
- name: Update an existing subaccount
community.hrobot.storagebox_subaccount:
storagebox_id: 123456
state: present
username: "backup1"
homedirectory: "/data/backup1-updated"
readonly: true
comment: "Updated path and readonly mode"
- name: Delete a subaccount
community.hrobot.storagebox_subaccount:
storagebox_id: 123456
state: absent
username: "backup1"
- name: Change password for a subaccount
community.hrobot.storagebox_subaccount:
storagebox_id: 123456
state: present
username: "backup1"
password: "n3wSecur3Pass"
- name: Create subaccount using comment for idempotence
community.hrobot.storagebox_subaccount:
storagebox_id: 123456
homedirectory: "/projects/backup1"
samba: true
ssh: true
webdav: false
readonly: false
comment: "Backup1 - Project Foo"
idempotence: comment
- name: Update subaccount identified by comment
community.hrobot.storagebox_subaccount:
storagebox_id: 123456
homedirectory: "/projects/backup1-updated"
readonly: true
comment: "Backup1 - Project Foo"
idempotence: comment
- name: Update password for subaccount using comment idempotence
community.hrobot.storagebox_subaccount:
storagebox_id: 123456
password: "Sup3rSecur3!"
comment: "Backup1 - Project Foo"
idempotence: comment
password_mode: update-if-provided
- name: Delete subaccount identified by comment
community.hrobot.storagebox_subaccount:
storagebox_id: 123456
state: absent
comment: "Backup1 - Project Foo"
idempotence: comment
- name: Use password only during creation
community.hrobot.storagebox_subaccount:
storagebox_id: 123456
password: "InitPass$42"
homedirectory: "/mnt/init"
samba: true
ssh: false
comment: "Init Subaccount"
idempotence: comment
password_mode: ignore-if-exists
- name: Always reset to a random password
community.hrobot.storagebox_subaccount:
storagebox_id: 123456
comment: "Temp Access - CI/CD"
idempotence: comment
password_mode: set-to-random
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key | Description |
|---|---|
created boolean | Whether a new subaccount was created. Returned: success |
deleted boolean | Whether the subaccount was deleted. Returned: success |
password_updated boolean | Whether the subaccount’s password was updated. Returned: success |
subaccount dictionary | The subaccount object returned by the API. If Returned: if |
updated boolean | Whether the subaccount’s configuration was updated (excluding password changes). Returned: success |
Collection links
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/hrobot/storagebox_subaccount_module.html