Skip to content

Commit 742d766

Browse files
committed
Fix ibmcloud SNO deploy by consolidating both ibmcloud SNO/MNO to use create-ai-cluster role
1 parent 1cac75d commit 742d766

File tree

20 files changed

+37
-276
lines changed

20 files changed

+37
-276
lines changed

ansible/ibmcloud-mno-deploy.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,17 @@
1414
vars:
1515
assisted_installer_host: "{{ hostvars[inventory_hostname]['private_address'] }}"
1616
http_store_host: "{{ hostvars[inventory_hostname]['private_address'] }}"
17+
sno_use_lab_dhcp: false
18+
use_bastion_registry: false
19+
pre_tasks:
20+
- name: Validate deploying MNO
21+
fail:
22+
msg: "cluster_type is not 'mno'"
23+
when: cluster_type != "mno"
1724
roles:
1825
- validate-vars
1926
- ocp-release
20-
- ibmcloud-create-ai-cluster
27+
- create-ai-cluster
2128
- generate-discovery-iso
2229
- role: boot-iso
2330
vars:

ansible/ibmcloud-sno-deploy.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,25 @@
1414
vars:
1515
assisted_installer_host: "{{ hostvars[inventory_hostname]['private_address'] }}"
1616
http_store_host: "{{ hostvars[inventory_hostname]['private_address'] }}"
17+
sno_use_lab_dhcp: false
18+
use_bastion_registry: false
19+
pre_tasks:
20+
- name: Validate deploying SNO
21+
fail:
22+
msg: "cluster_type is not 'sno'"
23+
when: cluster_type != "sno"
1724
roles:
1825
- validate-vars
1926
- ocp-release
20-
- ibmcloud-sno-create-ai-cluster
27+
- create-ai-cluster
2128
- role: generate-discovery-iso
2229
vars:
2330
iso_name: "{{ groups['sno'][1] }}"
2431
- role: boot-iso
2532
vars:
2633
inventory_group: sno
2734
index: "1"
28-
- sno-wait-hosts-discovered
35+
- wait-hosts-discovered
2936
- configure-local-storage
3037
- install-cluster
3138
- sno-post-cluster-install

