ansible Ansible: Loops and Conditionals Simple "When" Example(s)


Example

Given:

---
variable_name: True

Then, these tasks with always run.

- name: This is a conditional task
  module: src=/example/ dest=/example
  when: variable_name 

- name: This is a conditional task
  module: src=/example/ dest=/example
  when: True

This task will never run.

- name: This is a conditional task
  module: src=/example/ dest=/example
  when: False