tenks/ansible/node_networking.yml
Mark Goddard 6e2bb04fae Add playbook tags
Allows for easily running specific playbooks.

Change-Id: Ia859238042eb286b61758acd8f99361c10dc0a05
2019-03-27 16:43:13 +00:00

33 lines
996 B
YAML

---
- hosts: localhost
tags:
- node-networking
tasks:
- name: Load state from file
include_vars:
file: "{{ state_file_path }}"
name: tenks_state
- hosts: hypervisors
tags:
- node-networking
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: "{{ physnet.1 | bridge_name }}"
veth_pair_ovs_link_name: "{{ physnet.0 | ovs_link_name(physnet.1) }}"
veth_pair_source_link_name: "{{ physnet.0 | source_link_name(physnet.1) }}"
veth_pair_state: "{{ physnet.0.get('state', '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') }}
loop_control:
loop_var: physnet