Merge "Allow to create OVS bridge for lxcbr0"

This commit is contained in:
Zuul 2023-01-13 17:36:25 +00:00 committed by Gerrit Code Review
commit 6edd7f802b
2 changed files with 13 additions and 4 deletions

View File

@ -100,7 +100,8 @@ lxc_net_managed: true
# lxc container net network
lxc_net_bridge: lxcbr0
lxc_net_bridge_port: none
# Can be 'linuxbridge' or 'openvswitch'
lxc_net_bridge_type: linuxbridge
lxc_net_address: 10.0.3.1
lxc_net_netmask: 255.255.255.0
lxc_net_cidr: 24

View File

@ -54,13 +54,18 @@
tags:
- lxc-net
- name: Setup LXC OVS Bridge
openvswitch_bridge:
bridge: "{{ lxc_net_bridge }}"
fail_mode: standalone
state: present
when: lxc_net_bridge_type == 'openvswitch'
- name: Run the systemd-networkd role
include_role:
name: systemd_networkd
vars:
systemd_networkd_prefix: "lxc-net"
systemd_run_networkd: true
systemd_netdevs:
_lxc_net_bridge_devices:
- NetDev:
Name: "{{ lxc_net_bridge }}"
Kind: bridge
@ -69,6 +74,9 @@
HelloTimeSec: 2
MaxAgeSec: 12
STP: off
systemd_networkd_prefix: "lxc-net"
systemd_run_networkd: true
systemd_netdevs: "{{ (lxc_net_bridge_type == 'openvswitch') | ternary([], _lxc_net_bridge_devices) }}"
systemd_networks:
- interface: "{{ lxc_net_bridge }}"
address: "{{ lxc_net_address }}"