Created Ansible templates for OpenShift nodes and cluster
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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 }}'
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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"
|
||||
|
||||
# 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"
|
||||
#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
|
||||
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_host_prefix: 23
|
||||
machine_network: "10.1.71.0/24"
|
||||
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 }}"
|
||||
|
||||
@@ -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"
|
||||
|
||||
# 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
|
||||
|
||||
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_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"
|
||||
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"
|
||||
54
infra-config/group_vars/openshift_cluster_template/vars
Normal file
54
infra-config/group_vars/openshift_cluster_template/vars
Normal 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 }}"
|
||||
@@ -1,13 +1,29 @@
|
||||
---
|
||||
# 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_mac_address: "54:bf:64:60:52:2d"
|
||||
primary_interface: "enp1s0f0"
|
||||
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 }}"
|
||||
|
||||
@@ -1,13 +1,29 @@
|
||||
---
|
||||
# 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_mac_address: "54:bf:64:5f:a2:80"
|
||||
primary_interface: "enp1s0f0"
|
||||
install_mac_address: "98:b7:85:20:47:3a"
|
||||
ip_address: 10.1.71.62
|
||||
node_role: "master"
|
||||
|
||||
# ---
|
||||
|
||||
hostname: "{{ inventory_hostname }}.{{ base_domain }}"
|
||||
|
||||
@@ -1,13 +1,29 @@
|
||||
---
|
||||
# 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_mac_address: "d8:9e:f3:4c:02:a9"
|
||||
primary_interface: "enp1s0f0"
|
||||
install_mac_address: "98:b7:85:1f:89:cf"
|
||||
ip_address: 10.1.71.63
|
||||
node_role: "master"
|
||||
|
||||
# ---
|
||||
|
||||
hostname: "{{ inventory_hostname }}.{{ base_domain }}"
|
||||
|
||||
@@ -1,13 +1,29 @@
|
||||
---
|
||||
# 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_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"
|
||||
|
||||
# ---
|
||||
|
||||
hostname: "{{ inventory_hostname }}.{{ base_domain }}"
|
||||
|
||||
29
infra-config/host_vars/openshift_node_template/vars
Normal file
29
infra-config/host_vars/openshift_node_template/vars
Normal 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
|
||||
Reference in New Issue
Block a user