Created Ansible templates for OpenShift nodes and cluster

This commit is contained in:
2025-07-26 21:14:15 -05:00
parent fc31dd2a5a
commit 8293c842e6
17 changed files with 273 additions and 204 deletions

View File

@@ -20,20 +20,20 @@ This implementation is built on easily accessible consumer based hardware and wi
3. **[Core Services Setup](./docs/03-core-services.md)** *(TBD)* - k0s cluster, DNS, monitoring 3. **[Core Services Setup](./docs/03-core-services.md)** *(TBD)* - k0s cluster, DNS, monitoring
4. **[Storage Configuration](./docs/04-storage.md)** *(TBD)* - Synology, democratic-csi 4. **[Storage Configuration](./docs/04-storage.md)** *(TBD)* - Synology, democratic-csi
### Phase 2: Container Platform ### Phase 2: Proxmox Platform
5. **[Container Registry Setup](./docs/05-container-registry.md)** *(TBD)* - Harbor deployment 11. **[Proxmox Installation](./docs/11-vsphere-setup.md)** *(TBD)* - Dell 7050 virtualization
6. **[Git Repository Setup](./docs/06-git-repository.md)** *(TBD)* - Gitea/GitLab on Synology 12. **[Windows Infrastructure](./docs/12-windows-infrastructure.md)** *(TBD)* - AD, SQL Server
7. **[Artifact Repository](./docs/07-artifact-repository.md)** *(TBD)* - Nexus/Artifactory 13. **[VM Templates & Automation](./docs/13-vm-automation.md)** *(TBD)* - Template creation
### Phase 3: OpenShift Clusters ### Phase 3: OpenShift Clusters
8. **[OpenShift Compact Cluster](./docs/08-openshift-compact.md)** *(TBD)* - 3-node production-like 8. **[OpenShift Compact Cluster](./docs/08-openshift-compact.md)** *(TBD)* - 3-node production-like
9. **[OpenShift SNO + Worker](./docs/09-openshift-sno.md)** *(TBD)* - Edge computing setup 9. **[OpenShift SNO + Worker](./docs/09-openshift-sno.md)** *(TBD)* - Edge computing setup
10. **[ACM Configuration](./docs/10-acm-setup.md)** *(TBD)* - Multi-cluster management 10. **[ACM Configuration](./docs/10-acm-setup.md)** *(TBD)* - Multi-cluster management
### Phase 4: vSphere Platform ### Phase 4: Container Platform
11. **[vSphere Installation](./docs/11-vsphere-setup.md)** *(TBD)* - Dell T640 virtualization 5. **[Container Registry Setup](./docs/05-container-registry.md)** *(TBD)* - Harbor deployment
12. **[Windows Infrastructure](./docs/12-windows-infrastructure.md)** *(TBD)* - AD, SQL Server 6. **[Git Repository Setup](./docs/06-git-repository.md)** *(TBD)* - Gitea/GitLab on Synology
13. **[VM Templates & Automation](./docs/13-vm-automation.md)** *(TBD)* - Template creation 7. **[Artifact Repository](./docs/07-artifact-repository.md)** *(TBD)* - Nexus/Artifactory
### Phase 5: Advanced Services ### Phase 5: Advanced Services
14. **[Monitoring & Observability](./docs/14-monitoring.md)** *(TBD)* - Prometheus, Grafana, Splunk 14. **[Monitoring & Observability](./docs/14-monitoring.md)** *(TBD)* - Prometheus, Grafana, Splunk
@@ -43,7 +43,7 @@ This implementation is built on easily accessible consumer based hardware and wi
## 🚀 Quick Start Deployment ## 🚀 Quick Start Deployment
### Prerequisites ### Prerequisites
- Ubiquiti UDM SE configured - Ubiquiti UDM Pro configured
- Hardware powered and networked - Hardware powered and networked
- Initial VLAN setup (see [networking plan](./docs/02-networking.md)) - Initial VLAN setup (see [networking plan](./docs/02-networking.md))
@@ -73,17 +73,17 @@ source ~/venv-ansible/bin/activate
## 📁 Repository Structure ## 📁 Repository Structure
``` ```
homelab-plan/ homelab/
├── README.md # This file ├── README.md # This file
├── docs/ # Documentation (numbered by priority) ├── docs/ # Documentation (numbered by priority)
│ ├── 01-overview.md │ ├── 01-overview.md
│ ├── 02-networking.md │ ├── 02-networking.md
│ └── ... │ └── ...
├── deployment/ # Deployment configurations ├── deployment/ # Deployment configurations
│ ├── synology/ # Docker Compose files for Synology │ ├── synology/ # Docker Compose files for Synology
│ ├── k0s/ # k0s cluster manifests │ ├── k0s/ # k0s cluster manifests
│ ├── openshift/ # OpenShift installation configs │ ├── openshift/ # OpenShift installation configs
│ └── vsphere/ # vSphere automation │ └── proxmox/ # Proxmox automation
├── scripts/ # Automation scripts ├── scripts/ # Automation scripts
└── .gitignore # Excludes sensitive data └── .gitignore # Excludes sensitive data
``` ```

