|
1 | 1 | {% for i, j in data.items() %} |
2 | | -{% if i|string() == 'general' %} |
3 | | -{% for general in j %} |
4 | | -{% if general.get('hostname') %} |
5 | | -config: /etc/hostname |
6 | | -{{ general.get('hostname') }} |
7 | | - |
8 | | -{% endif %} |
9 | | -{% endfor %} |
10 | | -{% endif %} |
11 | | -{% endfor %} |
12 | | -{% for i, j in data.items() %} |
13 | | -{% if i|string() == 'general' %} |
14 | | -{% for general in j %} |
15 | | -{% if general.get('timezone') %} |
16 | | -run commands: |
17 | | -$ timedatectl set-timezone {{ general.get('timezone') }} |
18 | | - |
19 | | -{% endif %} |
20 | | -{% endfor %} |
21 | | -{% endif %} |
22 | | -{% endfor%} |
23 | | -{% for i, j in data.items() %} |
24 | 2 | {% if i|string() == 'interfaces' %} |
25 | 3 | {% for interface in j %} |
26 | 4 | {% if interface.get('iftype') == 'wireless' %} |
@@ -103,54 +81,3 @@ iface {{ interface.get('ifname') }} inet6 {{ address.get('proto') }} |
103 | 81 | {% endfor %} |
104 | 82 | {% endif %} |
105 | 83 | {% endfor%} |
106 | | -{% set count = [1] %} |
107 | | -{% for i, j in data.items() %} |
108 | | -{% if i|string() in ['dns_servers', 'dns_search'] %} |
109 | | -{% if count == [1] %} |
110 | | -config: /etc/resolv.conf |
111 | | -{% if count.append(count.pop() + 1) %}{% endif %} |
112 | | -{% endif %} |
113 | | -{% endif %} |
114 | | -{% if i|string() == 'dns_servers' %} |
115 | | -{% for ip in j %} |
116 | | -nameserver {{ ip }} |
117 | | -{% endfor %} |
118 | | -{% elif i|string() == 'dns_search' %} |
119 | | -{% for domain in j %} |
120 | | -search {{ domain }} |
121 | | -{% endfor %} |
122 | | -{% endif %} |
123 | | -{% endfor%} |
124 | | -{% for i, j in data.items() %} |
125 | | -{% if i|string() == 'wireless' %} |
126 | | -{% for wireless in j %} |
127 | | -config: /etc/hostapd/hostapd.conf |
128 | | -interface={{ wireless.get('ifname') }} |
129 | | -driver=nl80211 |
130 | | -hw_mode={{ wireless.get('hwmode')}} |
131 | | -channel={{ wireless.get('channel')}} |
132 | | -{% if wireless.get('protocol') == '80211n' %} |
133 | | -ieee80211n=1 |
134 | | -{% endif %} |
135 | | -ssid={{ wireless.get('ssid') }} |
136 | | -{% if wireless.get('encryption') != {} %} |
137 | | -auth_algs={{ wireless.get('encryption').get('auth_algs') }} |
138 | | -wpa={{ wireless.get('encryption').get('wpa') }} |
139 | | -wpa_key_mgmt={{ wireless.get('encryption').get('wpa_key_mgmt') }} |
140 | | -wpa_passphrase={{ wireless.get('encryption').get('wpa_passphrase') }} |
141 | | -{% if wireless.get('encryption', None).get('wpa_pairwise') != 'AUTO' %} |
142 | | -wpa_pairwise={{ wireless.get('encryption').get('wpa_pairwise')}} |
143 | | -{% endif %} |
144 | | -{% endif %} |
145 | | -{% endfor %} |
146 | | -{% else %} |
147 | | -{% endif %} |
148 | | -{% endfor %} |
149 | | -{% for i, j in data.items() %} |
150 | | -{% if i|string() == 'ntp' %} |
151 | | -config: /etc/ntp.conf |
152 | | -{% for server in j %} |
153 | | -server {{ server }} |
154 | | -{% endfor %} |
155 | | -{% endif %} |
156 | | -{% endfor %} |
0 commit comments