tags within included_tasks do not work?

32 views
Skip to first unread message

coo...@gmail.com

unread,
Nov 2, 2017, 7:49:14 PM11/2/17
to Ansible Project
In a playbook I have a file of tasks included, like so:

- include_tasks: uplinks.yml

And within that task file I have a task:

- name: configure hosts
ios_config:
commands:
- ip host {{ item['name'] }} {{ item['port'] }} {{ interfaces['mgmt']['ip'] }}
with_items: "{{ host_entries }}"
tags: update_ts_hosts


If I try to run the playbook with only that tag, no tasks will run. If I move the tag to the included_tasks level, then all tasks under will run.

ie

- include_tasks: misc.yml
  tags: update_ts_hosts

I would like to be able to pick specific tasks out of included files, is there something I am missing here?  Thanks for any info!

coo...@gmail.com

unread,
Nov 2, 2017, 11:59:54 PM11/2/17
to Ansible Project
Figured this out, need to use import_tasks or tags don't work under it.  Reading this documentation https://docs.ansible.com/ansible/2.4/playbooks_reuse.html#differences-between-static-and-dynamic and not sure if its a bug or meant to be that way.
Reply all
Reply to author
Forward
0 new messages