Commit 2190fcce authored by nanahira's avatar nanahira

use netplan for link 2 interfaces in Ubuntu

parent 7b923191
...@@ -4,6 +4,9 @@ source /etc/network/interfaces.d/* ...@@ -4,6 +4,9 @@ source /etc/network/interfaces.d/*
auto lo auto lo
iface lo inet loopback iface lo inet loopback
{% if ansible_distribution != 'Ubuntu' %}
### Configs in non-Ubuntu only
# Links # Links
{% for link in links %} {% for link in links %}
...@@ -25,7 +28,7 @@ up ifconfig {{bond.name}} 0.0.0.0 up ...@@ -25,7 +28,7 @@ up ifconfig {{bond.name}} 0.0.0.0 up
slaves{% for link in bond.links %} {{link}}{% endfor %} slaves{% for link in bond.links %} {{link}}{% endfor %}
bond-mode {{bond.mode}} bond-mode {{bond.mode}}
{% if bond.mode == 4 %} {% if bond.mode == 4 or bond.mode == "802.3ad" %}
bond-miimon 100 bond-miimon 100
bond-downdelay 200 bond-downdelay 200
bond-updelay 200 bond-updelay 200
...@@ -45,6 +48,9 @@ iface {{vlan.link}}.{{vlan.tag}} inet6 manual ...@@ -45,6 +48,9 @@ iface {{vlan.link}}.{{vlan.tag}} inet6 manual
{% endfor %} {% endfor %}
### end non-ubuntu
{% endif %}
# Bridges # Bridges
{% for br in bridges %} {% for br in bridges %}
......
# MyCard NextGen router netplan config
network:
version: '2'
ethernets:
{% for link in links %}
'{{link.name}}':
dhcp4: false
dhcp6: false
{% endfor %}
bonds:
{% for bond in bonds %}
'{{bond.name}}':
interfaces:
{% for link in bond.links %}
- '{{link}}'
{% endfor %}
parameters:
mode: '{{bond.mode}}'
{% if bond.mode == "802.3ad" %}
lacp-rate: fast
min-links: 1
transmit-hash-policy: layer2+3
mii-monitor-interval: 100
{% endif %}
dhcp4: false
dhcp6: false
{% endfor %}
vlans:
{% for vlan in vlans %}
'{{vlan.link}}.{{vlan.tag}}':
id: {{vlan.tag}}
link: '{{vlan.link}}'
dhcp4: false
dhcp6: false
{% endfor %}
...@@ -12,6 +12,10 @@ ...@@ -12,6 +12,10 @@
apt: apt:
name: net-tools,bridge-utils,ifenslave,vlan,pppoe,iproute2,iptables,ipset name: net-tools,bridge-utils,ifenslave,vlan,pppoe,iproute2,iptables,ipset
update_cache: true update_cache: true
- name: Ubuntu things
apt:
name: netplan.io
when: ansible_distribution == 'Ubuntu'
- name: pve things - name: pve things
apt: apt:
name: 'pve-headers-{{ansible_kernel}},ifupdown2' name: 'pve-headers-{{ansible_kernel}},ifupdown2'
......
...@@ -34,15 +34,10 @@ ...@@ -34,15 +34,10 @@
- name: clean some rubbish packages - name: clean some rubbish packages
become: true become: true
apt: apt:
name: nplan,netplan.io,resolvconf name: resolvconf
state: absent state: absent
- name: disable systemd-resolved - name: Ubuntu netplan
become: true include_tasks: ./tasks/netplan.yaml
systemd:
name: systemd-resolved
state: stopped
enabled: false
masked: true
when: ansible_distribution == 'Ubuntu' when: ansible_distribution == 'Ubuntu'
- name: set resolv.conf - name: set resolv.conf
become: true become: true
......
- name: clean old confs
become: true
file:
path: /etc/netplan/{{item}}.yaml
state: absent
with_items:
- 00-installer-config
- 50-cloud-init
- name: netplan file
become: true
template:
src: ./files/netplan.yaml.j2
dest: /etc/netplan/00-mycard-nextgen-router.yaml
- name: disable systemd-resolved
become: true
systemd:
name: systemd-resolved
state: stopped
enabled: false
masked: true
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment