Remove 'controllers' group in favour of localhost
Only a single controller would have ever been required, so explicitly referencing localhost makes more sense. Also, remove a duplicate 'when' attribute.
This commit is contained in:
parent
5a04d38baa
commit
a4c21a2d92
@ -3,7 +3,7 @@
|
|||||||
tasks:
|
tasks:
|
||||||
- include_tasks: host_setup.yml
|
- include_tasks: host_setup.yml
|
||||||
|
|
||||||
- hosts: controllers
|
- hosts: localhost
|
||||||
tasks:
|
tasks:
|
||||||
- include_tasks: schedule.yml
|
- include_tasks: schedule.yml
|
||||||
|
|
||||||
@ -19,11 +19,10 @@
|
|||||||
vm_name: "{{ item.0.name }}"
|
vm_name: "{{ item.0.name }}"
|
||||||
physnet: "{{ item.1 }}"
|
physnet: "{{ item.1 }}"
|
||||||
# Loop over each physical network for each VM allocated to this host.
|
# 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 localhost's vars.
|
||||||
loop: >-
|
loop: >-
|
||||||
{{ hostvars[groups.controllers.0].allocations.result[
|
{{ hostvars['localhost'].allocations.result[inventory_hostname]
|
||||||
inventory_hostname] | default([])
|
| default([]) | subelements('physical_networks') }}
|
||||||
| subelements('physical_networks') }}
|
|
||||||
|
|
||||||
- hosts: libvirt
|
- hosts: libvirt
|
||||||
tasks:
|
tasks:
|
||||||
@ -42,7 +41,7 @@
|
|||||||
|
|
||||||
- include_tasks: libvirt_create_vms.yml
|
- include_tasks: libvirt_create_vms.yml
|
||||||
vars:
|
vars:
|
||||||
# Allocations are stored in the controller node's vars.
|
# Allocations are stored in the localhost's vars.
|
||||||
vms: >-
|
vms: >-
|
||||||
{{ hostvars[groups.controllers.0].allocations.result[
|
{{ hostvars['localhost'].allocations.result[inventory_hostname]
|
||||||
inventory_hostname] | default([]) }}
|
| default([]) }}
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
[controllers]
|
|
||||||
# Empty group to provide delaration of controllers group.
|
|
||||||
|
|
||||||
[hypervisors:children]
|
[hypervisors:children]
|
||||||
libvirt
|
libvirt
|
||||||
|
|
||||||
|
@ -1,5 +1,2 @@
|
|||||||
[controllers]
|
|
||||||
localhost ansible_connection=local
|
|
||||||
|
|
||||||
[libvirt]
|
[libvirt]
|
||||||
localhost ansible_connection=local
|
localhost ansible_connection=local
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
# Start off by assuming the source interface is direct, unless proven
|
# Start off by assuming the source interface is direct, unless proven
|
||||||
# otherwise.
|
# otherwise.
|
||||||
- set_fact:
|
- set_fact:
|
||||||
source_type: 'direct'
|
source_type: direct
|
||||||
|
|
||||||
- name: Get source interface details
|
- name: Get source interface details
|
||||||
command: ip -details link show {{ source_interface }}
|
command: ip -details link show {{ source_interface }}
|
||||||
@ -79,8 +79,6 @@
|
|||||||
options:peer={{ veth_prefix + tenks_bridge +
|
options:peer={{ veth_prefix + tenks_bridge +
|
||||||
veth_bridge_ovs_suffix }}
|
veth_bridge_ovs_suffix }}
|
||||||
|
|
||||||
when: if_details.stdout_lines[-1].split()[0] == 'openvswitch'
|
|
||||||
|
|
||||||
- name: Plug source interface into Tenks bridge
|
- name: Plug source interface into Tenks bridge
|
||||||
when: source_type == 'direct'
|
when: source_type == 'direct'
|
||||||
openvswitch_port:
|
openvswitch_port:
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
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['hypervisors'] }}"
|
||||||
|
|
||||||
- name: Schedule VMs to hypervisors
|
- name: Schedule VMs to hypervisors
|
||||||
tenks_schedule:
|
tenks_schedule:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user