ansible/roles/create-ai-cluster/tasks/main.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,15 @@
5959
path: "/etc/hosts"
6060
backup: true
6161
block: |
62-
{{ hostvars[cluster_name]['ip'] }} api.{{ cluster_name }}.{{ base_dns_name }}
63-
{{ hostvars[cluster_name]['ip'] }} api-int.{{ cluster_name }}.{{ base_dns_name }}
62+
{% if (lab in rh_labs or lab == 'byol') %}
63+
{% set etc_hosts_ip = hostvars[cluster_name]['ip'] %}
64+
{% else %}
65+
{% set etc_hosts_ip = hostvars[cluster_name]['private_address'] %}
66+
{% endif %}
67+
{{ etc_hosts_ip }} api.{{ cluster_name }}.{{ base_dns_name }}
68+
{{ etc_hosts_ip }} api-int.{{ cluster_name }}.{{ base_dns_name }}
6469
{% for route in etc_hosts_ingress_routes %}
65-
{{ hostvars[cluster_name]['ip'] }} {{ route }}.apps.{{ cluster_name }}.{{ base_dns_name }}
70+
{{ etc_hosts_ip }} {{ route }}.apps.{{ cluster_name }}.{{ base_dns_name }}
6671
{% endfor %}
6772
insertafter: "EOF"
6873
marker: "# {mark} {{ cluster_name }} OCP CLUSTER MANAGED BLOCK"
@@ -99,7 +104,7 @@
99104
"pull_secret": "{{ pull_secret | to_json }}",
100105
"ssh_public_key": "{{ lookup('file', ssh_public_key_file) }}",
101106
"vip_dhcp_allocation": "{{ vip_dhcp_allocation }}",
102-
"additional_ntp_source": "{{ bastion_controlplane_ip if use_bastion_registry else labs[lab]['ntp_server'] }}",
107+
"additional_ntp_source": "{{ bastion_controlplane_ip if (lab in cloud_labs) or use_bastion_registry else labs[lab]['ntp_server'] }}",
103108
"api_vips": [{"ip": "{{ controlplane_network_api }}"}],
104109
"ingress_vips": [{"ip": "{{ controlplane_network_ingress }}"}],
105110
"network_type": "OVNKubernetes"
@@ -167,7 +172,7 @@
167172
return_content: true
168173
body: {
169174
"name": "{{ cluster_name }}",
170-
"additional_ntp_sources": "{{ bastion_controlplane_ip if use_bastion_registry else labs[lab]['ntp_server'] }}",
175+
"additional_ntp_sources": "{{ bastion_controlplane_ip if (lab in cloud_labs) or use_bastion_registry else labs[lab]['ntp_server'] }}",
171176
"ssh_authorized_key": "{{ lookup('file', ssh_public_key_file) }}",
172177
"pull_secret": "{{ pull_secret | to_json }}",
173178
"static_network_config": "{{ static_network_config }}",
@@ -194,9 +199,11 @@
194199
when: use_bastion_registry | default(false)
195200

196201
# Disable lab interface manifests, skip if SNO has sno_use_lab_dhcp=true
197-
- name: Include custom manifests to disable the lab interface
202+
- name: Include custom manifests to disable the lab interface (RH Labs & BYOL)
198203
include_tasks: 01_manifest_update.yml
199-
when: (cluster_type == "mno") or (cluster_type == "sno" and not sno_use_lab_dhcp)
204+
when:
205+
- lab in rh_labs or lab == "byol"
206+
- (cluster_type == "mno") or (cluster_type == "sno" and not sno_use_lab_dhcp)
200207
loop:
201208
- file_name: 50-controlplane-disable-lab-dhcp-interface.yaml
202209
template_name: 50-controlplane-disable-lab-dhcp-interface.yml.j2

ansible/roles/create-ai-cluster/tasks/static_network_config.yml

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,14 @@
66
item_network_config:
77
network_yaml: "{{ lookup('template', 'rhlab_nmstate.yml.j2') }}"
88
mac_interface_map: "{{ lookup('template', 'rhlab_mac_interface_map.json.j2') }}"
9-
when:
10-
- lab in rh_labs or lab == "byol"
9+
when: lab in rh_labs or lab == "byol"
1110

12-
- name: SNO - Cloud Lab Populate static network configuration
11+
- name: Cloud Lab Populate static network configuration
1312
set_fact:
1413
item_network_config:
15-
- network_yaml: "{{ lookup('template', 'ibmcloud_sno_nmstate.yml.j2') }}"
16-
mac_interface_map: "{{ lookup('template', 'ibmcloud_sno_mac_interface_map.json.j2') }}"
17-
when:
18-
- cluster_type == "sno"
19-
- lab in cloud_labs
20-
21-
- name: MNO - Cloud Lab Populate static network configuration
22-
set_fact:
23-
item_network_config:
24-
network_yaml: "{{ lookup('template', 'ibmcloud_mno_nmstate.yml.j2') }}"
25-
mac_interface_map: "{{ lookup('template', 'ibmcloud_mno_mac_interface_map.json.j2') }}"
26-
when:
27-
- cluster_type == "mno"
28-
- lab in cloud_labs
14+
network_yaml: "{{ lookup('template', 'ibmcloud_nmstate.yml.j2') }}"
15+
mac_interface_map: "{{ lookup('template', 'ibmcloud_mac_interface_map.json.j2') }}"
16+
when: lab in cloud_labs
2917

3018
- name: Add {{ item }} ip config
3119
set_fact:

ansible/roles/create-ai-cluster/templates/ibmcloud_sno_mac_interface_map.json.j2

Lines changed: 0 additions & 12 deletions
This file was deleted.

ansible/roles/create-ai-cluster/templates/ibmcloud_sno_nmstate.yml.j2

Lines changed: 0 additions & 29 deletions
This file was deleted.

ansible/roles/ibmcloud-create-ai-cluster/defaults/main/bastion-registry.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

ansible/roles/ibmcloud-create-ai-cluster/defaults/main/dns.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)