29 lines
754 B
YAML
29 lines
754 B
YAML
---
|
|
- name: Ensure dnsmasq is installed
|
|
ansible.builtin.apt:
|
|
name: dnsmasq
|
|
state: present
|
|
become: true
|
|
when: ansible_os_family == "Debian"
|
|
|
|
- name: Ensure dnsmasq is installed
|
|
ansible.builtin.dnf:
|
|
name: dnsmasq
|
|
state: present
|
|
become: true
|
|
when: ansible_os_family == "RedHat"
|
|
|
|
- name: Add host reservation to dnsmasq
|
|
ansible.builtin.lineinfile:
|
|
path: /etc/dnsmasq.d/hosts.conf
|
|
regexp: "^dhcp-host={{ hostvars['ocp-hub'].mac_address }}"
|
|
line: "dhcp-host={{ hostvars['ocp-hub'].mac_address }},{{ hostvars['ocp-hub'].ip_address }} #{{ hostvars['ocp-hub'].hostname }}"
|
|
state: present
|
|
become: true
|
|
|
|
- name: Restart dnsmasq service
|
|
ansible.builtin.service:
|
|
name: dnsmasq
|
|
state: restarted
|
|
become: true
|