Should --tags work for playbooks?

32 views
Skip to first unread message

Barry Kaplan

unread,
Jul 1, 2015, 3:46:57 AM7/1/15
to ansible...@googlegroups.com
I have:

---
- name: Dump data
  hosts
: mesos_slave
  sudo
: yes
  gather_facts
: false
  tags
:
   
- mtc

  tasks
:
    set_fact
:
      dump_s3_bucket
: product-data
    set_fact
:
      dump_s3_folder
: /dump


But trying to use --tags yields:

$ ansible-playbook -i inventory/aws/production playbooks/admin/backup-databases.yml -u ubuntu --tags mtc
ERROR
: tag(s) not found in playbook: mtc.  possible values:

Of course the plays works without the --tags. And I have tried "tags: [mtc]", "tags: mtc" to the same effect.

Barry Kaplan

unread,
Jul 1, 2015, 3:54:48 AM7/1/15
to ansible...@googlegroups.com
Very interesting. My tasks were wrong:

tasks:
  set_fact:

vs

tasks:
  - set_fact:

No errors so it looked like the tags were being ignored. Correctly task syntax and tags are not ignored.

Brian Coca

unread,
Jul 1, 2015, 10:56:59 AM7/1/15
to ansible...@googlegroups.com
tags on plays should be applied to all tasks in the play, but the play
itself should not be skipped.


--
Brian Coca
Reply all
Reply to author
Forward
0 new messages