March 2019
Intermediate to advanced
412 pages
9h 49m
English
Sometimes, it can be desirable to completely suppress changes. This is often used when executing a command in order to gather data. The command execution isn't actually changing anything; instead, it's just gathering info, like the setup module. Suppressing changes on such tasks can be helpful for quickly determining whether a playbook run resulted in any actual change in the fleet.
To suppress change, simply use false as an argument to the changed_when task key. Let's extend one of our previous examples to discover the active iscsi sessions to suppress changes:
- name: discover iscsi sessions command: /sbin/iscsiadm -m session register: sessions failed_when: - sessions.rc != 0 - not sessions.stderr is search('No active ...Read now
Unlock full access