If you look at the result of starting your play with vars_prompt , you will see that the fail task starts after other roles. This is also mentioned in Ansible docs for slot machines and roles :
If the game still has a "tasks" section, these tasks are performed after completing the roles.
As stated above, it is also mentioned whether you want to force the task to run before any roles, you can use pre_tasks .
So, to get a hint in the confirmation style, you can simply do this:
- hosts: all vars_prompt: - name: CONFIRM prompt: Just to confirm you will install stuff pre_tasks: - fail: no deployment this time when: CONFIRM != 'yes' roles: - common - install_nginx
source share