The blog about containerisation, virtual machines and useful shell snippets and findings

Ansible remove False variables from environment

Use the following code snippet:

telegram:
  enabled: False

Env:
  - TELEGRAM_NOTIFICATION={{ telegram.enabled | ternary('true', None)}}

In this way False value evaluates to None and as outcome you’ll get empty TELEGRAM_NOTIFICATION variable