Hi,
I like to ask a confirmation at prompt before some action.
But the plabook skipped all the tasks.
Here is the plabook:
name: domain management
hosts: foo
gather_facts: truevars:
domain_join_credentials:
domain_join_user: !vault |
xxxxx
domain_join_password: !vault |
xxxxxvars_prompt:
name: “domain_join_user”
prompt: “Give the AD user that will be used to bond the domain”
default: “{{ domain_join_credentials.domain_join_user }}”
private: falsename: “domain_join_password”
prompt: “Give the password”
default: “{{ domain_join_credentials.domain_join_password }}”
private: truename: “action_leave_domain”
prompt: “Do you really want to leave the domain ? (YES to confirm)”
private: no
default: “NO”name: “action_join_domain”
prompt: “Do you want to join the domain ? (YES to confirm)”
private: no
default: “NO”tasks:
group_by: key={{ ansible_distribution }}
changed_when: falsename: Confirmation to quit the domain
ansible.builtin.debug:
msg: “You chose to leave the domain.”
when: action_leave_domain in [“YES”]name: Run leave_ad role
ansible.builtin.include_role:
name: leave_ad
when: action_leave_domain in [“YES”]name: Confirmation to join the domain
ansible.builtin.debug:
msg: “You chose to join the domain.”
when: action_join_domain in [“YES”]name: Run join_ad role
ansible.builtin.include_role:
name: join_ad
when: action_join_domain in [“YES”]
Here is the output:>
ok: [machine]
TASK [Group hosts by distribution] ************************************************************************************
ok: [machine]TASK [Confirmation to quit the domain] ********************************************************************************
skipping: [machine]TASK [Run leave_ad role] **********************************************************************************************
skipping: [machine]TASK [Confirmation to join the domain] ********************************************************************************
skipping: [machine]TASK [Run join_ad role] ***********************************************************************************************
skipping: [machine]PLAY RECAP ************************************************************************************************************
machine : ok=2 changed=0 unreachable=0 failed=0 skipped=4 rescued=0 ignored=0
Thanks for in advance.