ctucx.git: ansible-configs

My personal ansible roles and playbooks [deprecated in favor of nixos]

1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
35 
36 
37 
38 
39 
40 
41 
42 
43 
44 
45 
46 
47 
48 
49 
50 
51 
52 
53 
54 
55 
56 
57 
58 
59 
60 
61 
62 
63 
64 
65 
66 
67 
68 
69 
70 
71 
72 
73 
74 
75 
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91 
92 
93 #
# !!! This file is managed by Ansible !!!
#

{% for interface in network.interfaces %}
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 system.hostname is defined %}
	hostname {{ system.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 %}
{% if interface.pre_up is defined %}
{% for command in inteface.pre_up %}
	pre-up {{ command }}
{% endfor %}
{% endif %}
{% if interface.post_up is defined %}
{% for command in inteface.post_up %}
	post-up {{ command }}
{% endfor %}
{% endif %}
{% if interface.post_down is defined %}
{% for command in inteface.post_down %}
	post-down {{ command }}
{% endfor %}
{% endif %}
{% endif %}

{% if interface.ipv6 is defined %}
{% if interface.ipv6.stateless is defined %}
iface {{ interface.name }} inet6 manual
	pre-up echo 1 > /proc/sys/net/ipv6/conf/eth0/accept_ra
{% else %}
iface {{ interface.name }} inet6 static
{% if system.hostname is defined %}
	hostname {{ system.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 %}
{% if interface.pre_up is defined %}
{% for command in inteface.pre_up %}
	pre-up {{ command }}
{% endfor %}
{% endif %}
{% if interface.post_up is defined %}
{% for command in inteface.post_up %}
	post-up {{ command }}
{% endfor %}
{% endif %}
{% if interface.post_down is defined %}
{% for command in inteface.post_down %}
	post-down {{ command }}
{% endfor %}
{% endif %}

{% endif %}
{% endif %}
{% endif %}

{% endfor %}