summaryrefslogtreecommitdiffstats
path: root/ansible_collections/hetzner/hcloud/examples/use-module-defaults-group.yml
blob: f3de9adacb63ecc8f090704471965786dd9343bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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