View File

@@ -1,7 +0,0 @@
# Configure the OpenShift Agent Installer and Matchbox
## Reference Document
<https://docs.redhat.com/en/documentation/openshift_container_platform/4.17/epub/installing_an_on-premise_cluster_with_the_agent-based_installer/prepare-pxe-assets-agent#prepare-pxe-assets-agent>
Recap of image creation is in 10-sno-hub-cluster/02-matchbox/.openshift_install.log

View File

@@ -1,5 +0,0 @@
---
- name: OpenShift image creation
ansible.builtin.command: /usr/local/bin/openshift-install agent create pxe-files
args:
chdir: 03-openshift-image

View File

@@ -1,16 +0,0 @@
---
- name: Create a directory if it does not exist
ansible.builtin.file:
path: "{{ hostvars[groups['matchbox'][0]].assets }}/{{ hostvars[groups['hub_cluster'][0]].cluster_name }}"
state: directory
mode: '0755'
become: true
- name: Copy file with owner and permissions
ansible.builtin.copy:
src: 03-openshift-image/boot-artifacts/
dest: "{{ hostvars[groups['matchbox'][0]].assets }}/{{ hostvars[groups['hub_cluster'][0]].cluster_name }}/"
owner: matchbox
group: matchbox
mode: '0644'
become: true

View File

@@ -1,33 +0,0 @@
apiVersion: v1alpha1
kind: AgentConfig
metadata:
name: {{ hostvars[groups['hub_cluster'][0]].cluster_name }}
rendezvousIP: {{ hostvars['ocp-hub'].ip_address }}
bootArtifactsBaseURL: {{ hostvars[groups['matchbox'][0]].http_endpoint }}/assets/hub/
hosts:
- hostname: {{ hostvars['ocp-hub'].hostname }}
role: master
interfaces:
- name: {{ hostvars['ocp-hub'].primary_interface }}
macAddress: {{ hostvars['ocp-hub'].mac_address }}
networkConfig:
interfaces:
- name: {{ hostvars['ocp-hub'].primary_interface }}
type: ethernet
state: up
identifier: mac-address
mac-address: {{ hostvars['ocp-hub'].mac_address }}
ipv4:
enabled: true
dhcp: true
dns-resolver:
config:
server:
- 10.1.71.251
- 10.1.71.252
routes:
config:
- destination: 0.0.0.0/0
next-hop-address: 10.1.71.1
next-hop-interface: {{ hostvars['ocp-hub'].primary_interface }}
table-id: 254

View File

@@ -1,25 +0,0 @@
apiVersion: v1
baseDomain: {{ hostvars[groups['hub_cluster'][0]].base_domain }}
compute:
- name: worker
replicas: {{ hostvars[groups['hub_cluster'][0]].worker_node_count }}
controlPlane:
hyperthreading: Enabled
name: master
replicas: {{ hostvars[groups['hub_cluster'][0]].master_node_count }}
metadata:
name: {{ hostvars[groups['hub_cluster'][0]].cluster_name }}
networking:
clusterNetwork:
- cidr: {{ hostvars[groups['hub_cluster'][0]].cluster_network }}
hostPrefix: {{ hostvars[groups['hub_cluster'][0]].cluster_network_host_prefix }}
machineNetwork:
- cidr: {{ hostvars[groups['hub_cluster'][0]].machine_network }}
networkType: OVNKubernetes
serviceNetwork:
- {{ hostvars[groups['hub_cluster'][0]].service_network }}
platform:
{{ hostvars[groups['hub_cluster'][0]].platform_type }}: {}
fips: false
pullSecret: '{{ vault_pull_secret }}'
sshKey: '{{ vault_ssh_key }}'

View File

