(To be clear, I'm not sure why you'd want more than one identical container per host anyway)
On Thu, May 1, 2014 at 5:22 PM, Michael DeHaan <[email protected]> wrote: > " The issue with this is that inventory is per host, correct?" > > Not to be pedantic, but Inventory is one thing that contains many hosts. > > "Where then would it make sense to specify the count of containers per > type?" > > How about a role that deploys the container, and you specify it as a > parameter to the role how many you want of each image? > > > > > > > > > On Thu, May 1, 2014 at 12:25 PM, Patrick Galbraith <[email protected]> wrote: > >> Hi all! >> >> I have a fairly simple (at least it seems that way!) question about how >> to arrange variables -- or even roles for that matter-- for a runbook that >> I've written for my presentation at AnsibleFest on the Docker module. >> >> the issue is this: I use the docker module for launching a specific >> number docker containers and have specific images for each type of >> container, those types being broken into roles. The types are simply web >> (apache), db (percona xtradb cluster), and haproxy. There is not much in >> the way for this talk to try to configure the launched containers as it's >> more about the ability to launch the containers. >> >> Now, currently, I have within each of the roles of course a vars/main.yml >> file with a variable I was going to use "containers_count". There is a task >> in roles/common/tasks/main.yml that simply launches containers >> >> - name: docker image control >> docker: image="{{repository_name}}/{{ image }}" name="{{ type }}_{{ >> item }}" state={{ docker_state }} >> with_sequence: count={{ containers_count }} >> >> The top level playbook simply does this: >> >> - hosts: docker >> roles: >> - common >> - web >> >> - hosts: docker >> roles: >> - common >> - db >> >> - hosts: docker >> roles: >> - common >> - haproxy >> >> This results in the above task being called for each "type" and each role >> has its own "container_count" from the role's vars. >> >> It was pointed out to me that roles need to be more of a plugin ability >> and specific things like a count of containers being more site-specific, >> perhaps using inventory. The issue with this is that inventory is per host, >> correct? So, in my testing, the only host is localhost, where I'm running >> docker. For my presentation, hosts will be a certain number and on each a >> certain number of containers running. >> >> Where then would it make sense to specify the count of containers per >> type? Say for instance, I want 9 cluster node containers, 3 haproxy >> containers and 10 web containers-- what would be a portable and flexible >> way to do this? What is best practices in this case? >> >> Thank you! >> >> PS: my respository is >> https://github.com/CaptTofu/ansible-docker-presentation for more context. >> >> -- >> 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/207286e3-72df-48b3-9356-ae9a22b90ad2%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/207286e3-72df-48b3-9356-ae9a22b90ad2%40googlegroups.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%2BnsWgycf%3D%2BHSa-XkUP%2BqqQNu%3DOeyzWzPQdZnJqPGkKeKpwLxA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
