Hello Mr. Kai, Sorry for not being clear. What I'm working on is probably a big playbook. So I used Ansible roles wisdom, for code re-usability. The main playbook will invoke each role as I develop, and I need to debug each role by calling the main playbook. That's why I figure it to use tags, since each role is also tagged differently. Today I found that some pieces of task in roles are not tagged at all, so it skipped. As I added missing tags, everything worked as expected.
One thing I want to share with you and others is it is probably not a good idea to tag the main playbook, if you already tag the roles. If main playbook is tagged, when invoking with both main playbook's tag and role's tag, it causes unwanted roles to be invoked, and when invoking only role's tag, gathering facts will be skipped. So it is better to not tag the main playbook. There is no need to create setup module. Using gather_facts: yes in main playbook is fine. Just find tags can be applied to roles this way: https://docs.ansible.com/ansible/latest/user_guide/playbooks_tags.html: roles: - role: webserver tags: [ web, foo ] - Xinhuan -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/ab8b723e-d40d-416f-b43c-732e83cb3afd%40googlegroups.com.
