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