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