Debian Codegraph @

test/integration/targets/no_log/no_log_local.yml

raw
1 # TODO: test against real connection plugins to ensure they're not leaking module args
2
3 - name: normal play
4 hosts: testhost
5 gather_facts: no
6 tasks:
7 - include_vars: secretvars.yml
8 no_log: true
9
10 - name: args should be logged in the absence of no_log
11 shell: echo "{{log_me_prefix}}TASK_SUCCEEDED"
12
13 - name: failed args should be logged in the absence of no_log
14 shell: echo "{{log_me_prefix}}TASK_FAILED"
15 failed_when: true
16 ignore_errors: true
17
18 - name: item args should be logged in the absence of no_log
19 shell: echo {{ item }}
20 with_items: [ "{{log_me_prefix}}ITEM", "{{log_me_prefix}}SKIPPED", "{{log_me_prefix}}ITEM_FAILED" ]
21 when: item != log_me_prefix ~ "SKIPPED"
22 failed_when: item == log_me_prefix ~ "ITEM_FAILED"
23 ignore_errors: true
24
25 - name: args should not be logged when task-level no_log set
26 shell: echo "DO_NOT_LOG_TASK_SUCCEEDED"
27 no_log: true
28
29 - name: failed args should not be logged when task-level no_log set
30 shell: echo "DO_NOT_LOG_TASK_FAILED"
31 no_log: true
32 failed_when: true
33 ignore_errors: true
34
35 - name: skipped task args should be suppressed with no_log
36 shell: echo "DO_NOT_LOG_TASK_SKIPPED"
37 no_log: true
38 when: false
39
40 - name: items args should be suppressed with no_log in every state
41 shell: echo {{ item }}
42 no_log: true
43 with_items: [ "DO_NOT_LOG_ITEM", "DO_NOT_LOG_ITEM_SKIPPED", "DO_NOT_LOG_ITEM_FAILED" ]
44 when: item != "DO_NOT_LOG_ITEM_SKIPPED"
45 failed_when: item == "DO_NOT_LOG_ITEM_FAILED"
46 ignore_errors: yes
47
48 - name: async task args should suppressed with no_log
49 async: 10
50 poll: 1
51 shell: echo "DO_NOT_LOG_ASYNC_TASK_SUCCEEDED"
52 no_log: true
53
54 - name: play-level no_log set
55 hosts: testhost
56 gather_facts: no
57 no_log: true
58 tasks:
59 - name: args should not be logged when play-level no_log set
60 shell: echo "DO_NOT_LOG_PLAY"
61
62 - name: args should not be logged when both play- and task-level no_log set
63 shell: echo "DO_NOT_LOG_TASK_AND_PLAY"
64 no_log: true
65
66 - name: args should be logged when task-level no_log overrides play-level
67 shell: echo "{{log_me_prefix}}OVERRIDE"
68 no_log: false
69
70 - name: Add a fake host for next play
71 add_host:
72 hostname: fake
73
74 - name: use 'fake' unreachable host to force unreachable error
75 hosts: fake
76 gather_facts: no
77 connection: ssh
78 tasks:
79 - name: 'EXPECTED FAILURE: Fail to run a lineinfile task'
80 vars:
81 logins:
82 - machine: foo
83 login: bar
84 password: DO_NOT_LOG_UNREACHABLE_ITEM
85 - machine: two
86 login: three
87 password: DO_NOT_LOG_UNREACHABLE_ITEM
88 lineinfile:
89 path: /dev/null
90 mode: 0600
91 create: true
92 insertafter: EOF
93 line: "machine {{ item.machine }} login {{ item.login }} password {{ item.password }}"
94 loop: "{{ logins }}"
95 no_log: true