Add host bridge and vlans setup
This commit is contained in:
@@ -0,0 +1,50 @@
|
|||||||
|
---
|
||||||
|
- name: Configure systemd-networkd bridge
|
||||||
|
hosts: all
|
||||||
|
become: true
|
||||||
|
tasks:
|
||||||
|
- name: Create network configuration files
|
||||||
|
copy:
|
||||||
|
dest: "/etc/systemd/network/{{ item.file }}"
|
||||||
|
content: "{{ item.content }}"
|
||||||
|
owner: root
|
||||||
|
group: systemd-network
|
||||||
|
mode: '0644'
|
||||||
|
loop:
|
||||||
|
- file: "20-br0.netdev"
|
||||||
|
content: |
|
||||||
|
[NetDev]
|
||||||
|
Name=br0
|
||||||
|
Kind=bridge
|
||||||
|
|
||||||
|
[Bridge]
|
||||||
|
VLANFiltering=yes
|
||||||
|
|
||||||
|
- file: "25-br0-bind.network"
|
||||||
|
content: |
|
||||||
|
[Match]
|
||||||
|
Name=enp2s0
|
||||||
|
|
||||||
|
[Network]
|
||||||
|
Bridge=br0
|
||||||
|
|
||||||
|
[BridgeVLAN]
|
||||||
|
VLAN=30
|
||||||
|
[BridgeVLAN]
|
||||||
|
VLAN=60
|
||||||
|
|
||||||
|
- file: "30-br0-setup.network"
|
||||||
|
content: |
|
||||||
|
[Match]
|
||||||
|
Name=br0
|
||||||
|
|
||||||
|
[Network]
|
||||||
|
DHCP=ipv4
|
||||||
|
notify: restart networkd
|
||||||
|
|
||||||
|
handlers:
|
||||||
|
- name: restart networkd
|
||||||
|
systemd:
|
||||||
|
name: systemd-networkd
|
||||||
|
state: restarted
|
||||||
|
enabled: true
|
||||||
Reference in New Issue
Block a user