Skip to content

Instantly share code, notes, and snippets.

@hughsaunders
Last active March 3, 2017 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hughsaunders/c69c4ce8e06d9e5507ef7a5469ad5027 to your computer and use it in GitHub Desktop.
Save hughsaunders/c69c4ce8e06d9e5507ef7a5469ad5027 to your computer and use it in GitHub Desktop.
ansible string bools behave differently when part of an expression
ansible-playbook -i inventory/ test.yml
PLAY [localhost] ***************************************************************
TASK [debug] *******************************************************************
skipping: [localhost]
TASK [debug] *******************************************************************
skipping: [localhost]
TASK [debug] *******************************************************************
skipping: [localhost]
TASK [debug] *******************************************************************
ok: [localhost] => {
"msg": "quote in expression"
}
TASK [debug] *******************************************************************
skipping: [localhost]
TASK [debug] *******************************************************************
skipping: [localhost]
PLAY RECAP *********************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=0
---
- hosts: localhost
gather_facts: False
vars:
upper: False
lower: false
quote: "False"
tasks:
- debug:
msg: "upper"
when: upper
- debug:
msg: "lower"
when: lower
- debug:
msg: "quote"
when: quote
- debug:
msg: "quote in expression"
when: quote and true
- debug:
msg: "lower in expression"
when: lower and true
- debug:
msg: "upper in expression"
when: upper and true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment