you could use the loop.index and compare against
group['app_servers']|length to break the loop at the serial point.


On Sunday, June 21, 2015, Ivan Dimitrov <[email protected]> wrote:

> Hello Group,
>
> I'm looking for a way to access facts for my hostnames through the
> hostvars and groups methods. This all works well, but I'm stuck when I try
> to limit the batch size with the "serial" directive.
>
> For example: I have 10 web servers that I want to do rolling update using
> the "serial: 50%".
>
> {% for host in groups['app_servers'] %}
>    {{ hostvars[host]['ansible_eth0']['ipv4']['address'] }}
> {% endfor %}
>
>
> Using the above example will give me all hosts in the group "app_servers"
> and there is no way to get only 50% of the hosts.
>
> Is there a way to get facts information for "all hosts in the scope" and
> "all hosts outside of scope"?
>
> --
> 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:_e(%7B%7D,'cvml','ansible-project%[email protected]');>
> .
> To post to this group, send email to [email protected]
> <javascript:_e(%7B%7D,'cvml','[email protected]');>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/a34343e2-3266-49bb-a483-e894350d25fe%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/a34343e2-3266-49bb-a483-e894350d25fe%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Brian Coca

-- 
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/CAJ5XC8n736zuRnrW6r6xQXBogC-9yPhU5FCJ7i_GmSdFzQmc6w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to