Yeah with_together would work in your scenario. Strangely I was looking to do something similar but the very helpful F5 team provided me with this, so I thought I'd share it.
I was trying to find a way to switch the pool members between 2 sets of servers. One difference here is we're associating the port with the pool member, rather than the pool in your case. vars: f5_pools: middleware: red: - host: 192.168.27.1 port: 80 green: - host: 192.168.27.2 port: 80 webfront: red: - host: 192.168.27.1 port: 80 - host: 192.168.27.2 port: 80 green: - host: 192.168.28.1 port: 80 - host: 192.168.28.2 port: 80 tasks: - name: RED bigip_pool_member: pool: "{{ item }}" aggregate: "{{ f5_pools[item].red }}" replace_all_with: yes provider: "{{ provider }}" delegate_to: localhost loop: "{{ f5_pools.keys() }}" tags: red - name: GREEN bigip_pool_member: pool: "{{ item }}" aggregate: "{{ f5_pools[item].green }}" replace_all_with: yes provider: "{{ provider }}" delegate_to: localhost loop: "{{ f5_pools.keys() }}" tags : green On Wednesday, June 5, 2019 at 8:19:32 AM UTC+1, Kai Stian Olstad wrote: > > On 05.06.2019 08:29, eric sandgren wrote: > > First I'm a sysadmin not a developer I often use ansible to set up > > things > > in f5 -ltm i often need to add several hosts to a number of pools. The > > loadbalancing setup in f5 products in a glance consist of av VIP > > (virtual > > server) that is linked to a Pool containing one or more physical > > servers. > > I get stuck in how to set up the loop, i define this first > > var_node: > > - { host: 1.2.3.4, name: server1.com } > > - { host: 1.2.3.5, name: server2.com } > > var_pool: > > - { pool: pool1, port: 80 } > > - { pool: pool2, port: 8080 } > > - { pool: pool3, port: 443 } > > > > The module ii'm trying to use > > > > - name: add nodes to pools > > bigip_pool_members: > > provider: "{{ provider }}" > > partition: "{{ partition }}" > > pool:{{ item.pool }} "here I want to loop var_pool > > name: "{{ item.name }} "here I want to loop var_node" > > port: "{{ item.port}} "and again ....var_pool" > > loop: ????? > > > > I realize I'm probably on a dead end thinking this way any good input > > from > > a developer-mind would be extremely appreciated > > You are looking for with_together > > https://docs.ansible.com/ansible/2.4/playbooks_loops.html#looping-over-parallel-sets-of-data > > > > -- > Kai Stian Olstad > -- 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/29b82280-2e33-42f1-abb5-1988fb86db03%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.