From 9e7b4389b30f24eb875468e04f8985cbe7153454 Mon Sep 17 00:00:00 2001 From: shhull Date: Thu, 23 May 2024 11:37:48 +0800 Subject: [PATCH 1/2] [cloud_infra_center] Add RoCE support for OCP UPI Signed-off-by: shhull --- .../cloud_infra_center/ocp_upi/README.md | 4 +- .../cloud_infra_center/ocp_upi/bastion.yaml | 19 +++++ .../ocp_upi/configure-dhcp.yaml | 31 ++++++++ .../ocp_upi/dhcp_template.yaml | 22 ++++++ .../tasks/main.yaml | 5 ++ .../roles/configure-dhcp/tasks/main.yaml | 60 ++++++++++++++ .../templates/etc/dhcp/dhcpd.conf.j2 | 29 +++++++ .../roles/configure-pre-check/tasks/main.yaml | 11 +++ .../ocp_upi/tools/modify-dhcp.py | 79 +++++++++++++++++++ 9 files changed, 258 insertions(+), 2 deletions(-) create mode 100644 z_infra_provisioning/cloud_infra_center/ocp_upi/configure-dhcp.yaml create mode 100644 z_infra_provisioning/cloud_infra_center/ocp_upi/dhcp_template.yaml create mode 100644 z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-dhcp/tasks/main.yaml create mode 100644 z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-dhcp/templates/etc/dhcp/dhcpd.conf.j2 create mode 100644 z_infra_provisioning/cloud_infra_center/ocp_upi/tools/modify-dhcp.py diff --git a/z_infra_provisioning/cloud_infra_center/ocp_upi/README.md b/z_infra_provisioning/cloud_infra_center/ocp_upi/README.md index 9009a5823..a41dd8e02 100644 --- a/z_infra_provisioning/cloud_infra_center/ocp_upi/README.md +++ b/z_infra_provisioning/cloud_infra_center/ocp_upi/README.md @@ -244,9 +244,9 @@ If you meet any **not running** service or **failed** message, check the IBM Clo 9. Set Subnet DNS **Note**: ->1.Network type `DHCP` is mandatory for KVM. +>1.Network type `DHCP` is mandatory for KVM, but when deploying OCP with RoCE networking, DHCP is not a requirement. > ->2.This step is required for KVM, z/VM is optional. +>2.This step is required for KVM (not required for RoCE networking), z/VM is optional. During deployment, the OpenShift nodes will need to be able to resolve public name records to download the OpenShift images and so on. They will also need to resolve the OpenStack API endpoint. diff --git a/z_infra_provisioning/cloud_infra_center/ocp_upi/bastion.yaml b/z_infra_provisioning/cloud_infra_center/ocp_upi/bastion.yaml index 833193bf6..c85d4cc19 100644 --- a/z_infra_provisioning/cloud_infra_center/ocp_upi/bastion.yaml +++ b/z_infra_provisioning/cloud_infra_center/ocp_upi/bastion.yaml @@ -10,3 +10,22 @@ --- - import_playbook: configure-dns.yaml - import_playbook: configure-haproxy.yaml + +- name: 'Configure DHCP' + hosts: localhost + tasks: + - name: 'Get Network physical_network' + ansible.builtin.shell: + cmd: "openstack network show -c provider:physical_network -f value {{ use_network_name }}" + register: physical_network_out + - name: Set fact physical_network + ansible.builtin.set_fact: + physical_network: "{{ physical_network_out.stdout }}" + +- name: 'Configure DHCP on bastion' + hosts: bastion + tasks: + - name: 'Get Network physical_network' + include_role: + name: configure-dhcp + when: hostvars['localhost']['physical_network'] == "macvtap0" \ No newline at end of file diff --git a/z_infra_provisioning/cloud_infra_center/ocp_upi/configure-dhcp.yaml b/z_infra_provisioning/cloud_infra_center/ocp_upi/configure-dhcp.yaml new file mode 100644 index 000000000..4b325dc5c --- /dev/null +++ b/z_infra_provisioning/cloud_infra_center/ocp_upi/configure-dhcp.yaml @@ -0,0 +1,31 @@ +# ================================================================= +# Copyright 2024 https://github.com/multi-arch/multiarch-ci-playbooks +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ================================================================= + +# ================================================================= +# Licensed Materials - Property of IBM +# +# (c) Copyright IBM Corp. 2024 All Rights Reserved +# +# US Government Users Restricted Rights - Use, duplication or +# disclosure restricted by GSA ADP Schedule Contract with IBM Corp. +# ================================================================= +# + +--- +- name: Configure dns on bastion + hosts: bastion + roles: + - configure-dhcp \ No newline at end of file diff --git a/z_infra_provisioning/cloud_infra_center/ocp_upi/dhcp_template.yaml b/z_infra_provisioning/cloud_infra_center/ocp_upi/dhcp_template.yaml new file mode 100644 index 000000000..c97882948 --- /dev/null +++ b/z_infra_provisioning/cloud_infra_center/ocp_upi/dhcp_template.yaml @@ -0,0 +1,22 @@ +static_hosts: + bootstrap: + mac: "00:11:22:33:44:55" + ip: "10.1.0.10" + master-0: + mac: "00:11:22:33:44:56" + ip: "10.1.0.11" + master-1: + mac: "00:11:22:33:44:57" + ip: "10.1.0.12" + master-2: + mac: "00:11:22:33:44:58" + ip: "10.1.0.13" + worker-0: + mac: "00:11:22:33:44:59" + ip: "10.1.0.14" + worker-1: + mac: "00:11:22:33:44:60" + ip: "10.1.0.15" + worker-2: + mac: "00:11:22:33:44:61" + ip: "10.1.0.16" \ No newline at end of file diff --git a/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-bastion-properties/tasks/main.yaml b/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-bastion-properties/tasks/main.yaml index ff4befb05..39f115017 100644 --- a/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-bastion-properties/tasks/main.yaml +++ b/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-bastion-properties/tasks/main.yaml @@ -14,3 +14,8 @@ ansible.builtin.script: tools/modify-bastion.py args: executable: python3 + +- name: 'Get Nodes IP, MAC address and store into yaml file' + ansible.builtin.script: tools/modify-dhcp.py + args: + executable: python3 \ No newline at end of file diff --git a/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-dhcp/tasks/main.yaml b/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-dhcp/tasks/main.yaml new file mode 100644 index 000000000..825450e54 --- /dev/null +++ b/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-dhcp/tasks/main.yaml @@ -0,0 +1,60 @@ +# ================================================================= +# Copyright 2024 https://github.com/multi-arch/multiarch-ci-playbooks +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ================================================================== + +--- +# tasks file for configure-dhcp +- ansible.builtin.include_vars: dhcp_template.yaml + +- name: 'Remove the /etc/dhcp/dhcpd.conf' + ansible.builtin.file: + state: absent + path: /etc/dhcp/dhcpd.conf + +- name: Install DHCP server package + package: + name: dhcp-server.s390x + state: present + become: true + +- name: Configure dhcpd.conf file + template: + src: etc/dhcp/dhcpd.conf.j2 + dest: /etc/dhcp/dhcpd.conf + +- name: Get the subnet range from localhost + ansible.builtin.set_fact: + subnet_range: "{{ lookup('file', '.subnet_range.yml') }}" + +- name: Set_fact for the the subnet range + ansible.builtin.set_fact: + cluster_subnet_range: "{{ subnet_range | regex_replace('/.*', '') }}" + +- name: Convert CIDR to netmask + ansible.builtin.set_fact: + netmask_result: "{{ subnet_range | ipaddr('netmask') }}" + +- name: Update cluster_subnet_range + ansible.builtin.shell: + cmd: sed -i "s|dhcp_subnet| {{ cluster_subnet_range }} |g" /etc/dhcp/dhcpd.conf + +- name: Update cic_subnet_mask + ansible.builtin.shell: + cmd: sed -i "s|cic_subnet_mask|{{ netmask_result }}|g" /etc/dhcp/dhcpd.conf + +- name: restart dhcpd + service: + name: dhcpd + state: restarted \ No newline at end of file diff --git a/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-dhcp/templates/etc/dhcp/dhcpd.conf.j2 b/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-dhcp/templates/etc/dhcp/dhcpd.conf.j2 new file mode 100644 index 000000000..16fa65bf6 --- /dev/null +++ b/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-dhcp/templates/etc/dhcp/dhcpd.conf.j2 @@ -0,0 +1,29 @@ +# Global options +option domain-name "{{ cluster_name }}.{{ base_domain }}"; +option domain-name-servers {{ os_dns_domain }},{{ dns_forwarder }}; + +default-lease-time 600; +max-lease-time 7200; + +ddns-update-style interim; +ignore client-updates; +allow booting; +allow bootp; +log-facility local7; + +# Subnet configuration +subnet dhcp_subnet netmask cic_subnet_mask { + # Default gateway + option routers {{ dns_forwarder }}; + option subnet-mask cic_subnet_mask; + option time-offset -18000; +} + +# Static IP assignments +{% for host, info in static_hosts.items() %} +host {{ host }} { + hardware ethernet {{ info.mac }}; + fixed-address {{ info.ip }}; + option domain-name-servers {{ os_dns_domain }},{{ dns_forwarder }}; +} +{% endfor %} \ No newline at end of file diff --git a/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-pre-check/tasks/main.yaml b/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-pre-check/tasks/main.yaml index 81a474307..e059cc334 100644 --- a/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-pre-check/tasks/main.yaml +++ b/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-pre-check/tasks/main.yaml @@ -47,12 +47,22 @@ register: icic_token failed_when: icic_token.stdout == "" +- name: 'Get Network physical_network' + ansible.builtin.shell: + cmd: "openstack network show -c provider:physical_network -f value {{ use_network_name }}" + register: physical_network_out + +- name: Set fact physical_network + ansible.builtin.set_fact: + physical_network: "{{ physical_network_out.stdout }}" + - name: Get validate subnet DNS ansible.builtin.shell: openstack subnet show -f shell {{ use_network_subnet }} | grep 'dns_nameservers' | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}" | head -n 1 register: icic_subnet_dns failed_when: - icic_subnet_dns.stdout == "" - vm_type == "kvm" + - physical_network != "macvtap0" - name: Check subnet DNS is required for KVM, z/VM is optional ansible.builtin.fail: @@ -60,6 +70,7 @@ failed_when: - vm_type == "kvm" - icic_subnet_dns.stdout != os_dns_domain + - physical_network != "macvtap0" - name: Get nova api url ansible.builtin.shell: openstack catalog show -f json nova | jq -r '.endpoints[] | "\(.url)"' | head -n 1 diff --git a/z_infra_provisioning/cloud_infra_center/ocp_upi/tools/modify-dhcp.py b/z_infra_provisioning/cloud_infra_center/ocp_upi/tools/modify-dhcp.py new file mode 100644 index 000000000..1af4fd97f --- /dev/null +++ b/z_infra_provisioning/cloud_infra_center/ocp_upi/tools/modify-dhcp.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python +# ================================================================= +# Licensed Materials - Property of IBM +# +# (c) Copyright IBM Corp. 2021 All Rights Reserved +# +# US Government Users Restricted Rights - Use, duplication or +# disclosure restricted by GSA ADP Schedule Contract with IBM Corp. +# ================================================================= + +import os +import re +""" +This script will get current cluster nodes IP addresses and Mac from Ports, and then rewrite them into dhcp_template.yaml. +So that you can use dhcp_template.yaml to configure DHCP on bastion node. + +Here is the default template: +static_hosts: + bootstrap: + mac: "00:11:22:33:44:55" + ip: "10.1.0.10" + master-0: + mac: "00:11:22:33:44:56" + ip: "10.1.0.11" + master-1: + mac: "00:11:22:33:44:57" + ip: "10.1.0.12" + master-2: + mac: "00:11:22:33:44:58" + ip: "10.1.0.13" + worker-0: + mac: "00:11:22:33:44:59" + ip: "10.1.0.14" + worker-1: + mac: "00:11:22:33:44:60" + ip: "10.1.0.15" + worker-2: + mac: "00:11:22:33:44:61" + ip: "10.1.0.16" +""" +template = "static_hosts:" +cmd = "jq -r .infraID metadata.json" +infra_id = os.popen(cmd).read() +if infra_id == "": + os._exit(1) +infra_id = infra_id.replace("\n","") +cmd = "openstack --os-volume-api-version=3 port list | grep %s | awk '{print$4,$8,$6}'" % (infra_id) +result = os.popen(cmd).read() +""" +The example output of above command: +$ openstack port list | grep openshift-jwblw | awk '{print$4,$8,$6}' +openshift-jwblw-worker-port-9894 ip_address='172.26.104.222', fa:16:3e:5e:33:88 +openshift-jwblw-master-port-0 ip_address='172.26.104.119', fa:16:3e:85:39:1d +openshift-jwblw-worker-port-2211 ip_address='172.26.104.221', fa:16:3e:dc:a2:94 +""" +for line in result.split("\n"): + if line.strip(): + parts = line.split() + host_name = parts[0] + ip_address = re.search(r"ip_address='(.*?)'", parts[1]).group(1) + mac_address = parts[2] + + if "master" in host_name: + role = "master" + index = host_name.split("-")[-1] + elif "worker" in host_name: + role = "worker" + index = host_name.split("-")[-1] + elif "bootstrap" in host_name: + role = "bootstrap" + index = "" + if role == "bootstrap": + template_line = f" {role}:\n mac: \"{mac_address}\"\n ip: \"{ip_address}\"" + else: + template_line = f" {role}-{index}:\n mac: \"{mac_address}\"\n ip: \"{ip_address}\"" + template += "\n" + template_line + +with open("dhcp_template.yaml", "w") as file: + file.write(template) \ No newline at end of file From 8534c1d9937f334e3d82a55fff6943a2704ee194 Mon Sep 17 00:00:00 2001 From: Zheng Xiao Mei Date: Fri, 31 May 2024 10:23:02 +0800 Subject: [PATCH 2/2] Fix image upload issue . Signed-off-by: Zheng Xiao Mei --- .../ocp_upi/add-new-compute-node.yaml | 4 +-- .../ocp_upi/destroy-images.yaml | 8 ++--- .../configure-bootstrap-kvm/tasks/main.yaml | 2 +- .../configure-bootstrap-zvm/tasks/main.yaml | 2 +- .../tasks/main.yaml | 2 +- .../tasks/main.yaml | 2 +- .../tasks/main.yaml | 2 +- .../tasks/main.yaml | 2 +- .../tasks/main.yaml | 8 ++--- .../configure-installer-rhcos/tasks/main.yaml | 31 +++++++++---------- 10 files changed, 30 insertions(+), 33 deletions(-) diff --git a/z_infra_provisioning/cloud_infra_center/ocp_upi/add-new-compute-node.yaml b/z_infra_provisioning/cloud_infra_center/ocp_upi/add-new-compute-node.yaml index 160d1eb9e..077375965 100644 --- a/z_infra_provisioning/cloud_infra_center/ocp_upi/add-new-compute-node.yaml +++ b/z_infra_provisioning/cloud_infra_center/ocp_upi/add-new-compute-node.yaml @@ -23,13 +23,13 @@ - name: 'Get image name for kvm' ansible.builtin.set_fact: - image_name: icic_rhcos_qcow2 + image_name: icic_rhcos_{{ vm_type }}_{{ disk_type }}_{{ openshift_version }}_{{ openshift_minor_version }} when: - vm_type == "kvm" - name: 'Get image name for ZVM' ansible.builtin.set_fact: - image_name: "icic_rhcos_{{ disk_type }}" + image_name: "icic_rhcos_{{ vm_type }}_{{ disk_type }}_{{ openshift_version }}_{{ openshift_minor_version }}" when: - vm_type == "zvm" diff --git a/z_infra_provisioning/cloud_infra_center/ocp_upi/destroy-images.yaml b/z_infra_provisioning/cloud_infra_center/ocp_upi/destroy-images.yaml index 5ba2f82fe..259f4fb44 100644 --- a/z_infra_provisioning/cloud_infra_center/ocp_upi/destroy-images.yaml +++ b/z_infra_provisioning/cloud_infra_center/ocp_upi/destroy-images.yaml @@ -26,28 +26,28 @@ tasks: - name: Get existing rhcos image from ICIC glance - ansible.builtin.shell: "openstack image list --format value| grep -w 'icic_rhcos_qcow2'| wc -l" + ansible.builtin.shell: "openstack image list --format value| grep -w 'icic_rhcos_{{ vm_type }}_{{ disk_type }}_{{ openshift_version }}_{{ openshift_minor_version }}'| wc -l" register: icic_rhcos_count when: - vm_type == "kvm" - name: 'Remove the rhcos image' ansible.builtin.shell: - cmd: "openstack image delete icic_rhcos_qcow2" + cmd: "openstack image delete icic_rhcos_{{ vm_type }}_{{ disk_type }}_{{ openshift_version }}_{{ openshift_minor_version }}" when: - vm_type == "kvm" - icic_rhcos_count is defined - icic_rhcos_count.stdout | int == 1 - name: Get existing rhcos image from ICIC glance - ansible.builtin.shell: "openstack image list --format value| grep -w 'icic_rhcos_{{ disk_type }}'| wc -l" + ansible.builtin.shell: "openstack image list --format value| grep -w 'icic_rhcos_{{ vm_type }}_{{ disk_type }}_{{ openshift_version }}_{{ openshift_minor_version }}'| wc -l" register: icic_rhcos_count when: - vm_type == "zvm" - name: 'Remove the rhcos image' ansible.builtin.shell: - cmd: "openstack image delete icic_rhcos_{{ disk_type }}" + cmd: "openstack image delete icic_rhcos_{{ vm_type }}_{{ disk_type }}_{{ openshift_version }}_{{ openshift_minor_version }}" when: - vm_type == "zvm" - icic_rhcos_count is defined diff --git a/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-bootstrap-kvm/tasks/main.yaml b/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-bootstrap-kvm/tasks/main.yaml index f901412fd..5a8036aa3 100644 --- a/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-bootstrap-kvm/tasks/main.yaml +++ b/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-bootstrap-kvm/tasks/main.yaml @@ -40,7 +40,7 @@ - name: 'Get image name for kvm' ansible.builtin.set_fact: - image_name: icic_rhcos_qcow2 + image_name: icic_rhcos_{{ vm_type }}_{{ disk_type }}_{{ openshift_version }}_{{ openshift_minor_version }} when: - vm_type == "kvm" diff --git a/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-bootstrap-zvm/tasks/main.yaml b/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-bootstrap-zvm/tasks/main.yaml index 0b2add63a..95bbc1c66 100644 --- a/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-bootstrap-zvm/tasks/main.yaml +++ b/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-bootstrap-zvm/tasks/main.yaml @@ -40,7 +40,7 @@ - name: 'Get image name for ZVM' ansible.builtin.set_fact: - image_name: "icic_rhcos_{{ disk_type }}" + image_name: "icic_rhcos_{{ vm_type }}_{{ disk_type }}_{{ openshift_version }}_{{ openshift_minor_version }}" when: - vm_type == "zvm" diff --git a/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-compute-nodes-kvm/tasks/main.yaml b/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-compute-nodes-kvm/tasks/main.yaml index d8cd2a9c0..359ffa482 100644 --- a/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-compute-nodes-kvm/tasks/main.yaml +++ b/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-compute-nodes-kvm/tasks/main.yaml @@ -45,7 +45,7 @@ - name: 'Get image name for kvm' ansible.builtin.set_fact: - image_name: icic_rhcos_qcow2 + image_name: icic_rhcos_{{ vm_type }}_{{ disk_type }}_{{ openshift_version }}_{{ openshift_minor_version }} when: - vm_type == "kvm" diff --git a/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-compute-nodes-zvm/tasks/main.yaml b/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-compute-nodes-zvm/tasks/main.yaml index 9b9aa160b..dfb491c36 100644 --- a/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-compute-nodes-zvm/tasks/main.yaml +++ b/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-compute-nodes-zvm/tasks/main.yaml @@ -45,7 +45,7 @@ - name: 'Get image name for ZVM' ansible.builtin.set_fact: - image_name: "icic_rhcos_{{ disk_type }}" + image_name: "icic_rhcos_{{ vm_type }}_{{ disk_type }}_{{ openshift_version }}_{{ openshift_minor_version }}" when: - vm_type == "zvm" diff --git a/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-control-plane-kvm/tasks/main.yaml b/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-control-plane-kvm/tasks/main.yaml index e86f29085..079495369 100644 --- a/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-control-plane-kvm/tasks/main.yaml +++ b/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-control-plane-kvm/tasks/main.yaml @@ -40,7 +40,7 @@ - name: 'Get image name for kvm' ansible.builtin.set_fact: - image_name: icic_rhcos_qcow2 + image_name: icic_rhcos_{{ vm_type }}_{{ disk_type }}_{{ openshift_version }}_{{ openshift_minor_version }} when: - vm_type == "kvm" diff --git a/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-control-plane-zvm/tasks/main.yaml b/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-control-plane-zvm/tasks/main.yaml index 5b2430d52..98d741d9b 100644 --- a/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-control-plane-zvm/tasks/main.yaml +++ b/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-control-plane-zvm/tasks/main.yaml @@ -40,7 +40,7 @@ - name: 'Get image name for ZVM' ansible.builtin.set_fact: - image_name: "icic_rhcos_{{ disk_type }}" + image_name: "icic_rhcos_{{ vm_type }}_{{ disk_type }}_{{ openshift_version }}_{{ openshift_minor_version }}" when: - vm_type == "zvm" diff --git a/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-installer-rhcos-local/tasks/main.yaml b/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-installer-rhcos-local/tasks/main.yaml index f7618cc96..61e8c445e 100644 --- a/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-installer-rhcos-local/tasks/main.yaml +++ b/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-installer-rhcos-local/tasks/main.yaml @@ -37,28 +37,28 @@ - name: Upload RHCOS image to ICIC glance ansible.builtin.command: - cmd: openstack image create --tag {{ cluster_id_tag }} --disk-format=raw --property architecture=s390x --property os_name=Linux --property os_version=RHCOS{{ openshift_version }} --property os_distro=RHCOS{{ openshift_version }} --property hypervisor_type=ZVM --property disk_type=SCSI --file=rhcos-{{ openshift_version }}.{{ openshift_minor_version }}-s390x.raw icic_rhcos_{{ disk_type }} + cmd: openstack image create --tag {{ cluster_id_tag }} --disk-format=raw --property architecture=s390x --property os_name=Linux --property os_version=RHCOS{{ openshift_version }} --property os_distro=RHCOS{{ openshift_version }} --property hypervisor_type=ZVM --property disk_type=SCSI --file=rhcos-{{ openshift_version }}.{{ openshift_minor_version }}-s390x.raw icic_rhcos_{{ vm_type }}_{{ disk_type }}_{{ openshift_version }}_{{ openshift_minor_version }} when: - vm_type == "zvm" - disk_type == "scsi" - name: Upload RHCOS image to ICIC glance ansible.builtin.command: - cmd: openstack image create --tag {{ cluster_id_tag }} --disk-format=raw --property architecture=s390x --property os_name=Linux --property os_version=RHCOS{{ openshift_version }} --property os_distro=RHCOS{{ openshift_version }} --property hypervisor_type=ZVM --property disk_type=DASD --file=rhcos-{{ openshift_version }}.{{ openshift_minor_version }}-s390x.raw icic_rhcos_{{ disk_type }} + cmd: openstack image create --tag {{ cluster_id_tag }} --disk-format=raw --property architecture=s390x --property os_name=Linux --property os_version=RHCOS{{ openshift_version }} --property os_distro=RHCOS{{ openshift_version }} --property hypervisor_type=ZVM --property disk_type=DASD --file=rhcos-{{ openshift_version }}.{{ openshift_minor_version }}-s390x.raw icic_rhcos_{{ vm_type }}_{{ disk_type }}_{{ openshift_version }}_{{ openshift_minor_version }} when: - vm_type == "zvm" - disk_type == "dasd" - name: Upload RHCOS image to ICIC glance ansible.builtin.command: - cmd: openstack image create --tag {{ cluster_id_tag }} --disk-format=qcow2 --property architecture=s390x --property os_name=Linux --property os_version=RHCOS{{ openshift_version }} --property os_distro=RHCOS{{ openshift_version }} --property hypervisor_type=kvm --file=rhcos-{{ openshift_version }}.{{ openshift_minor_version }}-s390x.qcow2 icic_rhcos_qcow2 + cmd: openstack image create --tag {{ cluster_id_tag }} --disk-format=qcow2 --property architecture=s390x --property os_name=Linux --property os_version=RHCOS{{ openshift_version }} --property os_distro=RHCOS{{ openshift_version }} --property hypervisor_type=kvm --file=rhcos-{{ openshift_version }}.{{ openshift_minor_version }}-s390x.qcow2 icic_rhcos_{{ vm_type }}_{{ disk_type }}_{{ openshift_version }}_{{ openshift_minor_version }} when: - vm_type == "kvm" - volume_type_id is not defined - name: Upload RHCOS image to ICIC glance ansible.builtin.command: - cmd: openstack image create --tag {{ cluster_id_tag }} --property disk_type=SCSI --disk-format=qcow2 --property architecture=s390x --property os_name=Linux --property os_version=RHCOS{{ openshift_version }} --property os_distro=RHCOS{{ openshift_version }} --property hypervisor_type=kvm --file=rhcos-{{ openshift_version }}.{{ openshift_minor_version }}-s390x.qcow2 icic_rhcos_qcow2 + cmd: openstack image create --tag {{ cluster_id_tag }} --property disk_type=SCSI --disk-format=qcow2 --property architecture=s390x --property os_name=Linux --property os_version=RHCOS{{ openshift_version }} --property os_distro=RHCOS{{ openshift_version }} --property hypervisor_type=kvm --file=rhcos-{{ openshift_version }}.{{ openshift_minor_version }}-s390x.qcow2 icic_rhcos_{{ vm_type }}_{{ disk_type }}_{{ openshift_version }}_{{ openshift_minor_version }} when: - vm_type == "kvm" - volume_type_id is defined diff --git a/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-installer-rhcos/tasks/main.yaml b/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-installer-rhcos/tasks/main.yaml index 1b4f302b6..7b27718fa 100644 --- a/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-installer-rhcos/tasks/main.yaml +++ b/z_infra_provisioning/cloud_infra_center/ocp_upi/roles/configure-installer-rhcos/tasks/main.yaml @@ -40,9 +40,9 @@ - name: Get existing RHCOS image from ICIC glance ansible.builtin.shell: | if [ {{ vm_type }} == "kvm" ]; then - a=$(openstack image list --format value| grep -w 'icic_rhcos_qcow2'| awk '{print$1}') + a=$(openstack image list --format value| grep -w 'icic_rhcos_{{ vm_type }}_{{ disk_type }}_{{ openshift_version }}_{{ openshift_minor_version }}'| awk '{print$1}') else - a=$(openstack image list --format value| grep -w 'icic_rhcos_{{ disk_type }}'| awk '{print$1}') + a=$(openstack image list --format value| grep -w 'icic_rhcos_{{ vm_type }}_{{ disk_type }}_{{ openshift_version }}_{{ openshift_minor_version }}'| awk '{print$1}') fi if [ -z $a ]; then echo empty; else echo $a; fi register: icic_rhcos_id @@ -79,20 +79,17 @@ # - icic_rhcos_id.stdout != "" # - icic_rhcos_sha256_value.stdout == "" -- name: Remove the existing RHCOS image with unmatch sha256 from ICIC glance - ansible.builtin.shell: "openstack image delete {{ item }}" - with_items: "{{ icic_rhcos_id.stdout_lines }}" - when: - - icic_rhcos_id.stdout != "empty" - - use_local_rhcos.stdout | int != 1 +# Don't remove the existing RHCOS image with unmatch sha256 for Day2 operation +#- name: Remove the existing RHCOS image with unmatch sha256 from ICIC glance +# ansible.builtin.shell: "openstack image delete {{ item }}" +# with_items: "{{ icic_rhcos_id.stdout_lines }}" +# when: +# - icic_rhcos_id.stdout != "empty" +# - use_local_rhcos.stdout | int != 1 - name: Get new RHCOS image from ICIC glance ansible.builtin.shell: | - if [ {{ vm_type }} == "kvm" ]; then - out=$(openstack image list | grep -w 'icic_rhcos_qcow2' | wc -l) - else - out=$(openstack image list | grep -w 'icic_rhcos_{{ disk_type }}' | wc -l) - fi + out=$(openstack image list | grep -w 'icic_rhcos_{{ vm_type }}_{{ disk_type }}_{{ openshift_version }}_{{ openshift_minor_version }}' | wc -l) echo $out register: icic_rhcos_count @@ -141,7 +138,7 @@ - name: Upload RHCOS image to ICIC glance ansible.builtin.command: - cmd: openstack image create --disk-format=raw --property gz_sha256={{ openshift_rhcos_sha256_results.stdout}} --property architecture=s390x --property os_name=Linux --property os_version=RHCOS{{ openshift_version }} --property os_distro=RHCOS{{ openshift_version }} --property hypervisor_type=ZVM --property disk_type=SCSI --file=rhcos-{{ icic_ocp_version.stdout }}-s390x icic_rhcos_{{ disk_type }} + cmd: openstack image create --disk-format=raw --property gz_sha256={{ openshift_rhcos_sha256_results.stdout}} --property architecture=s390x --property os_name=Linux --property os_version=RHCOS{{ openshift_version }} --property os_distro=RHCOS{{ openshift_version }} --property hypervisor_type=ZVM --property disk_type=SCSI --file=rhcos-{{ icic_ocp_version.stdout }}-s390x icic_rhcos_{{ vm_type }}_{{ disk_type }}_{{ openshift_version }}_{{ openshift_minor_version }} when: - vm_type == "zvm" - disk_type == "scsi" @@ -149,7 +146,7 @@ - name: Upload RHCOS image to ICIC glance ansible.builtin.command: - cmd: openstack image create --disk-format=raw --property gz_sha256={{ openshift_rhcos_sha256_results.stdout }} --property architecture=s390x --property os_name=Linux --property os_version=RHCOS{{ openshift_version }} --property os_distro=RHCOS{{ openshift_version }} --property hypervisor_type=ZVM --property disk_type=DASD --file=rhcos-{{ icic_ocp_version.stdout }}-s390x icic_rhcos_{{ disk_type }} + cmd: openstack image create --disk-format=raw --property gz_sha256={{ openshift_rhcos_sha256_results.stdout }} --property architecture=s390x --property os_name=Linux --property os_version=RHCOS{{ openshift_version }} --property os_distro=RHCOS{{ openshift_version }} --property hypervisor_type=ZVM --property disk_type=DASD --file=rhcos-{{ icic_ocp_version.stdout }}-s390x icic_rhcos_{{ vm_type }}_{{ disk_type }}_{{ openshift_version }}_{{ openshift_minor_version }} when: - vm_type == "zvm" - disk_type == "dasd" @@ -157,7 +154,7 @@ - name: Upload RHCOS image to ICIC glance ansible.builtin.command: - cmd: openstack image create --disk-format=qcow2 --property gz_sha256={{ openshift_rhcos_sha256_results.stdout }} --property architecture=s390x --property os_name=Linux --property os_version=RHCOS{{ openshift_version }} --property os_distro=RHCOS{{ openshift_version }} --property hypervisor_type=kvm --file=rhcos-{{ icic_ocp_version.stdout }}-s390x icic_rhcos_qcow2 + cmd: openstack image create --disk-format=qcow2 --property gz_sha256={{ openshift_rhcos_sha256_results.stdout }} --property architecture=s390x --property os_name=Linux --property os_version=RHCOS{{ openshift_version }} --property os_distro=RHCOS{{ openshift_version }} --property hypervisor_type=kvm --file=rhcos-{{ icic_ocp_version.stdout }}-s390x icic_rhcos_{{ vm_type }}_{{ disk_type }}_{{ openshift_version }}_{{ openshift_minor_version }} when: - vm_type == "kvm" - disk_type == "dasd" @@ -167,7 +164,7 @@ - name: Upload RHCOS image to ICIC glance ansible.builtin.command: - cmd: openstack image create --disk-format=qcow2 --property disk_type=SCSI --property gz_sha256={{ openshift_rhcos_sha256_results.stdout }} --property architecture=s390x --property os_name=Linux --property disk_type=SCSI --property os_version=RHCOS{{ openshift_version }} --property os_distro=RHCOS{{ openshift_version }} --property hypervisor_type=kvm --file=rhcos-{{ icic_ocp_version.stdout }}-s390x icic_rhcos_qcow2 + cmd: openstack image create --disk-format=qcow2 --property disk_type=SCSI --property gz_sha256={{ openshift_rhcos_sha256_results.stdout }} --property architecture=s390x --property os_name=Linux --property disk_type=SCSI --property os_version=RHCOS{{ openshift_version }} --property os_distro=RHCOS{{ openshift_version }} --property hypervisor_type=kvm --file=rhcos-{{ icic_ocp_version.stdout }}-s390x icic_rhcos_{{ vm_type }}_{{ disk_type }}_{{ openshift_version }}_{{ openshift_minor_version }} when: - vm_type == "kvm" - icic_rhcos_count.stdout | int != 1