Sorry, noticed a typo in my original post

In the final solution the *j*son for the items will probably be passed as 
an array parameter to the role.

On Saturday, November 21, 2015 at 3:51:55 AM UTC+8, [email protected] 
wrote:
>
> Hi all,
>
> I'm fairly new to Ansible and have an issue I haven't been able to answer. 
> I might be attacking it the wrong way, so I'd appreciate any pointers.
>
>
> I have a number of docker images that need to be started, but I need to 
> make sure the web server inside those docker containers is running before I 
> go on to the next container.
>
> The following is what I'm trying to achieve inside my role
>
> ---
>
> - name: Start and wait for containers
>   docker: name=mydata  image={{ item.name }} state=present ports={{ 
> item.ports }}
>   wait_for: port={{ item.wait_for_port }}
>   with_items:
>     - { name: "service1", ports: "8080:8080", wait_for_port: 8080 }
>     - { name: "service2", ports: "8081:8080", wait_for_port: 8081 }
>     - { name: "service3", ports: "8082:8080", wait_for_port: 8082 }
>
>
>
> It seems I can't have 2 actions in the same task.
>
> In the final solution the son for the items will probably be passed as an 
> array parameter to the role.
>
> What I need is for the each docker container to start and I then need to 
> wait for the port to become available before moving on to the next
>
> If I split this up into 2 tasks then all the containers will be started 
> without the internal services necessarily becoming available.
>
> ---
>
> - name: Start and wait for containers
>   docker: name=mydata  image={{ item.name }} state=present ports={{ 
> item.ports }}
>   with_items:
>     - { name: "service1", ports: "8080:8080" }
>     - { name: "service2", ports: "8081:8080" }
>     - { name: "service3", ports: "8082:8080" }
>
> - name: Wait for ready state
>   wait_for: port
>   with_items:
>     - 8080
>     - 8081
>     - 8082
>
>
> Any suggestions are appreciated.
>
> Thanks
>

-- 
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/1a326968-5c00-407c-a570-fa7b1194a49f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to