Improved DHCP configuration, no static IP addresses.
This commit is contained in:
parent
3b3303e96d
commit
be829760c6
4 changed files with 6 additions and 13 deletions
|
@ -17,8 +17,7 @@
|
||||||
|
|
||||||
## LAN IP address range:
|
## LAN IP address range:
|
||||||
ipaddr_lan: 192.168.0.10/24
|
ipaddr_lan: 192.168.0.10/24
|
||||||
dhcp_range: 192.168.0.50,192.168.0.150,2h
|
dhcp_range: 192.168.0.50,192.168.0.99,2h
|
||||||
dhcp_list: "{{ lookup('sequence', 'start=50 end=150 format=192.168.0.%d', wantlist=True) }}"
|
|
||||||
|
|
||||||
di_dist: "{{ ansible_distribution_release }}"
|
di_dist: "{{ ansible_distribution_release }}"
|
||||||
di_version: "{{ ansible_distribution_major_version }}"
|
di_version: "{{ ansible_distribution_major_version }}"
|
||||||
|
|
|
@ -16,8 +16,7 @@
|
||||||
|
|
||||||
## LAN IP address range:
|
## LAN IP address range:
|
||||||
ipaddr_lan: 192.168.0.10/24
|
ipaddr_lan: 192.168.0.10/24
|
||||||
dhcp_range: 192.168.0.50,192.168.0.150,2h
|
dhcp_range: 192.168.0.50,192.168.0.99,2h
|
||||||
dhcp_list: "{{ lookup('sequence', 'start=50 end=150 format=192.168.0.%d', wantlist=True) }}"
|
|
||||||
|
|
||||||
di_dist: "{{ ansible_distribution_release }}"
|
di_dist: "{{ ansible_distribution_release }}"
|
||||||
di_version: "{{ ansible_distribution_major_version }}"
|
di_version: "{{ ansible_distribution_major_version }}"
|
||||||
|
|
|
@ -4,17 +4,11 @@
|
||||||
|
|
||||||
- name: install dnsmasq package
|
- name: install dnsmasq package
|
||||||
apt:
|
apt:
|
||||||
name: dnsmasq
|
name:
|
||||||
|
- dnsmasq
|
||||||
|
- resolvconf
|
||||||
state: latest
|
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
|
- name: configure dnsmasq
|
||||||
template:
|
template:
|
||||||
src: dnsmasq-dhcp.j2
|
src: dnsmasq-dhcp.j2
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
interface={{ if_lan }}
|
interface={{ if_lan }}
|
||||||
dhcp-range={{ dhcp_range }}
|
dhcp-range={{ dhcp_range }}
|
||||||
|
dhcp-generate-names
|
||||||
|
|
Loading…
Add table
Reference in a new issue