I wrote the Docker dynamic inventory script. It returns containers by host -- all you have to do is declare each Docker URL. I think that does what you're looking for.
https://github.com/ansible/ansible/blob/devel/plugins/inventory/docker.py On Mon, Jun 16, 2014 at 3:10 PM, Laurent PETIT <[email protected]> wrote: > > > Le lundi 16 juin 2014, Paul Durivage <[email protected]> a écrit : > > IMHO, the most exciting system out there for running Docker applications >> is CoreOS, a Linux distribution that is essentially just Linux + systemd + >> Docker + fleetd + etcd. There guys really have something interesting >> going. I have every intention of writing some modules that incorporate >> etcd (a replicated key/value store meant for service discovery) and fleetd >> (a modern cluster manager that seems to do a lot right). >> >> Deis also shows a lot of promise. >> >> The Docker module's fine for deploying containers an arbitrary number of >> Docker hosts. Sounds like you're looking for something PaaS-like if you're >> not pleased with today's Docker support. >> > > I cannot say I'm not pleased yet, in fact I hope I will ! :-) > > The docker module is host-centric. I'd like to try an approach where I use > it in a more instance-centric way, since all my instances are made > available via a sub domain. > > Only thing I don't know yet is if I can know from the gathered facts > which instance is currently running on which host, and from this knowledge, > for each declared instance in turn, whether I have to do a remove before > doing an update/install. > > >> >> >> On Mon, Jun 16, 2014 at 12:44 AM, Laurent PETIT <[email protected]> >> wrote: >> >>> >>> >>> Le lundi 16 juin 2014, Michael DeHaan <[email protected]> a écrit : >>> >>> It's fine to use Ansible to build docker images, but I'm not sure it's a >>> good placement engine for deciding where containers run. >>> >>> >>> Then what is the ansible-docker module good for? >>> >>> >>> Ideally you should some set of software that is trying to be a "cloud" >>> manager for Docker. >>> >>> From what I've heard, maybe this is Flynn or Shipyard -- I don't know - >>> I haven't tried them. >>> >>> >>> Interesting, I'll look at them more closely. >>> >>> >>> >>> Specifying it in Ansible just seems really rough, keeping manual lists >>> of what is running where that you have to start and/or remove. >>> >>> >>> It's moving the data of the containers around which also may be >>> challenging, indeed. >>> >>> >>> >>> Anyway, somewhat off topic for this list. >>> >>> I'm waiting for their tech to evolve myself, then it will fit in closer >>> to the other cloud models, feeling more like other hypervisors. >>> >>> >>> >>> >>> >>> >>> >>> >>> On Sun, Jun 15, 2014 at 5:07 PM, Laurent PETIT <[email protected]> >>> wrote: >>> >>> Hello, >>> >>> I'm trying to figure out how to best stay declarative while being able >>> to have my system properly reconfigure itself in the following situation: >>> >>> - I have a bunch of docker hosts >>> - I have a bunch of docker containers. Each docker container hosts a >>> service for a customer and is reachable from a specific subdomain of my >>> company. >>> - I have a frontal nginx container doing virtual hosting to redirect >>> traffic for a specific container to its current host+port. >>> >>> So I have docker-hosts, and containers virtual hosts. >>> >>> I'd like to write the configuration so that I have entries for the >>> virtual hosts, with a parameter specifying on which docker host they must >>> be set. >>> >>> Now, if I move a docker container from docker host A to docker host B in >>> the configuration, when I run the playbook I must ensure that the following >>> is done: >>> >>> - if the docker container is currently running on host B (in the example >>> it is running on host A), then stop the container on host A >>> (to keep things simple, currently the containers data are in a centrally >>> accessible place - from docker hosts - but I must ensure only one container >>> at a time accesses the data - thus killing from A before starting from B). >>> - start the container from B >>> ( - Reconfigure nginx and restart if necessary -> not a problem atm) >>> >>> Do you have advices on how best to do this? >>> >>> My current idea involves: >>> - creating entries in the inventory for each docker container virtualhost >>> - for each virtualhost, finding through docker hosts facts analysis >>> where it is running (if at all), and then removing it if running in another >>> host than what the config currently states >>> >>> Does that make sense? Will it be easy to do? (still newbie here, so >>> maybe not having the right grasp of what's easy or not with ansible) >>> >>> Thanks in advance, >>> >>> -- >>> Laurent >>> >>> -- >>> 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/abe41851-bcad-4dea-8211-1f9e40e9304d%40googlegroups.com?utm_medium=email&utm_source=footer> >>> >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/ansible-project/CAKVVxfq6R9mrTg-iOTj%2BbUS1mKKtA8TNpuBh7OT0h%3DMq0ys_sw%40mail.gmail.com >>> <https://groups.google.com/d/msgid/ansible-project/CAKVVxfq6R9mrTg-iOTj%2BbUS1mKKtA8TNpuBh7OT0h%3DMq0ys_sw%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- >> 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/CAK6JQEHZ-Qs7PjzgJozoo-cxMPYGBFgm6R7XuYXmxjkWbPOeJw%40mail.gmail.com >> <https://groups.google.com/d/msgid/ansible-project/CAK6JQEHZ-Qs7PjzgJozoo-cxMPYGBFgm6R7XuYXmxjkWbPOeJw%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > -- > 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/CAKVVxfp8N0eOLBqd8QRJh1Mv7VZSDiPSpOyYajWMSTR5ONR%3D_Q%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-project/CAKVVxfp8N0eOLBqd8QRJh1Mv7VZSDiPSpOyYajWMSTR5ONR%3D_Q%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- 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/CAK6JQEE%3DWm7wBaJMvFMMmsaua9L6-Xv_j_2cXKS3VELFtvHrHQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
