networking
This commit is contained in:
parent
1166e932c5
commit
e7870f6ef6
2
ansible/roles/networking/defaults/main.yml
Normal file
2
ansible/roles/networking/defaults/main.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
network_vlan_id: '25'
|
32
ansible/roles/networking/tasks/main.yml
Normal file
32
ansible/roles/networking/tasks/main.yml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
---
|
||||||
|
- name: add network files
|
||||||
|
become: true
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: "{{ item.source }}"
|
||||||
|
dest: "{{ item.destination }}"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0664
|
||||||
|
with_items:
|
||||||
|
- source: vlan.netdev.j2
|
||||||
|
destination: /etc/systemd/network/30-vlan{{ network_vlan_id }}.netdev
|
||||||
|
- source: vlan.network.j2
|
||||||
|
destination: /etc/systemd/network/31-vlan{{ network_vlan_id }}.network
|
||||||
|
- source: bridge.netdev.j2
|
||||||
|
destination: /etc/systemd/network/40-br{{ network_vlan_id }}.netdev
|
||||||
|
- source: bridge.network.j2
|
||||||
|
destination: /etc/systemd/network/41-br{{ network_vlan_id }}.network
|
||||||
|
|
||||||
|
- name: modify lacp network file
|
||||||
|
become: true
|
||||||
|
ansible.builtin.lineinfile:
|
||||||
|
state: present
|
||||||
|
insertafter: '^\[Network\]$'
|
||||||
|
line: VLAN=vlan{{ network_vlan_id }}
|
||||||
|
path: /etc/systemd/network/21-lacp.network
|
||||||
|
|
||||||
|
- name: restart systemd-networkd
|
||||||
|
become: true
|
||||||
|
ansible.builtin.service:
|
||||||
|
name: systemd-networkd.service
|
||||||
|
state: restarted
|
0
ansible/roles/networking/templates/bond.netdev.j2
Normal file
0
ansible/roles/networking/templates/bond.netdev.j2
Normal file
0
ansible/roles/networking/templates/bond.network.j2
Normal file
0
ansible/roles/networking/templates/bond.network.j2
Normal file
6
ansible/roles/networking/templates/bridge.netdev.j2
Normal file
6
ansible/roles/networking/templates/bridge.netdev.j2
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
[NetDev]
|
||||||
|
Name=br{{ network_vlan_id }}
|
||||||
|
Kind=bridge
|
||||||
|
|
||||||
|
[Bridge]
|
||||||
|
|
15
ansible/roles/networking/templates/bridge.network.j2
Normal file
15
ansible/roles/networking/templates/bridge.network.j2
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
[Match]
|
||||||
|
Name=br{{ network_vlan_id }}
|
||||||
|
|
||||||
|
[Link]
|
||||||
|
ARP=yes
|
||||||
|
|
||||||
|
[Address]
|
||||||
|
Address=192.168.{{ network_vlan_id }}.100/24
|
||||||
|
|
||||||
|
[Route]
|
||||||
|
Gateway=192.168.{{ network_vlan_id }}.254
|
||||||
|
|
||||||
|
[Network]
|
||||||
|
DHCP=no
|
||||||
|
|
6
ansible/roles/networking/templates/vlan.netdev.j2
Normal file
6
ansible/roles/networking/templates/vlan.netdev.j2
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
[NetDev]
|
||||||
|
Name=vlan{{ network_vlan_id }}
|
||||||
|
Kind=vlan
|
||||||
|
|
||||||
|
[VLAN]
|
||||||
|
Id={{ network_vlan_id }}
|
9
ansible/roles/networking/templates/vlan.network.j2
Normal file
9
ansible/roles/networking/templates/vlan.network.j2
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[Match]
|
||||||
|
Name=vlan{{ network_vlan_id }}
|
||||||
|
|
||||||
|
[Link]
|
||||||
|
ARP=off
|
||||||
|
|
||||||
|
[Network]
|
||||||
|
DHCP=off
|
||||||
|
Bridge=br{{ network_vlan_id }}
|
Loading…
Reference in New Issue
Block a user