Commit 52fdd7df authored by nanahira's avatar nanahira

auto assign bond interfaces

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