Formatting fixes
Fix multi-line string variables. Also use subelements filter with loop.
This commit is contained in:
parent
7e35255f11
commit
56fb19d4c1
@ -14,13 +14,16 @@
|
|||||||
|
|
||||||
- hosts: hypervisors
|
- hosts: hypervisors
|
||||||
tasks:
|
tasks:
|
||||||
- include_tasks: vm_networking.yml
|
- include_tasks: vm_physical_network.yml
|
||||||
vars:
|
vars:
|
||||||
vm: "{{ item }}"
|
vm_name: "{{ item.0.name }}"
|
||||||
|
physnet: "{{ item.1 }}"
|
||||||
|
# Loop over each physical network for each VM allocated to this host.
|
||||||
# Allocations are stored in the controller node's vars.
|
# Allocations are stored in the controller node's vars.
|
||||||
loop: >
|
loop: >-
|
||||||
{{ hostvars[groups.controllers.0].allocations.result[
|
{{ hostvars[groups.controllers.0].allocations.result[
|
||||||
inventory_hostname] | default([]) }}
|
inventory_hostname] | default([])
|
||||||
|
| subelements('physical_networks') }}
|
||||||
|
|
||||||
- hosts: libvirt
|
- hosts: libvirt
|
||||||
tasks:
|
tasks:
|
||||||
@ -37,9 +40,9 @@
|
|||||||
group: "{{ libvirt_pool_group }}"
|
group: "{{ libvirt_pool_group }}"
|
||||||
libvirt_host_require_vt: "{{ libvirt_require_vt }}"
|
libvirt_host_require_vt: "{{ libvirt_require_vt }}"
|
||||||
|
|
||||||
- include_tasks: create_libvirt_vms.yml
|
- include_tasks: libvirt_create_vms.yml
|
||||||
vars:
|
vars:
|
||||||
# Allocations are stored in the controller node's vars.
|
# Allocations are stored in the controller node's vars.
|
||||||
vms: >
|
vms: >-
|
||||||
{{ hostvars[groups.controllers.0].allocations.result[
|
{{ hostvars[groups.controllers.0].allocations.result[
|
||||||
inventory_hostname] | default([]) }}
|
inventory_hostname] | default([]) }}
|
||||||
|
@ -47,10 +47,10 @@
|
|||||||
name: veth-pair
|
name: veth-pair
|
||||||
vars:
|
vars:
|
||||||
veth_pair_ovs_bridge: "{{ tenks_bridge }}"
|
veth_pair_ovs_bridge: "{{ tenks_bridge }}"
|
||||||
veth_pair_ovs_link_name: >
|
veth_pair_ovs_link_name: >-
|
||||||
{{ veth_prefix + tenks_bridge + veth_bridge_ovs_suffix }}
|
{{ veth_prefix + tenks_bridge + veth_bridge_ovs_suffix }}
|
||||||
veth_pair_source_bridge: "{{ source_interface }}"
|
veth_pair_source_bridge: "{{ source_interface }}"
|
||||||
veth_pair_source_link_name: >
|
veth_pair_source_link_name: >-
|
||||||
{{ veth_prefix + tenks_bridge + veth_bridge_source_suffix }}
|
{{ veth_prefix + tenks_bridge + veth_bridge_source_suffix }}
|
||||||
plug_into_source: true
|
plug_into_source: true
|
||||||
|
|
||||||
@ -63,7 +63,7 @@
|
|||||||
port: "{{ veth_prefix + tenks_bridge + veth_bridge_ovs_suffix }}"
|
port: "{{ veth_prefix + tenks_bridge + veth_bridge_ovs_suffix }}"
|
||||||
# Despite the module documentation, `set` will happily take multiple
|
# Despite the module documentation, `set` will happily take multiple
|
||||||
# properties.
|
# properties.
|
||||||
set: >
|
set: >-
|
||||||
Interface {{ veth_prefix + tenks_bridge + veth_bridge_ovs_suffix }}
|
Interface {{ veth_prefix + tenks_bridge + veth_bridge_ovs_suffix }}
|
||||||
type=patch
|
type=patch
|
||||||
options:peer={{ veth_prefix + tenks_bridge +
|
options:peer={{ veth_prefix + tenks_bridge +
|
||||||
@ -73,7 +73,7 @@
|
|||||||
openvswitch_port:
|
openvswitch_port:
|
||||||
bridge: "{{ source_interface }}"
|
bridge: "{{ source_interface }}"
|
||||||
port: "{{ veth_prefix + tenks_bridge + veth_bridge_source_suffix }}"
|
port: "{{ veth_prefix + tenks_bridge + veth_bridge_source_suffix }}"
|
||||||
set: >
|
set: >-
|
||||||
Interface {{ veth_prefix + tenks_bridge + veth_bridge_source_suffix }}
|
Interface {{ veth_prefix + tenks_bridge + veth_bridge_source_suffix }}
|
||||||
type=patch
|
type=patch
|
||||||
options:peer={{ veth_prefix + tenks_bridge +
|
options:peer={{ veth_prefix + tenks_bridge +
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
- name: Create veth pair
|
- name: Create veth pair
|
||||||
command: >
|
command: >-
|
||||||
ip link add dev {{ veth_pair_ovs_link_name }}
|
ip link add dev {{ veth_pair_ovs_link_name }}
|
||||||
type veth
|
type veth
|
||||||
peer name {{ veth_pair_source_link_name }}
|
peer name {{ veth_pair_source_link_name }}
|
||||||
@ -17,7 +17,7 @@
|
|||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: Plug veth into source bridge
|
- name: Plug veth into source bridge
|
||||||
command: >
|
command: >-
|
||||||
brctl addif {{ veth_pair_source_bridge }}
|
brctl addif {{ veth_pair_source_bridge }}
|
||||||
{{ veth_pair_source_link_name }}
|
{{ veth_pair_source_link_name }}
|
||||||
register: res
|
register: res
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
# during scheduling.
|
# during scheduling.
|
||||||
- name: Collect hypervisor hostvars
|
- name: Collect hypervisor hostvars
|
||||||
set_fact:
|
set_fact:
|
||||||
hypervisor_vars: >
|
hypervisor_vars: >-
|
||||||
{{ hypervisor_vars | default({}) | combine({item: hostvars[item]}) }}
|
{{ hypervisor_vars | default({}) | combine({item: hostvars[item]}) }}
|
||||||
loop: "{{ groups['controllers'] }}"
|
loop: "{{ groups['controllers'] }}"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user