Hi all,

I have a playbook for provisioning some vagrant machines, written following 
the roles approach as described the "Best Practices" in the website 
documenation. The first the role goes and installs docker in all VMs, as 
part of that it adds the user vagrant to the "docker" group, so it can have 
access to the /var/run/docker.sock file, which is required to run command 
docker. After that is finished, another specific role specific, try to 
build the appropriate docker images for each machine, based on a pushed 
Dockerfile.

The problem is that, even though the user is properly added to the "docker" 
group, when the play tries to build the docker image I get an error that 
you can only get if you don't have the right access to /var/run/docker.sock.

If I rerun the provisioning "vagrant provision", it works fine. If I login 
by hand and run the command, it also works well.

I suspect that the problem is that Ansible is reusing the original 
connection, when it installed docker and added the user to the "docker" as 
part of the tasks of the previous role. If this is the case, the change of 
adding the user to the "docker" group would not be effective yet. By 
putting -vvvv I can see ControlPersist=60s. Is there any way to get around 
this issue?

I know I could tweak ControlPersist but this is a naughty hack. Hopefully 
there is a better solution.

Please, bear with me as I'm new to Ansible. Any ideas are appreciated.

Kind regards,
Juan

-- 
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/01713f26-e1cd-4b27-8134-fd4d89e9bb48%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to