How to disable gathering facts for subplays not included within given tag?

Question:

Several of my playbooks have sub-plays structure like this:

In Ansible 1.x both admins and developers were able to use such playbook. Admins could run it with all the tags (root and user access), while developers had access only to the last tag with tasks at user access level. When developers run this playbook with the app tag, gathering facts was skipped for the first two tags. Now however, in Ansible 2.1, it is not being skipped, which causes failure for users without root access.

Is there a mechanism or an easy modification to fix this behaviour? Is there a new approach which should be applied for such cases now?

Answer:

There is an easy mod – turn off facts gathering and call setup explicitly:

Leave a Reply