many ways to do this, I would just use a configuration template:
# in slow pool part of config
{% for host in fullpool %}
{% if loop.index % 5 == 4 %}
{{host}}
{% endif%}
{% endfor %}
# in normal pool part of config
{% for host in fullpool %}
{% if loop.index % 5 != 4 %}
{{host}}
{% endif%}
{% endfor %}
On Fri, Jun 19, 2015 at 12:18 PM, Nicolas G <[email protected]> wrote:
> Hi,
>
> I'm trying to migrate from Chef a recipe for HAProxy.
>
> In the bellow config one of the pool groups are considered to be coming from
> slow server connections and we isolate them to use certain number of web
> servers and not all of them as when you have lot's of requests with
> relatively higher timeouts it could cause other servers with normal latency
> to starve.
>
> In order to accomplish this in Chef we assign 1 of every 5 servers to the
> slow_pool_members and every 4 server to the normal_pool_members :
>
> slow_pool_members = []
> normal_pool_members = []
>
>
> pool_members.each_with_index do |member, i|
> if i % 5 == 4
> slow_pool_members << member
> else
> normal_pool_members << member
> end
> end
>
>
>
> The above in Chef is Ruby code, can someone help me how can I do something
> similar in Ansible ?
>
> Regards,
> N.
>
> --
> 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/31ad5a40-2da3-4804-911a-b3c17cc0e493%40googlegroups.com.
> 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/CAJ5XC8n%2Bm8G0NmKentwWWCq-EQypc4RUUmAnQFPZqB2swQGgkg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.