From 8b528ed84aac3c8ff70611b892900df8aa2beb96 Mon Sep 17 00:00:00 2001 From: Raul Sevilla Date: Wed, 18 Sep 2024 00:14:24 +0200 Subject: [PATCH 01/10] Public VLAN improvements Signed-off-by: Raul Sevilla --- ansible/roles/create-inventory/tasks/main.yml | 5 +++ .../templates/inventory-mno.j2 | 11 ++++- ansible/vars/all.sample.yml | 4 +- docs/deploy-mno-performancelab.md | 31 +++++++++++--- docs/deploy-mno-scalelab.md | 41 ++++++++++++++----- 5 files changed, 73 insertions(+), 19 deletions(-) diff --git a/ansible/roles/create-inventory/tasks/main.yml b/ansible/roles/create-inventory/tasks/main.yml index 8bb05093..9260e9c4 100644 --- a/ansible/roles/create-inventory/tasks/main.yml +++ b/ansible/roles/create-inventory/tasks/main.yml @@ -47,6 +47,11 @@ ocpinventory_sno_nodes: [] ocpinventory_hv_nodes: [] +- name: Public VLAN - Configuring controlplane_network_interface_idx to the last interface + set_fact: + controlplane_network_interface_idx: "{{ ocpinventory.json.nodes[0].network.interfaces[0].mac | length - 1 }}" + when: public_vlan and cluster_type == "bm" + - name: Bare metal cluster and remote worker node cluster type tasks when: cluster_type == "mno" or cluster_type == "rwn" block: diff --git a/ansible/roles/create-inventory/templates/inventory-mno.j2 b/ansible/roles/create-inventory/templates/inventory-mno.j2 index 677d8565..72b4bea1 100644 --- a/ansible/roles/create-inventory/templates/inventory-mno.j2 +++ b/ansible/roles/create-inventory/templates/inventory-mno.j2 @@ -1,6 +1,15 @@ [all:vars] allocation_node_count={{ ocpinventory.json.nodes | length }} supermicro_nodes={{ has_supermicro | bool }} +{% if public_vlan %} +{% if lab_name == "scalelab" %} +base_dns_name=rdu2.scalelab.redhat.com +{% elif lab_name == "performancelab" %} +base_dns_name=rdu3.labs.perfscale.redhat.com +{% else %} +base_dns_name=example.com +{% endif %} +{% endif %} [bastion] {{ bastion_machine }} ansible_ssh_user=root bmc_address=mgmt-{{ bastion_machine }} @@ -32,7 +41,7 @@ dns2={{ labs[lab]['dns'][1] | default('') }} [worker] {% for worker in ocpinventory_worker_nodes %} -{{ worker.pm_addr.split('.')[0] | replace('mgmt-','') }} bmc_address={{ worker.pm_addr }} network_mac={{ worker.mac[controlplane_network_interface_idx] }} lab_mac={{ ( (mno_foreman_data.results| selectattr('json.name', 'eq', worker.pm_addr | replace('mgmt-',''))|first).json.interfaces | selectattr('primary', 'eq', True)|first).mac }} ip={{ controlplane_network | ansible.utils.nthhost(loop.index + mno_worker_node_offset) }} vendor={{ hw_vendor[(worker.pm_addr.split('.')[0]).split('-')[-1]] }} install_disk={{ worker_install_disk }} +{{ worker.pm_addr.split('.')[0] | replace('mgmt-','') }} bmc_address={{ worker.pm_addr }} network_mac={{ worker.mac[controlplane_network_interface_idx|int] }} lab_mac={{ ( (mno_foreman_data.results| selectattr('json.name', 'eq', worker.pm_addr | replace('mgmt-',''))|first).json.interfaces | selectattr('primary', 'eq', True)|first).mac }} ip={{ controlplane_network | ansible.utils.nthhost(loop.index + mno_worker_node_offset) }} vendor={{ hw_vendor[(worker.pm_addr.split('.')[0]).split('-')[-1]] }} install_disk={{ worker_install_disk }} {% endfor %} [worker:vars] diff --git a/ansible/vars/all.sample.yml b/ansible/vars/all.sample.yml index 94507c9b..08413d55 100644 --- a/ansible/vars/all.sample.yml +++ b/ansible/vars/all.sample.yml @@ -31,10 +31,12 @@ ocp_version: "latest-4.16" # Either "OVNKubernetes" or "OpenShiftSDN" (Only for MNO/RWN cluster types) networktype: OVNKubernetes -# Lab Network type, applies to sno cluster_type only +# Lab Network type, applies to sno and bm cluster_type only # Set this variable if you want to host your SNO cluster on lab public routable # VLAN network, set this ONLY if you have public routable VLAN enabled in your # scalelab cloud +# For bm clusters, enable this variable to autoconfigure controlplane_network_interface_idx and +# base_dns_name to the according values public_vlan: false # Enables FIPs security standard diff --git a/docs/deploy-mno-performancelab.md b/docs/deploy-mno-performancelab.md index 8fa933f0..1a870b51 100644 --- a/docs/deploy-mno-performancelab.md +++ b/docs/deploy-mno-performancelab.md @@ -6,11 +6,18 @@ Assuming you received an Performance lab allocation named `cloud99`, this guide _**Table of Contents**_ -- [Bastion setup](#bastion-setup) -- [Configure Ansible vars in `all.yml`](#configure-ansible-vars-in-allyml) -- [Review vars all.yml](#review-vars-allyml) -- [Run playbooks](#run-playbooks) -- [Monitor install and interact with cluster](#monitor-install-and-interact-with-cluster) +- [Deploy a Bare Metal cluster via Jetlag from a Performance Lab Bastion Machine quickstart](#deploy-a-bare-metal-cluster-via-jetlag-from-a-performance-lab-bastion-machine-quickstart) + - [Bastion setup](#bastion-setup) + - [Configure Ansible vars in `all.yml`](#configure-ansible-vars-in-allyml) + - [Lab \& cluster infrastructure vars](#lab--cluster-infrastructure-vars) + - [Bastion node vars](#bastion-node-vars) + - [OCP node vars](#ocp-node-vars) + - [Deploy in the public VLAN](#deploy-in-the-public-vlan) + - [Extra vars](#extra-vars) + - [Disconnected and ipv6 vars](#disconnected-and-ipv6-vars) + - [Review vars `all.yml`](#review-vars-allyml) + - [Run playbooks](#run-playbooks) + - [Monitor install and interact with cluster](#monitor-install-and-interact-with-cluster) -- [Bastion setup](#bastion-setup) -- [Configure Ansible vars in `all.yml`](#configure-ansible-vars-in-allyml) -- [Review vars all.yml](#review-vars-allyml) -- [Run playbooks](#run-playbooks) -- [Monitor install and interact with cluster](#monitor-install-and-interact-with-cluster) +- [Deploy a Multi Node OpenShift cluster via Jetlag from a Scale Lab Bastion Machine quickstart](#deploy-a-multi-node-openshift-cluster-via-jetlag-from-a-scale-lab-bastion-machine-quickstart) + - [Bastion setup](#bastion-setup) + - [Configure Ansible vars in `all.yml`](#configure-ansible-vars-in-allyml) + - [Lab \& cluster infrastructure vars](#lab--cluster-infrastructure-vars) + - [Bastion node vars](#bastion-node-vars) + - [OCP node vars](#ocp-node-vars) + - [Deploy in the public VLAN](#deploy-in-the-public-vlan) + - [Extra vars](#extra-vars) + - [Disconnected and ipv6 vars](#disconnected-and-ipv6-vars) + - [Review vars `all.yml`](#review-vars-allyml) + - [Run playbooks](#run-playbooks) + - [Monitor install and interact with cluster](#monitor-install-and-interact-with-cluster)