@@ -1,13 +0,0 @@
---
- name: Run all tasks necessary to configure matchbox to install the cluster
hosts: matchbox
connection: local
gather_facts: true
tasks:
- name: Clone Git repository
ansible.builtin.git:
repo: "https://github.com/redhatryan/acm-hub-bootstrap.git"
dest: 05-bootstrap-acm
version: main
become: true

View File

@@ -1,62 +0,0 @@
---
- name: Run all tasks necessary to configure matchbox to install the cluster
hosts: matchbox
connection: local
gather_facts: true
tasks:
# - name: Deploy DNS entries for cluster via Terraform
# community.general.terraform:
# project_path: 01-dns/
# variables:
# freeipa_password: "{{ vault_freeipa_password }}"
# state: present
# force_init: true
# - name: Deploy DHCP entries for cluster via Terraform
# ansible.builtin.include_tasks:
# file: 02-dhcp/ip-reservations.yml
# - name: OpenShift Installer install-config.yaml
# ansible.builtin.template:
# src: 03-openshift-image/templates/install-config.yaml.j2
# dest: 03-openshift-image/install-config.yaml
# mode: '0644'
# - name: OpenShift Installer agent-config.yaml
# ansible.builtin.template:
# src: 03-openshift-image/templates/agent-config.yaml.j2
# dest: 03-openshift-image/agent-config.yaml
# mode: '0644'
# - name: Create OpenShift image
# ansible.builtin.include_tasks:
# file: 03-openshift-image/create-openshift-image.yml
# - name: Move PXE assets to matchbox
# ansible.builtin.include_tasks:
# file: 03-openshift-image/move-pxe-assets.yml
# - name: Terraform matchbox groups file
# ansible.builtin.template:
# src: 04-matchbox/templates/groups.tf.j2
# dest: 04-matchbox/groups.tf
# mode: '0644'
# - name: Terraform matchbox profiles file
# ansible.builtin.template:
# src: 04-matchbox/templates/profiles.tf.j2
# dest: 04-matchbox/profiles.tf
# mode: '0644'
# - name: Terraform matchbox provider file
# ansible.builtin.template:
# src: 04-matchbox/templates/provider.tf.j2
# dest: 04-matchbox/provider.tf
# mode: '0644'
# - name: Configure Matchbox via Terraform
# community.general.terraform:
# project_path: 04-matchbox/
# state: present
# force_init: true

View File

@@ -1,10 +1,54 @@
# file: group_vars/hub_cluster/vars
# Ansible vars template for OpenShift nodes created via Ansible (configure_openshift_cluster).
# Cluster deployed via Agent Installer and Matchbox (iPXE):
# Role of this node in the cluster.
# - master
# - worker
# Name of the OpenShift Cluster
cluster_name: "hub" cluster_name: "hub"
# Version of OpenShift to install. All available versions can be found at: https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/
cluster_version: "4.17.20" cluster_version: "4.17.20"
#base_domain: "int.mk-labs.cloud"
worker_node_count: 0 # Type of cluster.
# - none (Single Node Cluster)
# - baremetal (Traditional and Compact Cluster)
platform_type: "none"
# Number of nodes to deploy
# - Master: 1; Worker 0 (Single Node Cluster)
# - Master: 3; Worker 0 (Compact Cluster)
# - Master: 3; Worker 1-3 (Traditional Cluster)
master_node_count: 1 master_node_count: 1
worker_node_count: 0
# Subnet that cluster nodes will reside on.
machine_network: "10.1.71.0/24"
# OpenShift API IP Address (Comment out for Single Node Cluster)
# api_address: "10.1.71.10"
# OpenShift Apps Wildcard IP Address (Comment out for Single Node Cluster)
# app_address: "10.1.71.10"
# These are internal networks to the cluster and should not need to be changed.
cluster_network: "10.128.0.0/14" cluster_network: "10.128.0.0/14"
cluster_network_host_prefix: 23 cluster_network_host_prefix: 23
machine_network: "10.1.71.0/24"
service_network: "172.30.0.0/16" service_network: "172.30.0.0/16"
platform_type: "none"
# Static Variables
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 }}"

View File

