mirror of
https://github.com/ansible-collections/hetzner.hcloud.git
synced 2026-02-04 08:01:49 +00:00
feat: add hetzner.hcloud.all action group (#396)
##### SUMMARY
This allows to use `module_defaults` against all the modules at once
using the new `hetzner.hcloud.all` `action_group`.
You can now pass the `api_token` argument using module_defaults:
```yaml
- name: Demonstrate the usage of the 'hetzner.hcloud.all' module_defaults group
hosts: localhost
connection: local
module_defaults:
group/hetzner.hcloud.all:
api_token: "{{ _vault_hcloud_api_token }}"
tasks:
- name: Create a volume
hetzner.hcloud.volume:
name: my-volume
location: fsn1
size: 100
state: present
register: volume
```
See the documentation and examples for more details.
##### ISSUE TYPE
- Feature Pull Request
This commit is contained in:
parent
7c9fbf85a7
commit
6581ed50db
5 changed files with 88 additions and 0 deletions
|
|
@ -24,3 +24,25 @@ Alternatively, you may provide the API token directly as module argument:
|
|||
server_type: cx11
|
||||
image: debian-12
|
||||
state: present
|
||||
|
||||
To reduce the duplication of the above solution, you may configure the
|
||||
``hetzner.hcloud.*`` modules using the ``hetzner.hcloud.all`` action group, for
|
||||
example if you want to store your API token in a vault:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
- name: Demonstrate the usage of the 'hetzner.hcloud.all' module_defaults group
|
||||
hosts: localhost
|
||||
connection: local
|
||||
|
||||
module_defaults:
|
||||
group/hetzner.hcloud.all:
|
||||
api_token: "{{ _vault_hcloud_api_token }}"
|
||||
|
||||
tasks:
|
||||
- name: Create server
|
||||
hetzner.hcloud.server:
|
||||
name: my-server
|
||||
server_type: cx11
|
||||
image: debian-12
|
||||
state: present
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue