Use more logical names for playbooks
This commit is contained in:
parent
291f800c5a
commit
b2c348ed0d
@ -5,6 +5,7 @@
|
||||
vars:
|
||||
libvirt_vm_default_console_log_dir: "{{ console_log_directory }}"
|
||||
# Configure VM definitions for the Libvirt provider.
|
||||
libvirt_vms: >
|
||||
libvirt_vms: >-
|
||||
{{ vms | map('set_libvirt_interfaces')
|
||||
| map('set_libvirt_volume_pool') }}
|
||||
| map('set_libvirt_volume_pool')
|
||||
| list }}
|
@ -1,30 +0,0 @@
|
||||
---
|
||||
- block:
|
||||
- set_fact:
|
||||
# The index of the physical network within this hypervisor's physical
|
||||
# networks.
|
||||
idx: >
|
||||
{{ (physnet_mappings | dictsort | list).index(
|
||||
(item, physnet_mappings.item)) }}
|
||||
# Veth pairs are unique for any VM-physnet combination. However, device
|
||||
# names cannot be longer than 15 characters, so use physical networks'
|
||||
# indices instead.
|
||||
veth_base_name: "{{ veth_prefix + vm.name + '-' + idx }}"
|
||||
|
||||
- name: Set VM veth device names
|
||||
set_fact:
|
||||
veths: >
|
||||
{{ (interfaces | default([])).append(veth_base_name +
|
||||
veth_vm_source_suffix) }}
|
||||
|
||||
- name: Set up veth pairs for the VM
|
||||
include_role:
|
||||
name: veth-pair
|
||||
vars:
|
||||
veth_pair_ovs_bridge: >
|
||||
{{ bridge_prefix ~ idx }}
|
||||
veth_pair_ovs_link_name: "{{ veth_base_name + veth_vm_ovs_suffix }}"
|
||||
veth_pair_source_link_name: >
|
||||
{{ veth_base_name + veth_vm_source_suffix }}
|
||||
|
||||
loop: "{{ vm.physical_networks }}"
|
26
ansible/vm_physical_network.yml
Normal file
26
ansible/vm_physical_network.yml
Normal file
@ -0,0 +1,26 @@
|
||||
---
|
||||
- name: Gather details for VM physical network connection
|
||||
block:
|
||||
- set_fact:
|
||||
# The index of the physical network within this hypervisor's physical
|
||||
# networks.
|
||||
idx: >-
|
||||
{{ (physnet_mappings | dictsort | list).index(
|
||||
(physnet, physnet_mappings[physnet])) }}
|
||||
|
||||
- set_fact:
|
||||
# Veth pairs are unique for any VM-physnet combination. However, device
|
||||
# names cannot be longer than 15 characters, so use physical networks'
|
||||
# indices instead.
|
||||
veth_base_name: >-
|
||||
{{ veth_prefix + vm_name + '-' + idx }}
|
||||
|
||||
- name: Set up veth pairs for the VM
|
||||
include_role:
|
||||
name: veth-pair
|
||||
vars:
|
||||
veth_pair_ovs_bridge: >-
|
||||
{{ bridge_prefix ~ idx }}
|
||||
veth_pair_ovs_link_name: "{{ veth_base_name + veth_vm_ovs_suffix }}"
|
||||
veth_pair_source_link_name: >-
|
||||
{{ veth_base_name + veth_vm_source_suffix }}
|
Loading…
Reference in New Issue
Block a user