Ansible in Docker container refuses to communicate with other Docker container

Published

I am currently facing a problem where my ping module I defined in my playbook.yml file refuses to connect to a different docker container. The Ansible environment is setup in a Docker container as well. The Docker service I am trying to do a ping to is called "postgres_container". The weird thing is, if I do a ping from within the ansible container with the command "ping postgres_container" it succesfully connects and stays connected. However, If I try to run the command from within my playbook.yml file, it fails.

my hosts file:

[database]
postgres_container

my playbook.yml file:

---
- hosts: database
  tasks:
    - name: test connection
  ping:

Any help would be appreciated!

Source: Docker Questions

Published
Categorised as ansible, devops, docker Tagged , ,

Answers

Leave a Reply

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq