final update to creating VMs

This commit is contained in:
2025-07-14 10:50:29 -05:00
parent 98cad7348c
commit 23bdd17e25
10 changed files with 76 additions and 16 deletions

View File

@@ -15,11 +15,11 @@
register: proxmox_vm_info
- name: Extract net0 information
set_fact:
ansible.builtin.set_fact:
vm_net0: "{{ proxmox_vm_info.proxmox_vms[0].config.net0 }}"
- name: Extract MAC address using regex
set_fact:
ansible.builtin.set_fact:
vm_mac_address: "{{ vm_net0 | regex_search('([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}') }}"
- name: Add line to hosts file
@@ -28,7 +28,7 @@
ansible.builtin.lineinfile:
path: /etc/dnsmasq.d/hosts.conf
regexp: "# {{ inventory_hostname }}$"
line: "dhcp-host={{ vm_mac_address|lower }},{{ ip_address }} # {{ inventory_hostname }}"
line: "dhcp-host={{ vm_mac_address | lower }},{{ ip_address }} # {{ inventory_hostname }}"
state: present
# restart dnsmasq service
- name: Restart service dnsmasq

View File

@@ -4,7 +4,7 @@
gather_facts: false
tasks:
- name: Create DNS entry for {{ inventory_hostname }} #on {{ groups['ipa_servers'][0] }}
- name: Create DNS entry for {{ inventory_hostname }}
delegate_to: "{{ groups['ipaserver'][0] }}"
freeipa.ansible_freeipa.ipadnsrecord:
ipaapi_context: "server"
@@ -14,4 +14,4 @@
record_type: "A"
record_value: "{{ ip_address }}"
record_ttl: 60
#create_reverse: yes
# create_reverse: yes

View File

View File

@@ -9,4 +9,3 @@
delegate_to: "{{ inventory_hostname }}"
ansible.builtin.hostname:
name: "{{ hostname }}"
#delay: 20

View File

@@ -39,7 +39,6 @@
Upgrade Result: {{ upgrade_result }}
Autoremove Result: {{ autoremove_result }}
- name: Upgrade RHEL systems with DNF
when: ansible_os_family == "RedHat" and not (ansible_distribution_major_version == "7")
block: