ctucx.git: ansible-configs

My personal ansible roles and playbooks

commit f2ac235d97c042c16297df7427048a145961a670
parent 02f94ca29ae71161cc7e744fda94acb1545c6f0e
Author: Leah Thein <leah@toaster.home.ctu.cx>
Date: Sun, 6 Dec 2020 23:31:37 +0100

common/network: more options
1 file changed, 29 insertions(+), 1 deletion(-)
M
roles/common/templates/interfaces.conf.j2
|
30
+++++++++++++++++++++++++++++-
diff --git a/roles/common/templates/interfaces.conf.j2 b/roles/common/templates/interfaces.conf.j2
@@ -2,16 +2,35 @@
 auto {{ interface.name }}
 {% if interface.loopback is defined %}
 iface {{ interface.name }} inet loopback
+{% elif interface.manual is defined %}
+iface {{ interface.name }} inet manual
 {% else %}
 {% if interface.ipv4.dhcp is defined %}
 iface {{ interface.name }} inet dhcp
 {% else %}
 iface {{ interface.name }} inet static
+{% if network.hostname is defined %}
 	hostname {{ network.hostname }}
+{% endif %}
+{% if interface.bridge_ports is defined %}
+	bridge-ports {{interface.bridge_ports}}
+{% endif %}
+{% if interface.bridge_stp is defined %}
+{% if interface.bridge_stp is true %}
+	bridge-stp 1
+{% else %}
+	bridge-stp 0
+{% endif %}
+{% endif %}
+{% if interface.ipv4.address is defined %}
 	address {{ interface.ipv4.address }}
+{% endif %}
+{% if interface.ipv4.netmask is defined %}
 	netmask {{ interface.ipv4.netmask }}
+{% endif %}
+{% if interface.ipv4.gateway is defined %}
 	gateway {{ interface.ipv4.gateway }}
-{% endif%}
+{% endif %}
 
 {% if interface.ipv6 is defined %}
 {% if interface.ipv6.stateless is defined %}

@@ -19,12 +38,21 @@ iface {{ interface.name }} inet6 manual
 	pre-up echo 1 > /proc/sys/net/ipv6/conf/eth0/accept_ra
 {% else %}
 iface {{ interface.name }} inet6 static
+{% if network.hostname is defined %}
 	hostname {{ network.hostname }}
+{% endif %}
+{% if interface.ipv6.address is defined %}
 	address {{ interface.ipv6.address }}
+{% endif %}
+{% if interface.ipv6.netmask is defined %}
 	netmask {{ interface.ipv6.netmask }}
+{% endif %}
+{% if interface.ipv6.gateway is defined %}
 	gateway {{ interface.ipv6.gateway }}
 {% endif %}
 {% endif %}
 {% endif %}
+{% endif %}
+{% endif %}
 
 {% endfor %} 
\ No newline at end of file