summaryrefslogtreecommitdiffstats
path: root/ansible_collections/hetzner/hcloud/examples/use-module-defaults-group.yml
diff options
context:
space:
mode:
Diffstat (limited to 'ansible_collections/hetzner/hcloud/examples/use-module-defaults-group.yml')
-rw-r--r--ansible_collections/hetzner/hcloud/examples/use-module-defaults-group.yml27
1 files changed, 27 insertions, 0 deletions
diff --git a/ansible_collections/hetzner/hcloud/examples/use-module-defaults-group.yml b/ansible_collections/hetzner/hcloud/examples/use-module-defaults-group.yml
new file mode 100644
index 000000000..f3de9adac
--- /dev/null
+++ b/ansible_collections/hetzner/hcloud/examples/use-module-defaults-group.yml
@@ -0,0 +1,27 @@
+---
+- name: Demonstrate the usage of the 'hetzner.hcloud.all' module_defaults group
+ hosts: localhost
+ connection: local
+
+ module_defaults:
+ group/hetzner.hcloud.all:
+ api_token: LRK9DAWQ1ZAEFSrCNEEzLCUwhYX1U3g7wMg4dTlkkDC96fyDuyJ39nVbVjCKSDfj
+
+ tasks:
+ - name: Create a volume
+ hetzner.hcloud.volume:
+ name: my-volume
+ location: fsn1
+ size: 100
+ state: present
+ register: volume
+
+ - name: Create a server
+ hetzner.hcloud.server:
+ name: my-server
+ server_type: cx11
+ image: debian-12
+ location: fsn1
+ volumes:
+ - "{{ volume.hcloud_volume.id }}"
+ state: present