updated subtasks

This commit is contained in:
2025-03-22 15:00:46 -05:00
parent 13bb2d6e73
commit 310469293c
3 changed files with 24 additions and 29 deletions

View File

@@ -1,28 +1,23 @@
---
- name: Set dnsmasq host reservation
hosts: all
become: true
- name: Ensure dnsmasq is installed
ansible.builtin.apt:
name: dnsmasq
state: present
when: ansible_os_family == "Debian"
tasks:
- name: Ensure dnsmasq is installed
ansible.builtin.apt:
name: dnsmasq
state: present
when: ansible_os_family == "Debian"
- name: Ensure dnsmasq is installed
ansible.builtin.dnf:
name: dnsmasq
state: present
when: ansible_os_family == "RedHat"
- name: Ensure dnsmasq is installed
ansible.builtin.dnf:
name: dnsmasq
state: present
when: ansible_os_family == "RedHat"
- name: Add host reservation to dnsmasq
ansible.builtin.lineinfile:
path: /etc/dnsmasq.d/hosts.conf
line: "dhcp-host={{ mac_address }},{{ ip_address }},{{ hostname }}"
state: present
- name: Add host reservation to dnsmasq
ansible.builtin.lineinfile:
path: /etc/dnsmasq.d/hosts.conf
line: "dhcp-host={{ mac_address }},{{ ip_address }},{{ hostname }}"
state: present
- name: Restart dnsmasq service
ansible.builtin.service:
name: dnsmasq
state: restarted
- name: Restart dnsmasq service
ansible.builtin.service:
name: dnsmasq
state: restarted