when I defined tags in main.yml and roles, i couldn’t able to execute specific tags by using --tags or --skip-tags…
when I run the below with --tags=tag1 , I see whole playbook has executing
I have defined a task ( 127.0.0.1 ) in role, that’s also not working after role executed
Ok here’s the playbook and output . and am using only --tags=tag1 but am getting all output as mentioned ( with_items ) … since tag1 executing should show only tag1 correct
Yes, this is correct.
There is a list of 5 tags on this task, using any single one with
"ansible-playbook --tags" will cause the entire task to run - which
includes a loop.
You can't use --tags on ansible-playbook to limit the items in a loop on a task.
Ok here's the playbook and output . and am using only --tags=tag1 but am getting all output as mentioned ( with_items ) .. since tag1 executing should show only tag1 correct
$ validation.yml
---
- hosts: hosts
connection: local
gather_facts: no
roles:
- role: validation
Yes, this is correct.
There is a list of 5 tags on this task, using any single one with
"ansible-playbook --tags" will cause the entire task to run - which
includes a loop.
You can't use --tags on ansible-playbook to limit the items in a loop on a task.
You can try though the following condition to run the matching items from your list:
PLAY [127.0.0.1] ***********************************************************************************************************************************************************
Not sure, what's the problem. I see all skipping ..
Sometimes it's possible to spot a problem immediately. Unfortunately,
this is not the case. Loop No.10 and still nothing. The resolution of
this problem needs more effort.
Proceed step by step adding complexity until you find what's causing
the problem. Then post minimal, complete, and reproducible details if
you can't fix it.