Debian Codegraph @

test/integration/targets/meta_tasks/refresh.yml

raw
1 - hosts: all
2 gather_facts: false
3 tasks:
4 - block:
5 - name: check initial state
6 assert:
7 that:
8 - "'one' in ansible_play_hosts"
9 - "'two' in ansible_play_hosts"
10 - "'three' in ansible_play_hosts"
11 - "'four' not in ansible_play_hosts"
12 run_once: true
13
14 - name: change symlink
15 file: src=./inventory_new.yml dest=./inventory_refresh.yml state=link force=yes follow=false
16 delegate_to: localhost
17 run_once: true
18
19 - name: refresh the inventory to new source
20 meta: refresh_inventory
21
22 always:
23 - name: revert symlink, invenotry was already reread or failed
24 file: src=./inventory_old.yml dest=./inventory_refresh.yml state=link force=yes follow=false
25 delegate_to: localhost
26 run_once: true
27
28 - hosts: all
29 gather_facts: false
30 tasks:
31 - name: check refreshed state
32 assert:
33 that:
34 - "'one' not in ansible_play_hosts"
35 - "'two' in ansible_play_hosts"
36 - "'three' in ansible_play_hosts"
37 - "'four' in ansible_play_hosts"
38 run_once: true