Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank Mitarotonda committed Jun 3, 2024
2 parents 04da0dd + 8534c1d commit 8ca002c
Show file tree
Hide file tree
Showing 19 changed files with 288 additions and 35 deletions.
4 changes: 2 additions & 2 deletions z_infra_provisioning/cloud_infra_center/ocp_upi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
19 changes: 19 additions & 0 deletions z_infra_provisioning/cloud_infra_center/ocp_upi/bastion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 22 additions & 0 deletions z_infra_provisioning/cloud_infra_center/ocp_upi/dhcp_template.yaml
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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 %}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading

0 comments on commit 8ca002c

Please sign in to comment.