I'd like to be able to run a role and, by default, exclude the code deployment portion. I'd also like to be able to deploy the code without running any other tasks.
I could include a line in the main.yml file for my project role that would only include the deploy.yml file when the deploy_code variable is true. Something similar to below:
- include: deploy.yml
when: "deploy_code"
To deploy code, I would run a command like the following:
ansible-playbook site.yml --extra-vars "deploy_code=true"
The problem with this is that my site.yml file has several other entries besides just my project role. The same is true for my project role's main.yml – it contains other includes besides the deploy.yml. So if run the above command, yes my code will deploy, but every other task will also run, which I don't want to have happen.
Does that make things clearer at all?