diff --git a/infra-config/create_vms.yml b/infra-config/create_vms.yml index fcb97b0..c35b543 100644 --- a/infra-config/create_vms.yml +++ b/infra-config/create_vms.yml @@ -30,8 +30,8 @@ pre_enrolled_keys: false scsihw: virtio-scsi-single scsi: - scsi0: "{{ vm_storage }}:{{ vm_disk_size }},format=raw,aio=native" #VMs_LVM:10,format=raw + scsi0: "{{ vm_storage }}:{{ vm_disk_size }},format=raw,aio=native" # VMs_LVM:10,format=raw net: - net0: "virtio,bridge={{ vm_net_bridge}}{{vm_net_vlan}}" + net0: "virtio,bridge={{ vm_net_bridge }}{{ vm_net_vlan }}" onboot: "true" - #update: "true" + # update: "true" diff --git a/infra-config/host_vars/docker01/vars b/infra-config/host_vars/docker01/vars index 6710b32..8b08651 100644 --- a/infra-config/host_vars/docker01/vars +++ b/infra-config/host_vars/docker01/vars @@ -1,9 +1,9 @@ --- -# file: host_vars/matchbox/vars +# file: host_vars/docker01/vars # Networking # primary_interface: "enp1s0f0" -mac_address: "BC:24:11:03:A9:7B" +#mac_address: "BC:24:11:03:A9:7B" ip_address: 10.1.71.211 hostname: "{{ inventory_hostname }}.{{ base_domain }}" diff --git a/infra-config/host_vars/prometheus/vars b/infra-config/host_vars/monitor/vars similarity index 64% rename from infra-config/host_vars/prometheus/vars rename to infra-config/host_vars/monitor/vars index 7cbfc10..d0cfb1f 100644 --- a/infra-config/host_vars/prometheus/vars +++ b/infra-config/host_vars/monitor/vars @@ -1,17 +1,15 @@ --- -# file: host_vars/prometheus/vars +# file: host_vars/monitor/vars # VM Definition platform: "proxmox" proxmox_clone_node: "pve03" vm_clone_source: "fedora-42-large" vm_storage: "pve-general" -ha_group: "pv03" +ha_group: "pve03" # Networking ip_address: 10.1.71.249 -# primary_interface: "enp1s0f0" -# mac_address: "BC:24:11:03:A9:7B" # convert this to a proxmox read for VMs # Software #terraform_version: "1.11.3" diff --git a/infra-config/host_vars/vm_template/vars b/infra-config/host_vars/vm_template/vars new file mode 100644 index 0000000..0e3d5ff --- /dev/null +++ b/infra-config/host_vars/vm_template/vars @@ -0,0 +1,48 @@ +--- +# file: host_vars/vm_template/vars +# Ansible vars template for hosts created via cloning. + +# Supported hypervisors: +# - Proxmox + +platform: "proxmox" + +# This is the Proxmox node where all the VM templates are stored. (Templates are not global.) + +proxmox_clone_node: "pve03" + +# Templates are named in the following format (all lower case): -- +# Current OS offerings are: +# - Fedora (42) +# Current VM sizes are: +# - Small: 2 cores, 2GB memory, 8 GiB virtual disk +# - Medium: 2 cores, 4GB memory, 16 GiB virtual disk +# - Large: 4 cores, 4GB memory, 32 GiB virtual disk +# - Xlarge: 4 cores, 8GB memory, 64 GiB virtual disk + +vm_clone_source: "fedora-42-large" + +# Proxmox storage target. + +vm_storage: "pve-general" + +# Proxmox does not yet do dynamic load balancing, the host target sets the target for HA groups +# and backup groups. (ha_group will be factored out in the next functionality update.) + +ha_group: "pve03" +proxmox_host_target: "pve03" + +# Currently, only single NIC VMs using IPv4 are supported via cloning. The IP address also +# sets the Proxmox VMID. The VMID is a combination of the 3rd and 4th octet of the IPv4 address. + +ip_address: 10.1.71.249 + +# Software +# Future enhancement will allow specification of additional software to automatically deploy to +# the VM after creation. + +#terraform_version: "1.11.3" + +# --- + +hostname: "{{ inventory_hostname }}.{{ base_domain }}" # Change variable to fqdn diff --git a/infra-config/inventory.yml b/infra-config/inventory.yml index 3a0877d..74bf17d 100644 --- a/infra-config/inventory.yml +++ b/infra-config/inventory.yml @@ -19,6 +19,22 @@ freeipa: hosts: infra01: +prometheus: + hosts: + monitor: + +node_explorer: + hosts: + monitor: + +alertmanager: + hosts: + monitor: + +grafana: + hosts: + monitor: + ipaserver: hosts: infra01.int.mk-labs.cloud: diff --git a/infra-config/playbooks/add_dhcp_entry.yml b/infra-config/playbooks/add_dhcp_entry.yml index 68c8a2c..bbe98e1 100644 --- a/infra-config/playbooks/add_dhcp_entry.yml +++ b/infra-config/playbooks/add_dhcp_entry.yml @@ -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 diff --git a/infra-config/playbooks/add_dns_entry.yml b/infra-config/playbooks/add_dns_entry.yml index a2e775a..3f2529a 100644 --- a/infra-config/playbooks/add_dns_entry.yml +++ b/infra-config/playbooks/add_dns_entry.yml @@ -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 diff --git a/infra-config/playbooks/alertmanager.yml b/infra-config/playbooks/alertmanager.yml new file mode 100644 index 0000000..e69de29 diff --git a/infra-config/playbooks/set_hostname.yml b/infra-config/playbooks/set_hostname.yml index ede97e7..7e2a6ae 100644 --- a/infra-config/playbooks/set_hostname.yml +++ b/infra-config/playbooks/set_hostname.yml @@ -9,4 +9,3 @@ delegate_to: "{{ inventory_hostname }}" ansible.builtin.hostname: name: "{{ hostname }}" - #delay: 20 diff --git a/infra-config/playbooks/update-linux-os.yml b/infra-config/playbooks/update-linux-os.yml index 572f678..be0d79e 100644 --- a/infra-config/playbooks/update-linux-os.yml +++ b/infra-config/playbooks/update-linux-os.yml @@ -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: