lmn-client/roles/dhcp-dns-dnsmasq/tasks/main.yml
2019-11-18 17:31:17 +01:00

22 lines
567 B
YAML

- name: check if dnsmasq is already there
stat: path=/etc/dnsmasq.d/dnsmasq-dhcp
register: dnsmasq
- name: install dnsmasq package
apt:
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"
when: not dnsmasq.stat.exists
- name: configure dnsmasq
template:
src: dnsmasq-dhcp.j2
dest: /etc/dnsmasq.d/dnsmasq-dhcp
notify: "restart dnsmasq"