-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathtests_default_wrapper.yml
45 lines (41 loc) · 1.14 KB
/
tests_default_wrapper.yml
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
36
37
38
39
40
41
42
43
44
45
---
- name: Create static inventory from hostvars
tags:
- 'tests::slow'
hosts: all
tasks:
- name: Create temporary file
tempfile:
state: file
suffix: .inventory.yaml
register: tempinventory
delegate_to: localhost
- name: Create static inventory from hostvars
template:
src: inventory.yaml.j2
dest: "{{ tempinventory.path }}"
mode: '0644'
delegate_to: localhost
- name: Run tests_default.yml normally
tags:
- 'tests::slow'
import_playbook: tests_default.yml
- name: Run tests_default.yml in check_mode
tags:
- 'tests::slow'
hosts: all
tasks:
- name: Run ansible-playbook with tests_default.yml in check mode
command: >-
{{ __ap_cmd | quote }} -vvv -i {{ tempinventory.path }}
--check tests_default.yml
changed_when: false
delegate_to: localhost
vars:
__ap_cmd: "{{ ansible_playbook_filepath | d('ansible-playbook') }}"
- name: Remove the temporary file
file:
path: "{{ tempinventory.path }}"
state: absent
when: tempinventory.path is defined
delegate_to: localhost