Parameterize most of the LAN config
So that it adapts to e.g. 192.168.50/24 instead of 192.168.0/24
This commit is contained in:
parent
53b54edd18
commit
1a9b3ba2e6
5 changed files with 21 additions and 8 deletions
|
@ -17,6 +17,8 @@
|
||||||
|
|
||||||
## LAN IP address range:
|
## LAN IP address range:
|
||||||
ipaddr_lan: 192.168.0.10/24
|
ipaddr_lan: 192.168.0.10/24
|
||||||
|
ipaddr_lan_threeoct: {{ ipaddr_lan.split('.')[0:3] | join('.')}}
|
||||||
|
ipaddr_lan_ptr: {{ ipaddr_lan | ansible.netcommon.ipaddr('revdns').split('.')[1:-1] | join('.') }}
|
||||||
dhcp_range: 192.168.0.50,192.168.0.99,2h
|
dhcp_range: 192.168.0.50,192.168.0.99,2h
|
||||||
|
|
||||||
di_dist: "{{ ansible_distribution_release }}"
|
di_dist: "{{ ansible_distribution_release }}"
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
dest: "/etc/bind/{{ item }}"
|
dest: "/etc/bind/{{ item }}"
|
||||||
loop:
|
loop:
|
||||||
- db.intern
|
- db.intern
|
||||||
- db.192.168.0
|
- db.lan
|
||||||
- localzones
|
- localzones
|
||||||
notify: restart bind
|
notify: restart bind
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
state: link
|
state: link
|
||||||
loop:
|
loop:
|
||||||
- db.intern
|
- db.intern
|
||||||
- db.192.168.0
|
- db.lan
|
||||||
notify: restart bind
|
notify: restart bind
|
||||||
|
|
||||||
- name: enable local bind config
|
- name: enable local bind config
|
||||||
|
|
11
roles/dns-dhcp-tftp/templates/db.lan.j2
Normal file
11
roles/dns-dhcp-tftp/templates/db.lan.j2
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
$TTL 500
|
||||||
|
@ IN SOA {{ ansible_fqdn }}. root.{{ ansible_domain }}. (
|
||||||
|
1 ; Serial
|
||||||
|
3600 ; Refresh
|
||||||
|
1800 ; Retry
|
||||||
|
720000 ; Expire
|
||||||
|
6400 ) ; Negative Cache TTL
|
||||||
|
;
|
||||||
|
@ NS {{ ansible_fqdn }}.
|
||||||
|
MX 10 {{ ansible_fqdn }}.
|
||||||
|
{{ ipaddr_lan | ipaddr("address") | regex_replace("^.*\.(.+$)", "\\1") }} PTR {{ ansible_fqdn }}.
|
|
@ -26,7 +26,7 @@ zone intern. {
|
||||||
key rndc-key;
|
key rndc-key;
|
||||||
}
|
}
|
||||||
|
|
||||||
zone 0.168.192.in-addr.arpa. {
|
zone "{{ ipaddr_lan_ptr }}" {
|
||||||
primary 127.0.0.1;
|
primary 127.0.0.1;
|
||||||
key rndc-key;
|
key rndc-key;
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ authoritative;
|
||||||
#log-facility local7;
|
#log-facility local7;
|
||||||
|
|
||||||
## The tftpd server IP address, for all clients.
|
## The tftpd server IP address, for all clients.
|
||||||
next-server 192.168.0.10;
|
next-server {{ ipaddr_lan | ipaddr("address") }};
|
||||||
|
|
||||||
option arch code 93 = unsigned integer 16;
|
option arch code 93 = unsigned integer 16;
|
||||||
if option arch = 00:07 {
|
if option arch = 00:07 {
|
||||||
|
@ -50,7 +50,7 @@ if option arch = 00:07 {
|
||||||
filename "d-i/n-a/pxelinux.0";
|
filename "d-i/n-a/pxelinux.0";
|
||||||
}
|
}
|
||||||
|
|
||||||
subnet 192.168.0.0 netmask 255.255.255.0 {
|
subnet {{ ipaddr_lan | ipaddr("address") }} netmask {{ ipaddr_lan | ipaddr("netmask") }} {
|
||||||
option routers {{ ipaddr_lan | ipaddr("address") }};
|
option routers {{ ipaddr_lan | ipaddr("address") }};
|
||||||
range {{ dhcp_start }} {{ dhcp_stop }};
|
range {{ dhcp_start }} {{ dhcp_stop }};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
include "/etc/bind/rndc.key";
|
include "/etc/bind/rndc.key";
|
||||||
|
|
||||||
zone "0.168.192.in-addr.arpa" {
|
zone "{{ ipaddr_lan_ptr }}" {
|
||||||
type master;
|
type master;
|
||||||
notify no;
|
notify no;
|
||||||
file "/etc/bind/db.192.168.0";
|
file "/etc/bind/db.{{ ipaddr_lan_threeoct }}";
|
||||||
journal "/var/lib/bind/db.192.168.0.jnl";
|
journal "/var/lib/bind/db.{{ ipaddr_lan_threeoct }}.jnl";
|
||||||
allow-update { key rndc-key; };
|
allow-update { key rndc-key; };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue