- name: Create mongo config server
become: true
docker_container:
name: mongoconfig
image: mongo
command: mongod --configsvr --replSet cfgrs --dbpath /data/configdb
state: started
restart_policy: unless-stopped
etc_hosts: docker_hosts
# etc_hosts: >
# {
# "vegeta": "192.168.77.6",
# "piccolo" : "192.168.77.7",
# "gohan" : "192.168.77.5"
# }
volumes:
- mongo_config: /data/configdb
ports:
- "27019:27019"
When I print docker_hosts, it looks like this:
TASK [Display docker_hosts] ****************************************************
ok: [gohan] => {
"docker_hosts": {
"gohan": "192.168.77.5",
"piccolo": "192.168.77.7",
"vegeta": "192.168.77.6"
}
}