Awesome!  Thank you.

On Sunday, July 13, 2014 12:37:48 PM UTC-6, Michael DeHaan wrote:
>
> This is the same "add_host" stuff that you would use as documented in the 
> EC2 guide, more or less.
>
>
>
>
> On Sat, Jul 12, 2014 at 3:52 PM, Brian Grossman <[email protected] 
> <javascript:>> wrote:
>
>> Say I've created a docker host with the docker_image and docker modules.
>>
>> In the same playbook where I apply the role that creates the host, I'd 
>> like to apply a role to the newly created host.
>>
>> The problem I'm running into is ansible's inventory doesn't know about 
>> the newly created host.  How can ansible know about the new host?  A 
>> dynamic inventory script that queries docker to return the hosts and IPs 
>> doesn't do it because of the caching ansible does.  Using that dynamic 
>> inventory script I have to call ansible on that playbook twice to get the 
>> desired result.
>>
>> Anybody got any ideas or different approaches?
>>
>>
>> Here's a playbook to illustrate:
>>
>> - hosts: localhost
>>   sudo: True
>>   roles:
>>     - { role: phusion-baseimage-ubuntu-14.04-docker, new_hostname: limbo }
>>
>> - hosts: limbo
>>   roles:
>>     - limbo-packages
>>
>>
>> And here's the role main task:
>>
>> - name: check or build container for {{ new_hostname }}
>>   docker_image: >
>>     path="docker-files/{{ new_hostname }}"
>>     name="xxx/limbo"
>>     state=present
>>
>> - name: bring up container for {{ new_hostname }}
>>   docker: >
>>     dns=8.8.8.8
>>     hostname={{ new_hostname }}
>>     image=xxx/limbo
>>     state=present
>>     name="{{ new_hostname }}"
>>     expose=22
>>     ports="127.0.0.1:5022:22"
>>
>>
>>  -- 
>> 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] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/ca329c67-2a0b-446f-bc62-60d377a20b68%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/ca329c67-2a0b-446f-bc62-60d377a20b68%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/43209c39-a2b7-4854-b6aa-1041d83f8681%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to