How can I get the internal IP of a Docker container using Ansible? I tried by using hostvars
but it gives me a default value:
{% for host in groups['replicationserversdsds'] %}
rs.add("{{ hostvars[host]['ansible_eth0']['ipv4']['address'] }}:{{ mongod_port }}")
{% endfor %}
I have Ansible installed on my Mac and create 2 Docker containers to deploy a Mongo replica. So I need to get the internal IP of both containers to add secondary to primary set. Both are running on a Docker Machine host (same IP, 192.168.99.100). But I always get a default IP (172.1.0.3).