On 1/27/21 8:49 PM, Ramesh AR wrote:
> Racke,
>
> No, still its going through all tags .. not working on specific tag in loop
>
You are sure?
My task:
- debug:
msg: "{{ item.title.split()[0] }}"
when: item.title.split()[0] in ansible_run_tags
with_items:
- { title: tag1 created, file: tag1.txt }
- { title: tag2 created, file: tag2.txt }
- { title: tag3 created, file: tag3.txt }
- { title: tag4 created, file: tag4.txt }
- { title: tag5 created, file: tag5.txt }
tags: ['tag1', 'tag2', 'tag3','tag4', 'tag5']
Executed with --tags=tag4:
TASK [debug] *******************************************************************
skipping: [buster-test-box] => (item={'title': 'tag1 created', 'file': 'tag1.txt'})
skipping: [buster-test-box] => (item={'title': 'tag2 created', 'file': 'tag2.txt'})
skipping: [buster-test-box] => (item={'title': 'tag3 created', 'file': 'tag3.txt'})
ok: [buster-test-box] => (item={'title': 'tag4 created', 'file': 'tag4.txt'}) =>
msg: tag4
skipping: [buster-test-box] => (item={'title': 'tag5 created', 'file': 'tag5.txt'})
Regards
Racke
>
> Thanks,
> Ramesh
> On Wednesday, 27 January 2021 at 14:30:02 UTC-5
brae...@gmail.com wrote:
>
> On 1/27/21 7:48 PM, Dick Visser wrote:
> > On Wed, 27 Jan 2021 at 18:54, Ramesh AR <
rames...@gmail.com> wrote:
> >>
> >> 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
> >>
> >> tasks:
> >> - name: Comment on ticket
> >> tags: ['tag1', 'tag2', 'tag3',' tag4', 'tag5']
> >> jira:
> >> uri: '
https://ccp.sys.comcast.net <
https://ccp.sys.comcast.net>'
> --
> 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
>
ansible-proje...@googlegroups.com <mailto:
ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/ansible-project/bc9b90a7-8b06-42b9-9bef-061b4443a412n%40googlegroups.com
> <
https://groups.google.com/d/msgid/ansible-project/bc9b90a7-8b06-42b9-9bef-061b4443a412n%40googlegroups.com?utm_medium=email&utm_source=footer>.