# tagged tasks and gather\_facts not friends

**URL:** <https://forum.ansible.com/t/tagged-tasks-and-gather-facts-not-friends/12233>\
**Category:** Ansible Project\
**Created:** [January 22, 2013, 4:37pm UTC](https://forum.ansible.com/t/tagged-tasks-and-gather-facts-not-friends/12233 "2013-01-22T16:37:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oren\_Shomron](https://avatars.discourse-cdn.com/v4/letter/o/df705f/32.png) [@Oren\_Shomron](https://forum.ansible.com/u/Oren_Shomron)\
**Post date:** [January 22, 2013, 4:37pm UTC](https://forum.ansible.com/t/tagged-tasks-and-gather-facts-not-friends/12233/1 "2013-01-22T16:37:51Z")

</div>

Hi everyone,

It seems that if you run tagged tasks which depend on facts from gather\_facts, if the entire play is not tagged as well, fact collection is skipped and your variables will be unavailable.

For example:

…

- name: Install packages  
hosts: webservers  
user: root  
gather\_facts: True

tasks:

- name: echo database host

tags: cfg  
command: echo Database is ${hostvars.${groups.databases[0]}.ansible\_default\_ipv4.address}

…

Run once with -t cfg and once without.

- Oren
