Return of issue #13602: ansible runs setup for all plays when run with -t

33 views
Skip to first unread message

Hagai Kariti

unread,
Aug 30, 2016, 5:06:14 AM8/30/16
to Ansible Project
Hi
It seems that https://github.com/ansible/ansible/issues/13602 is back in Ansible 2.1.1 and devel. Running ansible-playbook with -t will collect facts even if no task/role in the play is selected. This also happens with smart gathering, if the fact cache is expired. Example:

test.yml:
---
- name: No tagged task here
  hosts: localhost
  tasks:
    - debug: msg="I won't run"

- name: Tagged task here
  hosts: localhost
  tasks:
    - debug: msg="tagged task"
      tags: runme

And this is the output after clearing the fact cache:

$ ansible-playbook test.yml -t runme
 [WARNING]: Host file not found: /etc/ansible/hosts

 [WARNING]: provided hosts list is empty, only localhost is available


PLAY [No tagged task here] *****************************************************

TASK [setup] *******************************************************************
ok: [localhost]

PLAY [Tagged task here] ********************************************************

TASK [debug] *******************************************************************
ok: [localhost] => {
    "msg": "tagged task"
}

The setup task is run on the untagged play, like reported in #13602


Aditya Menon

unread,
Sep 14, 2016, 1:52:26 PM9/14/16
to Ansible Project
Hi, 
  I believe there is a regression here in ansible 2.1.1.0. I'll be reinstalling 1.9 again. Please let me know if there is a workaround or a fix for this planned as I want to use the new features of the latest ansible.
  
Thanks
Aditya Menon
Reply all
Reply to author
Forward
0 new messages