Ansible 2.2 is our default: "always_run" goes away

This commit is contained in:
Jérémy Lecour 2017-03-24 15:27:16 +01:00 committed by Jérémy Lecour
parent d680ec831b
commit b8c43d2b12

View file

@ -186,21 +186,20 @@ The source file or template shouldn't to be prefixed for ordering (eg. `z-` or `
Ansible can run playbooks in "check mode" with the `--check` argument of `ansible-playbook`. It won't do any changing action but will report what would be changed or not.
When an action depends on a variable registered by a previous action (that performs no change, like a grep, stat…) we should add a `always_run: yes` to the action. In Ansible 2.2, the behaviour has been replace by `check_mode: yes.` Exemple :
When an action depends on a variable registered by a previous action (that performs no change, like a grep, stat…) we should add a `check_mode: yes` (`always_run: yes` in Ansible <= 2.1). Example :
```
- name: Check if Munin plugins exists
stat:
path: /etc/munin/plugins/
register: munin_plugins_dir
#check_mode: no (for migration to Ansible 2.2)
always_run: yes
check_mode: no
- name: Get Munin plugin
copy:
src: munin/drbd-plugin
dest: /etc/munin/plugins/drbd
mode: "755"
mode: "0755"
when: munin_plugins_dir.stat.exists
notify: restart munin-node
```