On Tuesday, February 13, 2018 at 4:02:57 PM UTC-5, Jason Gilfoil wrote:
>
>
> We're migrating from a single load balancer pair for all systems 
> (dev/test/qa/prod) to separate pairs for dev/test and qa/prod. As a result, 
> my previous task to pull nodes from the pool on the load balancer will no 
> longer suffice without some conditional logic. I have a partial solution, 
> but it two issues. 
>
> 1st Issue
> In the following code i'm attempting to make it so that if the server is 
> in the test inventory group, it uses the dev-test f5 pair and if it's not, 
> use the qa-prod f5 pair. The first issue is that it loops over all 
> combinations so the task would essentially execute twice for each f5 
> target. 
>
> https://pastebin.com/ZxkPqvPF
>
> 2nd Issue
> The second problem is that i need to expand the conditional to allow 
> multiple statements. 
>
> I need to find a way to expand this line:
>       msg: "{{ (inventory_hostname in groups['test']) | 
> ternary(hostvars[item[0]].ansible_host,hostvars[item[1]].ansible_host) }}"
> into
>       msg: "{{ (inventory_hostname in groups['test'] OR inventory_hostname 
> in groups['dev']) | 
> ternary(hostvars[item[0]].ansible_host,hostvars[item[1]].ansible_host) }}"
>

 I'm not entirely sure of your constraints, but it seems like you would 
want something more 
like https://gist.github.com/flowerysong/ae18f75d2103b41198149380e8d6fb1c 
rather than a nested loop.

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/de494e3c-e47c-4ea9-ab1a-1586eefda4a8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to