Generate IP address list automatically.

This commit is contained in:
Andreas B. Mundt 2019-05-25 22:44:59 +03:00
parent 7404d7ace4
commit dd89bbb9a4
2 changed files with 8 additions and 0 deletions

View file

@ -11,6 +11,7 @@
hostname: "{{ ansible_hostname }}"
ipaddr_lan: 192.168.0.10
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) }}"
tftp_root: "/var/lib/tftpboot"
deb_mirror: "deb.debian.org"
di_dist: "buster"

View file

@ -3,6 +3,13 @@
name: dnsmasq
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"
- name: configure dnsmasq
template:
src: dnsmasq-transparent-proxy.j2