The following works, however it is looping through the whole routine for each 
and every VLAN which is a bit sad when the routine itself supports multiple 
additions in one go, I just can't see how to automatically populate the yml 
list under the "networks:" parameter.

    - name: Add Networks to Hosts
      ovirt_host_network:
        auth:        "{{ ovirt_auth }}"
        state:       present
        name:        "{{ item[0] }}"
        interface:   "bond0"
        networks:
          - name:    "{{ item[1] }}"
        wait:        true
      with_nested:
        - "{{ groups['kvm'] }}"
        - "{{ groups['net'] }}"

Cheers
Angus


________________________________
From: Angus Clarke <an...@charworth.com>
Sent: 14 February 2021 18:07
To: users@ovirt.org <users@ovirt.org>
Subject: ovirt_host_network -> networks: pass list

Hello

I can see some examples of what I am trying to understand, but I'm still not 
quite clear, perhaps someone can help?

I am trying to lookup a list of network names to pass to the 
ovirt_host_network, networks parameter.

I have the networks in my hosts file like:

# Logical networks
net:
  hosts:
    v1234-test-vlan:
      net_vlan:      1234
      net_vms:    true

    v1235-another-test-vlan:
      net_vlan:      1235
      net_vms:    true

And now I would like to loop through those entries to pass as a list to the 
"networks:" parameter of overt_host_networks. Manually it looks like this:

      ovirt_host_network:
        auth:        "{{ ovirt_auth }}"
        state:       present
        name:        "{{ item }}"
        interface:   "bond0"
        networks:
          - name: v1234-test-vlan
          - name: v1235-another-test-vlan
        wait:        true
      loop:          "{{ groups['kvm'] }}"


Thanks for any help!
Angus
_______________________________________________
Users mailing list -- users@ovirt.org
To unsubscribe send an email to users-le...@ovirt.org
Privacy Statement: https://www.ovirt.org/privacy-policy.html
oVirt Code of Conduct: 
https://www.ovirt.org/community/about/community-guidelines/
List Archives: 
https://lists.ovirt.org/archives/list/users@ovirt.org/message/G2NJDMI6XIJJL7UVSJCTS66BNS4YW7DN/

Reply via email to