@@ -1,15 +1,54 @@
# file: group_vars/internal_cluster/vars
# Ansible vars template for OpenShift nodes created via Ansible (configure_openshift_cluster).
# Cluster deployed via Agent Installer and Matchbox (iPXE):
# Role of this node in the cluster.
# - master
# - worker
# Name of the OpenShift Cluster
cluster_name: "openshift" cluster_name: "openshift"
# Version of OpenShift to install. All available versions can be found at: https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/
cluster_version: "4.18.21" cluster_version: "4.18.21"
# Type of cluster.
# - none (Single Node Cluster)
# - baremetal (Traditional and Compact Cluster)
platform_type: "baremetal"
# Number of nodes to deploy
# - Master: 1; Worker 0 (Single Node Cluster)
# - Master: 3; Worker 0 (Compact Cluster)
# - Master: 3; Worker 1-3 (Traditional Cluster)
master_node_count: 3
worker_node_count: 1
# Subnet that cluster nodes will reside on.
machine_network: "10.1.71.0/24"
# OpenShift API IP Address
api_address: "10.1.71.69"
# OpenShift Apps Wildcard IP Address (These will be the same in a Single Node Cluster)
app_address: "10.1.71.60"
# These are internal networks to the cluster and should not need to be changed.
cluster_network: "10.128.0.0/14"
cluster_network_host_prefix: 23
service_network: "172.30.0.0/16"
# Static Variables
openshift_installer_file: "openshift-install-linux.tar.gz" openshift_installer_file: "openshift-install-linux.tar.gz"
openshift_client_file: "openshift-client-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_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 }}" 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"
cluster_network_host_prefix: 23
machine_network: "10.1.71.0/24"
service_network: "172.30.0.0/16"
platform_type: "baremetal"
api_address: "10.1.71.69"
app_address: "10.1.71.60"

View File

@@ -0,0 +1,54 @@
# file: group_vars/openshift_cluster_template/vars
# Ansible vars template for OpenShift nodes created via Ansible (configure_openshift_cluster).
# Cluster deployed via Agent Installer and Matchbox (iPXE):
# Role of this node in the cluster.
# - master
# - worker
# Name of the OpenShift Cluster
cluster_name: "openshift"
# Version of OpenShift to install. All available versions can be found at: https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/
cluster_version: "4.18.21"
# Type of cluster.
# - none (Single Node Cluster)
# - baremetal (Traditional and Compact Cluster)
platform_type: "baremetal"
# Number of nodes to deploy
# - Master: 1; Worker 0 (Single Node Cluster)
# - Master: 3; Worker 0 (Compact Cluster)
# - Master: 3; Worker 1-3 (Traditional Cluster)
master_node_count: 3
worker_node_count: 1
# Subnet that cluster nodes will reside on.
machine_network: "10.1.71.0/24"
# OpenShift API IP Address (Comment out for Single Node Cluster)
api_address: "10.1.71.69"
# OpenShift Apps Wildcard IP Address (Comment out for Single Node Cluster)
app_address: "10.1.71.60"
# These are internal networks to the cluster and should not need to be changed.
cluster_network: "10.128.0.0/14"
cluster_network_host_prefix: 23
service_network: "172.30.0.0/16"
# Static Variables
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 }}"

View File

@@ -1,13 +1,29 @@
--- ---
# file: host_vars/int-master01/vars # file: host_vars/int-master01/vars
# OpenShift node # Ansible vars template for OpenShift nodes created via Ansible (configure_openshift_cluster).
# Cluster deployed via Agent Installer and Matchbox (iPXE):
# Role of this node in the cluster.
# - master
# - worker
node_role: "master"
# IP address assigned to this node on the Primary Interface
ip_address: 10.1.71.61
# Ansible Playbook supports booting node via one interface, but installing on a
# different interface. (Disabling the boot interface on install) All these fields
# are necessary. In the case of a single NIC node, interfaces and MAC addresses
# should be the same.
# Networking
boot_interface: "enp0s31f6" boot_interface: "enp0s31f6"
boot_mac_address: "54:bf:64:60:52:2d" boot_mac_address: "54:bf:64:60:52:2d"
primary_interface: "enp1s0f0" primary_interface: "enp1s0f0"
install_mac_address: "98:b7:85:20:47:22" install_mac_address: "98:b7:85:20:47:22"
ip_address: 10.1.71.61
node_role: "master" # Static Variables
hostname: "{{ inventory_hostname }}.{{ base_domain }}" hostname: "{{ inventory_hostname }}.{{ base_domain }}"

View File

