https://github.com/ansible/ansible-docker-base
(Disclaimer: wrote Ansible)
https://github.com/ansible/ansible-docker-base
(Disclaimer: wrote Ansible)
As a longtime Ansible user who's just starting out dockerizing our apps, I find that there's significant refactoring needed when trying to reuse existing playbooks & roles to provision Docker containers.
In the current model we have a single playbook driven by an EC2 dynamic inventory, and each server definition under "roles/" (with some reuse between them, obviously). All in single repo.
With Docker it seems like this layout needs to be turned completely on its head, because a Dockerfile (unlike an Ansible playbook) can only define a single container type, and to make things even harder there can only be one per directory (something similar to "make -f" would have been useful)
So, the logical directory layout in this situation is probably one directory + Dockerfile per container, with a corresponding Ansible playbook + role in each. That's awful for code reuse and quite a bit of refactoring though.
Has anyone managed to do it more elegantly ?
I also attempted to try Ansible for deploying containers and had issues with both of these bugs:
https://github.com/ansible/ansible-modules-core/issues/27 https://github.com/ansible/ansible-modules-core/issues/188
Do people actually use Ansible to control Docker in practice? It would be great to have something that was a step up from building random Python scripts from scratch :)
(Disclaimer: I'm not very good at Ansible.)
curl https://raw.githubusercontent.com/ianmiell/shutit/master/library/osquery/dockerfile/Dockerfile | docker build --no-cache -This meant a) I could reuse existing scripts to provision normal server b) docker could be used to test the ansible scripts were actually capturing everything required.
The cache point was a bit of a pain though, I confess.
https://github.com/ianmiell/shutit/blob/master/library/ansib...