Debian Codegraph @

test/integration/targets/copy/tasks/no_log.yml

raw
1 - block:
2
3 - set_fact:
4 dest: "{{ local_temp_dir }}/test_no_log"
5
6 - name: ensure playbook and dest files don't exist yet
7 file:
8 path: "{{ item }}"
9 state: absent
10 loop:
11 - "{{ local_temp_dir }}/test_no_log.yml"
12 - "{{ dest }}"
13
14 - name: create a playbook to run with command
15 copy:
16 dest: "{{local_temp_dir}}/test_no_log.yml"
17 content: !unsafe |
18 ---
19 - hosts: localhost
20 gather_facts: no
21 tasks:
22 - copy:
23 dest: "{{ dest }}"
24 content: "{{ secret }}"
25
26 - name: copy the secret while using -vvv and check mode
27 command: "ansible-playbook {{local_temp_dir}}/test_no_log.yml -vvv -e secret=SECRET -e dest={{dest}} --check"
28 register: result
29
30 - assert:
31 that:
32 - "'SECRET' not in result.stdout"
33
34 - name: copy the secret while using -vvv
35 command: "ansible-playbook {{local_temp_dir}}/test_no_log.yml -vvv -e secret=SECRET -e dest={{dest}}"
36 register: result
37
38 - assert:
39 that:
40 - "'SECRET' not in result.stdout"
41
42 - name: copy the secret while using -vvv and check mode again
43 command: "ansible-playbook {{local_temp_dir}}/test_no_log.yml -vvv -e secret=SECRET -e dest={{dest}} --check"
44 register: result
45
46 - assert:
47 that:
48 - "'SECRET' not in result.stdout"
49
50 - name: copy the secret while using -vvv again
51 command: "ansible-playbook {{local_temp_dir}}/test_no_log.yml -vvv -e secret=SECRET -e dest={{dest}}"
52 register: result
53
54 - assert:
55 that:
56 - "'SECRET' not in result.stdout"
57
58 - name: copy a new secret while using -vvv and check mode
59 command: "ansible-playbook {{local_temp_dir}}/test_no_log.yml -vvv -e secret=NEWSECRET -e dest={{dest}} --check"
60 register: result
61
62 - assert:
63 that:
64 - "'NEWSECRET' not in result.stdout"
65
66 - name: copy a new secret while using -vvv
67 command: "ansible-playbook {{local_temp_dir}}/test_no_log.yml -vvv -e secret=NEWSECRET -e dest={{dest}}"
68 register: result
69
70 - assert:
71 that:
72 - "'NEWSECRET' not in result.stdout"
73
74 always:
75
76 - name: remove temp test files
77 file:
78 path: "{{ item }}"
79 state: absent
80 loop:
81 - "{{ local_temp_dir }}/test_no_log.yml"
82 - "{{ dest }}"