@@ -1,13 +1,29 @@
--- ---
# file: host_vars/int-master02/vars # file: host_vars/int-master02/vars
# OpenShift node # Ansible vars template for OpenShift nodes created via Ansible (configure_openshift_cluster).
# Cluster deployed via Agent Installer and Matchbox (iPXE):
# Role of this node in the cluster.
# - master
# - worker
node_role: "master"
# IP address assigned to this node on the Primary Interface
ip_address: 10.1.71.62
# Ansible Playbook supports booting node via one interface, but installing on a
# different interface. (Disabling the boot interface on install) All these fields
# are necessary. In the case of a single NIC node, interfaces and MAC addresses
# should be the same.
# Networking
boot_interface: "enp0s31f6" boot_interface: "enp0s31f6"
boot_mac_address: "54:bf:64:5f:a2:80" boot_mac_address: "54:bf:64:5f:a2:80"
primary_interface: "enp1s0f0" primary_interface: "enp1s0f0"
install_mac_address: "98:b7:85:20:47:3a" install_mac_address: "98:b7:85:20:47:3a"
ip_address: 10.1.71.62
node_role: "master" # ---
hostname: "{{ inventory_hostname }}.{{ base_domain }}" hostname: "{{ inventory_hostname }}.{{ base_domain }}"

View File

@@ -1,13 +1,29 @@
--- ---
# file: host_vars/int-master03/vars # file: host_vars/int-master03/vars
# OpenShift node # Ansible vars template for OpenShift nodes created via Ansible (configure_openshift_cluster).
# Cluster deployed via Agent Installer and Matchbox (iPXE):
# Role of this node in the cluster.
# - master
# - worker
node_role: "master"
# IP address assigned to this node on the Primary Interface
ip_address: 10.1.71.63
# Ansible Playbook supports booting node via one interface, but installing on a
# different interface. (Disabling the boot interface on install) All these fields
# are necessary. In the case of a single NIC node, interfaces and MAC addresses
# should be the same.
# Networking
boot_interface: "enp0s31f6" boot_interface: "enp0s31f6"
boot_mac_address: "d8:9e:f3:4c:02:a9" boot_mac_address: "d8:9e:f3:4c:02:a9"
primary_interface: "enp1s0f0" primary_interface: "enp1s0f0"
install_mac_address: "98:b7:85:1f:89:cf" install_mac_address: "98:b7:85:1f:89:cf"
ip_address: 10.1.71.63
node_role: "master" # ---
hostname: "{{ inventory_hostname }}.{{ base_domain }}" hostname: "{{ inventory_hostname }}.{{ base_domain }}"

View File

@@ -1,13 +1,29 @@
--- ---
# file: host_vars/int-worker02/vars # file: host_vars/int-worker02/vars
# OpenShift node # Ansible vars template for OpenShift nodes created via Ansible (configure_openshift_cluster).
# Cluster deployed via Agent Installer and Matchbox (iPXE):
# Role of this node in the cluster.
# - master
# - worker
node_role: "worker"
# IP address assigned to this node on the Primary Interface
ip_address: 10.1.71.65
# Ansible Playbook supports booting node via one interface, but installing on a
# different interface. (Disabling the boot interface on install) All these fields
# are necessary. In the case of a single NIC node, interfaces and MAC addresses
# should be the same.
# Networking
boot_interface: "enp87s0" boot_interface: "enp87s0"
boot_mac_address: "58:47:ca:76:13:49" boot_mac_address: "58:47:ca:76:13:49"
primary_interface: "enp2s0f0" primary_interface: "enp2s0f0"
install_mac_address: "58:47:ca:76:13:47" install_mac_address: "58:47:ca:76:13:47"
ip_address: 10.1.71.65
node_role: "worker" # ---
hostname: "{{ inventory_hostname }}.{{ base_domain }}" hostname: "{{ inventory_hostname }}.{{ base_domain }}"

View File

@@ -0,0 +1,29 @@
---
# file: host_vars/openshift_node_template/vars
# Ansible vars template for OpenShift nodes created via Ansible (configure_openshift_cluster).
# Cluster deployed via Agent Installer and Matchbox (iPXE):
# Role of this node in the cluster.
# - master
# - worker
node_role: "master"
# IP address assigned to this node on the Primary Interface
ip_address: 10.1.71.61
# Ansible Playbook supports booting node via one interface, but installing on a
# different interface. (Disabling the boot interface on install) All these fields
# are necessary. In the case of a single NIC node, interfaces and MAC addresses
# should be the same.
boot_interface: "enp0s31f6"
boot_mac_address: "54:bf:64:60:52:2d"
primary_interface: "enp1s0f0"
install_mac_address: "98:b7:85:20:47:22"
# Static Variables
hostname: "{{ inventory_hostname }}.{{ base_domain }}" # Change variable to fqdn