From efecef6832d5abe511201cdd2383ec379f6014b9 Mon Sep 17 00:00:00 2001 From: rblundon Date: Sat, 26 Jul 2025 14:51:44 -0500 Subject: [PATCH] Updated mac addresses and disabled boot interfaces --- infra-config/group_vars/internal_cluster/vars | 7 +- infra-config/host_vars/int-master01/vars | 5 +- infra-config/host_vars/int-master02/vars | 5 +- infra-config/host_vars/int-master03/vars | 5 +- infra-config/host_vars/int-worker02/vars | 3 +- .../configure_openshift_internal.yml | 108 +++++++++++------- .../playbooks/templates/agent-config.yaml.j2 | 5 + 7 files changed, 85 insertions(+), 53 deletions(-) diff --git a/infra-config/group_vars/internal_cluster/vars b/infra-config/group_vars/internal_cluster/vars index 14efe12..7e78b31 100644 --- a/infra-config/group_vars/internal_cluster/vars +++ b/infra-config/group_vars/internal_cluster/vars @@ -1,8 +1,9 @@ cluster_name: "openshift" cluster_version: "4.18.21" -openshift_installer_download_url: "https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/{{ cluster_version }}/openshift-install-linux.tar.gz" -openshift_client_download_url: "https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/{{ cluster_version }}/openshift-client-linux.tar.gz" -# cluster_group: "internal_cluster" +openshift_installer_file: "openshift-install-linux.tar.gz" +openshift_client_file: "openshift-client-linux.tar.gz" +openshift_installer_download_url: "https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/{{ cluster_version }}/{{ openshift_installer_file }}" +openshift_client_download_url: "https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/{{ cluster_version }}/{{ openshift_client_file }}" worker_node_count: 1 master_node_count: 3 cluster_network: "10.128.0.0/14" diff --git a/infra-config/host_vars/int-master01/vars b/infra-config/host_vars/int-master01/vars index b2a8f8b..a6c62fa 100644 --- a/infra-config/host_vars/int-master01/vars +++ b/infra-config/host_vars/int-master01/vars @@ -3,9 +3,10 @@ # OpenShift node # Networking -primary_interface: "enp1s0f0" +boot_interface: "enp0s31f6" boot_mac_address: "54:bf:64:60:52:2d" -install_mac_address: "00:0a:f7:5d:f3:53" +primary_interface: "enp1s0f0" +install_mac_address: "98:b7:85:20:47:22" ip_address: 10.1.71.61 node_role: "master" diff --git a/infra-config/host_vars/int-master02/vars b/infra-config/host_vars/int-master02/vars index ec39c5a..c3b00c6 100644 --- a/infra-config/host_vars/int-master02/vars +++ b/infra-config/host_vars/int-master02/vars @@ -3,9 +3,10 @@ # OpenShift node # Networking -primary_interface: "enp1s0f0" +boot_interface: "enp0s31f6" boot_mac_address: "54:bf:64:5f:a2:80" -install_mac_address: "98:b7:85:20:47:3b" +primary_interface: "enp1s0f0" +install_mac_address: "98:b7:85:20:47:3a" ip_address: 10.1.71.62 node_role: "master" diff --git a/infra-config/host_vars/int-master03/vars b/infra-config/host_vars/int-master03/vars index 984cce7..50578f1 100644 --- a/infra-config/host_vars/int-master03/vars +++ b/infra-config/host_vars/int-master03/vars @@ -3,9 +3,10 @@ # OpenShift node # Networking -primary_interface: "enp1s0f0" +boot_interface: "enp0s31f6" boot_mac_address: "d8:9e:f3:4c:02:a9" -install_mac_address: "98:b7:85:20:47:23" +primary_interface: "enp1s0f0" +install_mac_address: "98:b7:85:1f:89:cf" ip_address: 10.1.71.63 node_role: "master" diff --git a/infra-config/host_vars/int-worker02/vars b/infra-config/host_vars/int-worker02/vars index 8ccd7d3..6f2b544 100644 --- a/infra-config/host_vars/int-worker02/vars +++ b/infra-config/host_vars/int-worker02/vars @@ -3,8 +3,9 @@ # OpenShift node # Networking -primary_interface: "enp2s0f0" +boot_interface: "enp87s0" boot_mac_address: "58:47:ca:76:13:49" +primary_interface: "enp2s0f0" install_mac_address: "58:47:ca:76:13:47" ip_address: 10.1.71.65 node_role: "worker" diff --git a/infra-config/playbooks/configure_openshift_internal.yml b/infra-config/playbooks/configure_openshift_internal.yml index 951a3d7..24b4a1b 100644 --- a/infra-config/playbooks/configure_openshift_internal.yml +++ b/infra-config/playbooks/configure_openshift_internal.yml @@ -54,8 +54,14 @@ vars: cluster_group: "internal_cluster" + download_dir: "/var/cache/openshift-install" tasks: + - name: Remove previous directory + ansible.builtin.file: + path: ~/homelab/terraform/{{ cluster_group }} + state: absent + - name: Create directory ansible.builtin.file: path: ~/homelab/terraform/{{ cluster_group }} @@ -77,59 +83,75 @@ - name: Create directory for OpenShift Installer files become: true ansible.builtin.file: - path: /var/cache/openshift-install/{{ hostvars[groups[cluster_group][0]].cluster_version }} + path: "{{ download_dir }}/{{ hostvars[groups[cluster_group][0]].cluster_version }}" state: directory mode: '0755' owner: root group: root - - name: Download OpenShift Installer file - become: true - ansible.builtin.get_url: - url: "{{ hostvars[groups[cluster_group][0]].openshift_installer_download_url }}" - dest: /var/cache/openshift-install/{{ hostvars[groups[cluster_group][0]].cluster_version }} - mode: '0644' + - name: Check if OpenShift installer file exists + ansible.builtin.stat: + path: "{{ download_dir }}/{{ hostvars[groups[cluster_group][0]].cluster_version }}/{{ hostvars[groups[cluster_group][0]].openshift_installer_file }}" + register: openshift_installer_file - - name: Download OpenShift Client file - become: true - ansible.builtin.get_url: - url: "{{ hostvars[groups[cluster_group][0]].openshift_client_download_url }}" - dest: /var/cache/openshift-install/{{ hostvars[groups[cluster_group][0]].cluster_version }} - mode: '0644' + - name: Download and install OpenShift installer package + when: not openshift_installer_file.stat.exists + block: + - name: Download OpenShift Installer file + become: true + ansible.builtin.get_url: + url: "{{ hostvars[groups[cluster_group][0]].openshift_installer_download_url }}" + dest: /var/cache/openshift-install/{{ hostvars[groups[cluster_group][0]].cluster_version }} + mode: '0644' - - name: Unarchive installer file - become: true - ansible.builtin.unarchive: - src: /var/cache/openshift-install/{{ hostvars[groups[cluster_group][0]].cluster_version }}/openshift-install-linux.tar.gz - dest: /var/cache/openshift-install/{{ hostvars[groups[cluster_group][0]].cluster_version }} - remote_src: true + - name: Unarchive installer file + become: true + ansible.builtin.unarchive: + src: /var/cache/openshift-install/{{ hostvars[groups[cluster_group][0]].cluster_version }}/openshift-install-linux.tar.gz + dest: /var/cache/openshift-install/{{ hostvars[groups[cluster_group][0]].cluster_version }} + remote_src: true - - name: Unarchive client file - become: true - ansible.builtin.unarchive: - src: /var/cache/openshift-install/{{ hostvars[groups[cluster_group][0]].cluster_version }}/openshift-client-linux.tar.gz - dest: /var/cache/openshift-install/{{ hostvars[groups[cluster_group][0]].cluster_version }} - remote_src: true + - name: Copy install binary + become: true + ansible.builtin.copy: + src: /var/cache/openshift-install/{{ hostvars[groups[cluster_group][0]].cluster_version }}/openshift-install + dest: /usr/local/bin + remote_src: true + owner: wed + group: wed + mode: '0755' - - name: Copy install binary - become: true - ansible.builtin.copy: - src: /var/cache/openshift-install/{{ hostvars[groups[cluster_group][0]].cluster_version }}/openshift-install - dest: /usr/local/bin - remote_src: true - owner: wed - group: wed - mode: '0755' + - name: Check if OpenShift client file exists + ansible.builtin.stat: + path: "{{ download_dir }}/{{ hostvars[groups[cluster_group][0]].cluster_version }}/{{ hostvars[groups[cluster_group][0]].openshift_client_file }}" + register: openshift_client_file - - name: Copy client binary - become: true - ansible.builtin.copy: - src: /var/cache/openshift-install/{{ hostvars[groups[cluster_group][0]].cluster_version }}/oc - dest: /usr/local/bin - remote_src: true - owner: wed - group: wed - mode: '0755' + - name: Download and install OpenShift client package + when: not openshift_client_file.stat.exists + block: + - name: Download OpenShift Client file + become: true + ansible.builtin.get_url: + url: "{{ hostvars[groups[cluster_group][0]].openshift_client_download_url }}" + dest: /var/cache/openshift-install/{{ hostvars[groups[cluster_group][0]].cluster_version }} + mode: '0644' + + - name: Unarchive client file + become: true + ansible.builtin.unarchive: + src: /var/cache/openshift-install/{{ hostvars[groups[cluster_group][0]].cluster_version }}/openshift-client-linux.tar.gz + dest: /var/cache/openshift-install/{{ hostvars[groups[cluster_group][0]].cluster_version }} + remote_src: true + + - name: Copy client binary + become: true + ansible.builtin.copy: + src: /var/cache/openshift-install/{{ hostvars[groups[cluster_group][0]].cluster_version }}/oc + dest: /usr/local/bin + remote_src: true + owner: wed + group: wed + mode: '0755' - name: Check if OpenShift image exists ansible.builtin.stat: diff --git a/infra-config/playbooks/templates/agent-config.yaml.j2 b/infra-config/playbooks/templates/agent-config.yaml.j2 index e883030..82c2cde 100644 --- a/infra-config/playbooks/templates/agent-config.yaml.j2 +++ b/infra-config/playbooks/templates/agent-config.yaml.j2 @@ -21,6 +21,11 @@ hosts: ipv4: enabled: true dhcp: true + - name: {{ hostvars[host].boot_interface }} + type: ethernet + state: down + identifier: mac-address + mac-address: {{ hostvars[host].boot_mac_address }} dns-resolver: config: server: