Files
homelab/ansible/playbooks/tasks/configure_dhcp_entry.yml

11 lines
361 B
YAML

---
- name: Add DHCP entry for {{ inventory_hostname }}
delegate_to: "{{ dhcp_server }}"
become: true
ansible.builtin.lineinfile:
path: /etc/dnsmasq.d/hosts.conf
regexp: "# {{ inventory_hostname }}$"
line: "dhcp-host={{ host_mac_address | lower }},{{ host_ip_address }} # {{ inventory_hostname }}"
state: present
notify: Restart dnsmasq