vmhost: Define VM/storage networks

Originally, the network configuration for the VM networks and the
storage network was configured using the *netifaces* role.  This has
effectively stopped working in recent versions of Fedora, as it sort of
relied on `dhcpcd`, which has not been maintained in Fedora for a while
and no longer behaves correctly.  After evaluating *NetworkManager* as a
replacement, I decided that *systemd-networkd* is a more appropriate
solution.

There are effectively two "layers" of network configuration needed for
the VM hosts: the host-specific settings, and the common settings.  The
host-specific settings include such properties as the IP address of the
management interface and the names of the physical ports that make up
the bonded interfaces.  The common settings are the bonded interfaces,
the VLAN interfaces created on top of the bond, and the bridges that
provide access to VMs.

To configure the host-specific settings, each host simply needs the
appropriate `networkd_*` variables in its `host_vars` file.  For the
common settings, we apply the *systemd-networkd* role again in the
`vmhost.yml` with different values for these variables.  Thus,
effectively, `systemd-networkd.yml` manages the host-specific settings,
while `vmhost.yml` manages the common settings.
jenkins-master
Dustin 2021-10-10 11:57:00 -05:00
parent 2708dfe3f2
commit 55920c0025
2 changed files with 165 additions and 0 deletions

View File

@ -17,3 +17,158 @@ mount_shared_volumes:
host: '[{{ lookup("dig", storage_host, "qtype=AAAA") }}]' host: '[{{ lookup("dig", storage_host, "qtype=AAAA") }}]'
share: /volume1/VirtualMachines share: /volume1/VirtualMachines
opts: vers=4,intr opts: vers=4,intr
vmhost_netdevs:
- name: 40-bond0
NetDev:
Description: Bonded link for Virtual Machines
Name: bond0
Kind: bond
Bond:
Mode: 802.3ad
MIIMonitorSec: 100ms
- name: 40-bond1
NetDev:
Description: Bonded link for storage network
Name: bond1
Kind: bond
Bond:
Mode: 802.3ad
MIIMonitorSec: 100ms
- name: 50-vlan1
NetDev:
Description: pyrocufflink.blue network (VLAN 1)
Name: vlan1
Kind: vlan
VLAN:
Id: 1
- name: 51-vlan10
NetDev:
Description: Management network (VLAN 10)
Name: vlan10
Kind: vlan
VLAN:
Id: 10
- name: 52-vlan101
NetDev:
Description: pyrocufflink.red network (VLAN 101)
Name: vlan101
Kind: vlan
VLAN:
Id: 101
- name: 52-vlan102
NetDev:
Description: Camera network (VLAN 102)
Name: vlan102
Kind: vlan
VLAN:
Id: 102
- name: 60-prod
NetDev:
Description: pyrocufflink.blue VM network bridge
Name: br0
Kind: bridge
- name: 60-mgmt
NetDev:
Description: Management VM network bridge
Name: mgmt
Kind: bridge
- name: 60-test
NetDev:
Description: pyrocufflink.red VM network bridge
Name: br1
Kind: bridge
- name: 60-camera
NetDev:
Description: Camera VM network bridge
Name: camera
Kind: bridge
vmhost_networks:
- name: 40-bond0
Match:
Name: bond0
Network:
Description: VM network bond
DHCP: 'no'
LinkLocalAddressing: 'no'
VLAN:
- vlan1 # pyrocufflink.blue
- vlan10 # Management
- vlan101 # pyrocufflink.red
- vlan102 # Cameras
- name: 40-bond1
Match:
Name: bond1
Network:
Description: Storage network bond
DHCP: 'no'
Address: '{{ storage_net_address }}'
IPv6AcceptRA: 'no'
RequiredFamilyForOnline: ipv6
Link:
MTUBytes: 9000
- name: 50-vlan1
Match:
Name: vlan1
Network:
Description: pyrocufflink.blue network
DHCP: 'no'
LinkLocalAddressing: 'no'
Bridge: br0
- name: 51-vlan10
Match:
Name: vlan10
Network:
Description: Management network
DHCP: 'no'
LinkLocalAddressing: 'no'
Bridge: mgmt
- name: 52-vlan101
Match:
Name: vlan101
Network:
Description: pyrocufflink.red network
DHCP: 'no'
LinkLocalAddressing: 'no'
Bridge: br1
- name: 52-vlan102
Match:
Name: vlan102
Network:
Description: Camera network
DHCP: 'no'
LinkLocalAddressing: 'no'
Bridge: camera
- name: 60-prod
Match:
Name: br0
Network:
Description: pyrocufflink.blue VM network bridge
DHCP: 'no'
LinkLocalAddressing: 'no'
- name: 60-mgmt
Match:
Name: mgmt
Network:
Description: Management VM network bridge
DHCP: 'no'
LinkLocalAddressing: 'no'
- name: 60-test
Match:
Name: test
Network:
Description: pyrocufflink.red VM network bridge
DHCP: 'no'
LinkLocalAddressing: 'no'
- name: 60-camera
Match:
Name: camera
Network:
Description: Camera VM network bridge
DHCP: 'no'
LinkLocalAddressing: 'no'

View File

@ -1,3 +1,13 @@
- hosts: vm-hosts:&networkd
roles:
- role: systemd-networkd
vars:
networkd_links: []
networkd_devices: '{{ vmhost_netdevs }}'
networkd_networks: '{{ vmhost_networks }}'
tags:
- networkd
- netconfig
- hosts: vm-hosts - hosts: vm-hosts
roles: roles:
- vmhost - vmhost