Hello guys, I am using Ansible + Vagrant and having problem to run Django 
migrations inside a container that's running my django app.

Basically I have a postgres container and a django container

If I vagrant ssh and then run 

sudo docker exec -ti django /bin/sh -c 'cd mumopus;python manage.py migrate'

Everything is good and life is beautiful

However if I try to run as an ansible task having

- name: Run migrate on Django.
  become: yes
  command: docker exec -ti django /bin/sh -c 'cd mumopus;python manage.py 
migrate'

I get

"django.db.utils.OperationalError: could not connect to server: Connection 
refused", "\tIs the server running on host \"172.17.0.2\" and accepting", 
"\tTCP/IP connections on port 5432?"]

I've run docker ps just prior to that task and all the containers are there 
and running, I've also tried to use ansible shell instead of command but no 
joy. I've made a thread in reddit with the codes, if anyone can help I 
would be very thankful

https://www.reddit.com/r/ansible/comments/44ao3t/ansible_command_module_in_playbook_in_role_not/

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1cac337e-7560-4001-852f-71c05a8cebbb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to