Improved DHCP configuration, no static IP addresses.

This commit is contained in:
Andreas B. Mundt 2019-11-29 14:38:07 +01:00
parent 3b3303e96d
commit be829760c6
4 changed files with 6 additions and 13 deletions

View file

@ -17,8 +17,7 @@
## LAN IP address range:
ipaddr_lan: 192.168.0.10/24
dhcp_range: 192.168.0.50,192.168.0.150,2h
dhcp_list: "{{ lookup('sequence', 'start=50 end=150 format=192.168.0.%d', wantlist=True) }}"
dhcp_range: 192.168.0.50,192.168.0.99,2h
di_dist: "{{ ansible_distribution_release }}"
di_version: "{{ ansible_distribution_major_version }}"

View file

@ -16,8 +16,7 @@
## LAN IP address range:
ipaddr_lan: 192.168.0.10/24
dhcp_range: 192.168.0.50,192.168.0.150,2h
dhcp_list: "{{ lookup('sequence', 'start=50 end=150 format=192.168.0.%d', wantlist=True) }}"
dhcp_range: 192.168.0.50,192.168.0.99,2h
di_dist: "{{ ansible_distribution_release }}"
di_version: "{{ ansible_distribution_major_version }}"

View file

@ -4,17 +4,11 @@
- name: install dnsmasq package
apt:
name: dnsmasq
name:
- dnsmasq
- resolvconf
state: latest
- name: add client hostnames and IP addresses to /etc/hosts
lineinfile:
dest: /etc/hosts
line: "{{ item.1 }}\t{{ 'debian%03d' | format(item.0) }}"
with_indexed_items: "{{ dhcp_list }}"
notify: "restart dnsmasq"
when: not dnsmasq.stat.exists
- name: configure dnsmasq
template:
src: dnsmasq-dhcp.j2

View file

@ -1,2 +1,3 @@
interface={{ if_lan }}
dhcp-range={{ dhcp_range }}
dhcp-generate-names