Commit 52fdd7df authored by nanahira's avatar nanahira

auto assign bond interfaces

parent e5974b74
......@@ -9,6 +9,7 @@ iface lo inet loopback
# Links
{% if links is defined and links %}
{% for link in links %}
## {{link.name}}
auto {{link.name}}
......@@ -16,6 +17,7 @@ iface {{link.name}} inet manual
iface {{link.name}} inet6 manual
{% endfor %}
{% endif %}
# end Links
......@@ -23,11 +25,24 @@ iface {{link.name}} inet6 manual
# Bonds
{% for bond in bonds %}
{% if ansible_distribution_major_version|int < 11 %}
## Slaves in bond {{bond.name}}
{% for link in bond.links %}
### Bond slave {{link}}
auto {{link}}
iface {{link}} inet manual
iface {{link}} inet6 manual
{% endfor %}
{% endif %}
## {{bond.name}}
auto {{bond.name}}
iface {{bond.name}} inet manual
iface {{bond.name}} inet6 manual
{% if ansible_distribution_major_version|int < 11 %}
up ifconfig {{bond.name}} 0.0.0.0 up
{% endif %}
{% if ansible_distribution_major_version|int >= 11 %}bond-{% endif %}slaves{% for link in bond.links %} {{link}}{% endfor %}
bond-mode {{bond.mode}}
......
......@@ -2,11 +2,25 @@
network:
version: '2'
ethernets:
{% if links is defined and links %}
{% for link in links %}
'{{link.name}}':
dhcp4: false
dhcp6: false
{% endfor %}
{% endif %}
{% if bonds is defined and bonds %}
# Bonded interfaces
{% for bond in bonds %}
## Slaves in bond {{bond.name}}
{% for link in bond.links %}
### Bond slave {{link}}
'{{link}}':
dhcp4: false
dhcp6: false
{% endfor %}
{% endfor %}
{% endif %}
{% if bonds is defined and bonds and bonds | length > 0 %}
bonds:
{% for bond in bonds %}
......
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