I am trying to ask the user if they would like the new user they are creating to be a sudor or not.
- hosts: localhost
vars_prompt:
- name: is_sudoer
prompt: Is the new user a sudoer (Y/N)?
private: no
tasks:
- name: debugTruth
debug:
msg: "Statement True"
when: is_sudoer|default(false)|bool == true
- name: debugFalse
debug:
msg: "Statement False"
when: is_sudoer|default(false)|bool == false
However, no matter what I input, the script always defaults to false. I thought "y", "Y", "yes" etc always evaluated to true in the ansible.
Here is the output I get:
ansible-playbook manageUsers.yml
Is the new user a sudoer (Y/N)?: y
...
TASK [debugTruth] **********************************************
skipping: [localhost]
TASK [debugFalse] **********************************************
ok: [localhost] => {
"msg": "Statement False"
}
As you can see I always get a false response.