Commit 6c8a7b7c authored by Lars Beckers's avatar Lars Beckers
Browse files

fix some bugs encountered deploying a bond

Note: An LACP-based bond cannot be named bond0 in networkd, because it
asserts some hidden default bond0 using a round-robin approach. This
behavior cannot be overriden by configuration and networkd will not tell
you about that. It just won't work.
parent 95c95af1
......@@ -7,7 +7,7 @@ networkd_address: 10.10.10.10/24
networkd_gateway: 10.10.10.1
# for bond type only
networkd_bond: bond0
networkd_bond: bond1
networkd_bond_devices: [ eth0, eth1 ]
networkd_bond_vlans:
- id: 23
......
---
- name: reload systemd service files
systemd: daemon_reload=yes
- name: restart networkd
service: name=systemd-networkd state=restarted
......@@ -8,7 +8,6 @@
group: root
mode: 0644
notify:
- reload systemd service files
- restart networkd
- name: ensure bonding works correctly
......@@ -35,6 +34,8 @@
owner: root
group: root
mode: 0644
notify:
- restart networkd
- name: ensure bond network is configured
template:
src: bond.network.j2
......@@ -42,6 +43,8 @@
owner: root
group: root
mode: 0644
notify:
- restart networkd
- name: ensure vlan netdevs are configured
template:
src: vlan.netdev.j2
......@@ -49,7 +52,9 @@
owner: root
group: root
mode: 0644
with_items: networkd_bond_vlans
with_items: "{{ networkd_bond_vlans }}"
notify:
- restart networkd
- name: ensure vlan networks are configured
template:
src: vlan.network.j2
......@@ -57,7 +62,9 @@
owner: root
group: root
mode: 0644
with_items: networkd_bond_vlans
with_items: "{{ networkd_bond_vlans }}"
notify:
- restart networkd
- name: ensure bridge netdevs are configured
template:
src: bridge.netdev.j2
......@@ -65,8 +72,10 @@
owner: root
group: root
mode: 0644
with_items: networkd_bond_vlans
when: item.bridge == yes
with_items: "{{ networkd_bond_vlans }}"
when: item.bridge == True
notify:
- restart networkd
- name: ensure bridge networks are configured
template:
src: bridge.network.j2
......@@ -74,14 +83,11 @@
owner: root
group: root
mode: 0644
with_items: networkd_bond_vlans
when: item.bridge == yes and 'address' in item
with_items: "{{ networkd_bond_vlans }}"
when: item.bridge == True
notify:
- restart networkd
when: networkd_type == 'bond'
notify:
- reload systemd service files
- restart networkd
- meta: flush_handlers
- name: ensure networkd is enabled and running
service:
......@@ -94,6 +100,11 @@
name: networking
enabled: no
- name: ensure legacy methods are really disabled
apt:
name: ifupdown
state: absent
- name: ensure we wait for network to be online
service:
name: systemd-networkd-wait-online
......
......@@ -2,7 +2,7 @@
Name={{ networkd_bond }}
[Network]
{%- for vlan in networkd_bond_vlans %}
{% for vlan in networkd_bond_vlans %}
VLAN=vl-{{ vlan.name }}
{% endfor -%}
{% endfor %}
BindCarrier={{ networkd_bond_devices|join(' ') }}
......@@ -2,7 +2,9 @@
Name=vmbr-{{ item.name }}
[Network]
{% if 'address' in item %}
Address={{ item.address }}
{%- if item.gateway %}
{% if 'gateway' in item %}
Gateway={{ item.gateway }}
{% endif -%}
{% endif %}
{% endif %}
......@@ -2,13 +2,13 @@
Name=vl-{{ item.name }}
[Network]
{%- if item.bridge %}
{% if item.bridge %}
Bridge=vmbr-{{ item.name }}
{% else %}
{%- if item.address %}
{% if 'address' in item %}
Address={{ item.address }}
{%- if item.gateway %}
{% if 'gateway' in item %}
Gateway={{ item.gateway }}
{% endif -%}
{% endif -%}
{% endif -%}
{% endif %}
{% endif %}
{% endif %}
Supports Markdown
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