note: since we limit appservers only then Ansible have no idea to get facts from other servers ( dbserver, memcache) in this case.
I have to do cheat like this
ansible-playbook site.yml --limit=dbservers, appservers --tags=sb_tomcat ( add dbservers to gather facts)
but it’s not enough, I have to add a fake task like this for dbservers with tag sb_tomcat
name: Dont fool me
command: echo “can you hear me”
tags:
sb_tomcat
Doing this to tell Ansible to gather dbserver facts and
{% for host in groups[‘dbservers’] %}
{{ hostvars[host][‘ansible_eth1’][‘ipv4’][‘address’] }}
{% endfor %}
works.
Questions:
In real case, we really need a specfic tag. Do we have another way to gather fact explitcitly without modifying --limit or add fake tasks?