docs:tips_n_tricks:ansible:shell.html
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Last revisionBoth sides next revision | ||
docs:tips_n_tricks:ansible:shell.html [25.11.2023 15:22 CET] – peter | docs:tips_n_tricks:ansible:shell.html [25.11.2023 15:36 CET] – peter | ||
---|---|---|---|
Line 17: | Line 17: | ||
changed_when: | changed_when: | ||
failed_when: | failed_when: | ||
+ | </ | ||
+ | ===== Task Template executing always - even in check mode - and failing on any output to stderr ===== | ||
+ | This might be useful when using a script to gather information about the target host | ||
+ | <code yaml roles/ | ||
+ | - name: You name it | ||
+ | shell: | | ||
+ | echo ' | ||
+ | check_mode: False | ||
+ | register: last_result | ||
+ | changed_when: | ||
+ | failed_when: | ||
+ | |||
+ | - name: Add to list if name does not exist | ||
+ | set_fact: | ||
+ | list_of_information: | ||
+ | loop: "{{ last_result.stdout_lines | from_json }}" | ||
+ | when: " | ||
</ | </ | ||
{{tag> | {{tag> | ||
{{entry> | {{entry> | ||
{{entry> | {{entry> |
docs/tips_n_tricks/ansible/shell.html.txt · Last modified: 25.11.2023 15:45 CET by peter