diff --git a/installbox.yml b/installbox.yml index b4c0477..ee58bd6 100644 --- a/installbox.yml +++ b/installbox.yml @@ -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" diff --git a/roles/dhcp-dns-dnsmasq/tasks/main.yml b/roles/dhcp-dns-dnsmasq/tasks/main.yml index c254a79..9d553f7 100644 --- a/roles/dhcp-dns-dnsmasq/tasks/main.yml +++ b/roles/dhcp-dns-dnsmasq/tasks/main.yml @@ -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