Created
June 11, 2013 20:13
-
-
Save analytically/5760207 to your computer and use it in GitHub Desktop.
Ansible /etc/network/interfaces template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# {{ ansible_managed }} | |
# This file describes the network interfaces available on your system | |
# and how to activate them. For more information, see interfaces(5). | |
# The loopback network interface | |
auto lo | |
iface lo inet loopback | |
{% if ansible_interfaces|length > 2 %} | |
{% for interface in ansible_interfaces if interface != 'lo' and interface != 'bond0' %} | |
auto {{ interface }} | |
iface {{ interface }} inet manual | |
bond-master bond0 | |
{% endfor %} | |
# The primary (bonded) network interface | |
auto bond0 | |
iface bond0 inet static | |
address {{ ansible_default_ipv4.address }} | |
netmask {{ ansible_default_ipv4.netmask }} | |
gateway {{ ansible_default_ipv4.gateway }} | |
network {{ ansible_default_ipv4.network }} | |
# bond0 uses standard IEEE 802.3ad LACP bonding protocol | |
bond-mode 802.3ad | |
bond-miimon 100 | |
bond-lacp-rate 1 | |
bond-xmit-hash-policy layer3+4 | |
bond-slaves none | |
{% endif %} | |
{% if ansible_interfaces|length == 2 %} | |
# The primary network interface | |
auto {{ ansible_default_ipv4.interface }} | |
iface {{ ansible_default_ipv4.interface }} inet static | |
address {{ ansible_default_ipv4.address }} | |
netmask {{ ansible_default_ipv4.netmask }} | |
gateway {{ ansible_default_ipv4.gateway }} | |
network {{ ansible_default_ipv4.network }} | |
{% endif %} | |
dns-nameservers 8.8.8.8 8.8.4.4 | |
# the end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment