Using True False with Ansible When Clause

To run a task when destroy is true:

---
- hosts: localhost
  connection: local
  vars:
    destroy: true
  tasks:
    - debug:
      when: destroy

and when destroy is false:

---
- hosts: localhost
  connection: local
  vars:
    destroy: false
  tasks:
    - debug:
      when: not destroy

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)