99eaf48098
Instead of overwriting the physnet mappings specified in the Tenks configuration, create a separate dict that maps physnet names to their indices. Like physnet_mappings, this will be present for each hypervisor.
26 lines
882 B
YAML
26 lines
882 B
YAML
- hosts: localhost
|
|
tasks:
|
|
- name: Load state from file
|
|
include_vars:
|
|
file: "{{ state_file_path }}"
|
|
name: tenks_state
|
|
|
|
- hosts: hypervisors
|
|
vars:
|
|
nodes: >-
|
|
{{ hostvars.localhost.tenks_state[inventory_hostname].nodes
|
|
| default([]) }}
|
|
tasks:
|
|
- name: Configure veth pairs for each node
|
|
include_role:
|
|
name: veth-pair
|
|
vars:
|
|
veth_pair_ovs_bridge: "{{ item.1 | bridge_name }}"
|
|
veth_pair_ovs_link_name: "{{ item.0 | ovs_link_name(item.1) }}"
|
|
veth_pair_source_link_name: "{{ item.0 | source_link_name(item.1) }}"
|
|
veth_pair_state: "{{ 'absent' if cmd == 'teardown' else 'present' }}"
|
|
# Loop over each physical network for each node allocated to this host.
|
|
# Allocations are stored in localhost's vars.
|
|
loop: >-
|
|
{{ nodes | subelements('physical_networks') }}
|