blob: fd4c351b6198e10ea992b84bbe8990778bb4de09 (
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
28
29
30
31
32
33
34
35
|
---
- name: Demonstrate the usage of 'refresh_inventory'
hosts: localhost
connection: local
tasks:
- name: Print hostvars
ansible.builtin.debug:
var: hostvars
- name: Create new server
hetzner.hcloud.server:
name: my-server
server_type: cx11
image: debian-12
- name: Refresh inventory
ansible.builtin.meta: refresh_inventory
- name: Run tests
block:
- name: Print updated inventory
ansible.builtin.debug:
var: hostvars
- name: Verify hostvars is not empty
ansible.builtin.assert:
that:
- hostvars != {}
always:
- name: Cleanup server
hetzner.hcloud.server:
name: my-server
state: absent
|