changed_when
The task keyword that decides, from a condition, whether the task should report changed.
In more detail
changed_when: false tells Ansible a command only reads information, so it reports ok instead of the command module's usual changed. That keeps the change counter honest, so a real change still stands out. It does not stop the command from running.
Related terms
- command module — The module that runs any program you name on the host and reports what it printed, without being able to tell whether it changed anything.
- changed — The task result meaning the module ran and altered the host to make it match the description.
- idempotency — The property of an operation that gives the same result whether you run it once or many times, because a repeat run finds nothing left to do.
Taught in
- Connections And Privilege Escalation — Ansible Configuration Management at Scale
- Conditionals: register, when, changed_when And failed_when — RHCE in Ansible (EX294): Automate Red Hat Systems
- Services And Boot Targets: Started Is Not Enabled — RHCE in Ansible (EX294): Automate Red Hat Systems
- File Systems And Mounts: mounted, present And UUIDs — RHCE in Ansible (EX294): Automate Red Hat Systems
- SELinux: Labels, Ports And Booleans That Persist — RHCE in Ansible (EX294): Automate Red Hat Systems