From 310469293c894aa7ad321c9d8c92c77a4bf9f93c Mon Sep 17 00:00:00 2001 From: rblundon Date: Sat, 22 Mar 2025 15:00:46 -0500 Subject: [PATCH] updated subtasks --- .../02-dhcp/ip-reservations.yml | 43 ++++++++----------- 10-sno-hub-cluster/install.yml | 7 ++- 10-sno-hub-cluster/vars.yml | 3 -- 3 files changed, 24 insertions(+), 29 deletions(-) diff --git a/10-sno-hub-cluster/02-dhcp/ip-reservations.yml b/10-sno-hub-cluster/02-dhcp/ip-reservations.yml index 271e951..1e3d1ce 100644 --- a/10-sno-hub-cluster/02-dhcp/ip-reservations.yml +++ b/10-sno-hub-cluster/02-dhcp/ip-reservations.yml @@ -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 diff --git a/10-sno-hub-cluster/install.yml b/10-sno-hub-cluster/install.yml index c36149c..a6fcd35 100644 --- a/10-sno-hub-cluster/install.yml +++ b/10-sno-hub-cluster/install.yml @@ -3,7 +3,11 @@ hosts: 127.0.0.1 connection: local gather_facts: true - include_vars: vars.yml + vars_files: vars.yml + + vars_prompt: + - name: freeipa_password + prompt: FreeIPA password for admin user tasks: - name: Deploy DNS entries for cluster via Terraform @@ -16,4 +20,3 @@ - ansible.builtin.include_tasks: file: 02-dhcp/ip-reservations.yml - include_vars: vars.yml diff --git a/10-sno-hub-cluster/vars.yml b/10-sno-hub-cluster/vars.yml index c6d2877..143c646 100644 --- a/10-sno-hub-cluster/vars.yml +++ b/10-sno-hub-cluster/vars.yml @@ -1,6 +1,3 @@ -vars_prompt: - - name: freeipa_password - prompt: FreeIPA password for admin user vars: mac_address: "98:b7:85:1e:c6:f1"