On 26.12.2019 21:50, Xinhuan Zheng wrote:
> I want to configure only networking part inside config. That is, config
> is
> parent level tag, I only want to invoke networking tag of the parent
> tag.
> Can I do that?
When you set the tag config on the play the always tag that gather facts
has is overwritten and will not be run without specifying the config
tag.
An alternative is not to use gather_facts but instead use the setup
module to gather facts.
> BTW, below isn't working:
>
> ansible-playbook -i test -l my_servers pb.yml --tags config,networking
What is not working?
If you mean gather facts you must be doing something else that your
previous mail since it work when I test.
test2.yml
---------
- hosts: all
gather_facts: yes
tasks:
- debug: msg="Task with networking tag"
tags:
- networking
tags:
- config
$ ansible-playbook -l gh test2.yml -t networking
PLAY [all] ***************************************
TASK [debug] *************************************
ok: [gh] => {}
MSG:
Task with networking tag
$ ansible-playbook -l gh test2.yml -t config,networking
PLAY [all] **********************************************
TASK [Gathering Facts] **********************************
ok: [gh]
TASK [debug] ********************************************
ok: [gh] => {}
MSG:
Task with networking tag
--
Kai Stian Olstad