Hi all,
Is there a way, or what is the syntax since I can’t seem to find it on importing an ansible playbook and with that applying a specific tag to one or some of those playbooks?
Hi all,
Is there a way, or what is the syntax since I can’t seem to find it on importing an ansible playbook and with that applying a specific tag to one or some of those playbooks?
First you should read these pages that describe the difference between import vs include.
https://docs.ansible.com/ansible/2.9/user_guide/playbooks_reuse_includes.html
Do you want to import these playbooks and parse them once at load time, or “include” and parse them as they are encountered at run-time?
One reason to consider include vs import. If you have a when clause on an imported playbook, all the tasks within the playbook inherit that when clause and are evaluated individually. If you have a when clause on an included playbook, it applies to the include task itself (whether I include and execute the playbook). This can be a huge performance improvement.
Secondly you want to consider whether you want to include “playbooks” or “tasks” files. Task files inherit the inventory, become, gather_facts, etc of the parent playbook that includes them.
Walter