Ansible lack of variable types lame
I consider this an egregious oversight (or neglect) on Ansible's part. The fact that you can't create a boolean fact makes playbooks horribly verbose and hard to read.
The following creates a string "True". I have not found a way around this.
- set_fact:
force_deploy: "{{ FORCE_DEPLOY is defined }}"
Then to use it you have to cast it.
when: force_deploy|bool
If you have a mildly complex clause it gets really ugly.
when: restart|bool and (not_deployed|bool or force_deploy|bool)
This would be so much nicer.
when: restart and (not_deployed or force_deploy)
Why doesn't ansible just add something like this.
- set_fact:
force_deploy: "{{ FORCE_DEPLOY is defined }}"
type: bool
What's worse is that most Ansible playbooks just sprinkle this all over the place.
when: restart is defined and (not_deployed is defined or force_deploy is defined)