Right, I'm saying this isn't sustainable or a good approach for most infrastructures - and while it may be fine for you I want to avoid steering people down that path as it has all the perils of "manual cloud" circa 2005-ish.
As I was discussing with Paul Durivage yesterday, fleetd in CoreOS actually does provide this functionality too -- I was thinking more WRT the CoreOS base image solving a different problem. So having a module that allows Ansible to tell CoreOS "I want X instances of this image" would be pretty neat to see. Submissions welcome! On Tue, Jun 17, 2014 at 3:48 PM, Laurent PETIT <[email protected]> wrote: > If by "placement engine" you mean something sophisticated with logic for > determining where containers should be deployed - or deployed -, then yeah, > I totally get that. > > My needs for the coming year are more simple : I will keep on a file a > list of hosts, and a list of containers per host. I'll keep this in my VCS, > next to my CM tool. Several times a week, I will declare a new container > here, kill a container there. > > As I understand Ansible, what I've described above should be easily > handled via a host per docker host in the inventory file, and a list of var > container properties per host, and the existing docker module. > > Remains one operation I'll do from time to time : move a container from a > host to another host, e.g. when I add a new docker host, I'll remove some > containers from the existing ones, and put them on the new one. > > This is where I was thinking of doing the following : > > - a first play which would, per docker host, get the list of active > containers (identified by name), compare this list with the declared > containers for the host : all active containers that aren't in the declared > list are removed. > > - a second play (should only execute after the first play has processed > all docker hosts, so that it is guaranteed that everything that has to be > removed has been removed, on all hosts before activating containers on > their - possibly new - location) that will update/add hosts from the > declared list. > > > > > > > 2014-06-17 21:04 GMT+02:00 Michael DeHaan <[email protected]>: > >> yeah once they are deployed it's easier, the main thing is Ansible is not >> a placement engine (or someone might call this a "scheduler") >> >> CoreOS is a different animal for a different purpose. >> >> >> >> >> On Mon, Jun 16, 2014 at 9:45 PM, Paul Durivage <[email protected]> >> wrote: >> >>> 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 >>> <https://groups.google.com/d/msgid/ansible-project/CAK6JQEE%3DWm7wBaJMvFMMmsaua9L6-Xv_j_2cXKS3VELFtvHrHQ%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/CA%2BnsWgzhiMp6t3O4qDY4PzCFPYUdYyN-NTzFyQircPq_TvHbbg%40mail.gmail.com >> <https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgzhiMp6t3O4qDY4PzCFPYUdYyN-NTzFyQircPq_TvHbbg%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/CAKVVxfpL2J3Pfx4N%2BF2EvJkGdpfrX4KHW55Jorqo%2BQ%3DC2vwd%2BQ%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-project/CAKVVxfpL2J3Pfx4N%2BF2EvJkGdpfrX4KHW55Jorqo%2BQ%3DC2vwd%2BQ%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/CA%2BnsWgxe53fkTFn-43ovc5JANe_sKATDuMaYVPuhBWO2gviBJw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
