I have this playbook:
roles:
- { role: common}
- { role: mariadb}
- { role: wordpress}
What is want is in every role I want to have first task as some conditional which if true then I want to skip the whole role and playbook continues to next.
Now I can use when
like this:
roles:
- { role: common, when: mvar is False }
But for that I have to evaluate the mvar
in playbook itself but for that mvar
I need all other vars etc. stuff which is in that role itself. So it will be easier for me to do in role.
Is there any way?
In each role, in tasks/main.yml
include a file with tasks only when the condition is met:
- include: real_tasks.yml
when: condition_is_met