Skip to content

Commit 873c578

Browse files
authored
Address #747 - ibmcloud does not use controlplane_network (#749)
1 parent d90d48a commit 873c578

File tree

7 files changed

+30
-14
lines changed

7 files changed

+30
-14
lines changed

ansible/ibmcloud-setup-bastion.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
- vars/ibmcloud.yml
1414
vars:
1515
assisted_installer_host: "{{ hostvars[inventory_hostname]['private_address'] }}"
16-
bastion_controlplane_ip: "{{ hostvars[inventory_hostname]['private_address'] }}"
1716
http_store_host: "{{ hostvars[inventory_hostname]['private_address'] }}"
1817
roles:
1918
- validate-vars

ansible/roles/bastion-dnsmasq/templates/jetlag.conf.j2

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
# Jetlag provided DNS on Bastion
22
{% if lab in cloud_labs %}
33
except-interface={{ bastion_public_interface }}
4-
{% endif %}
54

65
# Bastion / assisted-installer / http-server / registry / router / dns
7-
{% for network in controlplane_network %}
6+
address=/{{ groups['bastion'][0] }}/{{ hostvars[inventory_hostname]['private_address'] }}
7+
8+
address=/api.{{ cluster_name }}.{{ base_dns_name }}/{{ controlplane_network_api }}
9+
address=/apps.{{ cluster_name }}.{{ base_dns_name }}/{{ controlplane_network_ingress }}
10+
11+
{% else %}
12+
# Bastion / assisted-installer / http-server / registry / router / dns
13+
{% for network in controlplane_network %}
814
address=/{{ groups['bastion'][0] }}/{{ network | ansible.utils.nthhost(1) }}
915
address=/api.{{ cluster_name }}.{{ base_dns_name }}/{{ network | ansible.utils.nthhost(3) }}
1016
address=/apps.{{ cluster_name }}.{{ base_dns_name }}/{{ network | ansible.utils.nthhost(4) }}
11-
{% endfor %}
17+
{% endfor %}
18+
{% endif %}
1219

1320
# Jetlag provided DNS for VMs
1421
{% for vm in groups['hv_vm'] %}
Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
# Deployed by Jetlag automation
22
search {{ base_dns_name }}
3-
{% if public_vlan | default(false) %}
4-
nameserver {{ ansible_default_ipv4.address }}
3+
{% if lab in cloud_labs %}
4+
nameserver {{ hostvars[inventory_hostname]['private_address'] }}
55
{% else %}
6+
{% if public_vlan | default(false) %}
7+
nameserver {{ ansible_default_ipv4.address }}
8+
{% else %}
69
nameserver {{ controlplane_network[0] | ansible.utils.nthhost(1) }}
10+
{% endif %}
711
{% endif %}
812
{% if lab in rh_labs or lab == "byol" %}
9-
{% for dns in labs[lab]['dns'] %}
13+
{% for dns in labs[lab]['dns'] %}
1014
nameserver {{ dns }}
11-
{% endfor %}
15+
{% endfor %}
1216
{% else %}
13-
{% if dns_servers | length == 1 %}
17+
{% if dns_servers | length == 1 %}
1418
nameserver {{ dns_servers[0] }}
15-
{% elif dns_servers | length >= 2 %}
19+
{% elif dns_servers | length >= 2 %}
1620
nameserver {{ dns_servers[0] }}
1721
nameserver {{ dns_servers[1] }}
18-
{% endif %}
22+
{% endif %}
1923
{% endif %}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,13 @@
4949
"openshift_version": "{{ openshift_version }}",
5050
"high_availability_mode": "None",
5151
"base_dns_domain": "{{ base_dns_name }}",
52+
{% if lab in rh_labs %}
5253
"machine_networks": [
5354
{% for network in controlplane_network %}
5455
{"cidr": "{{ network }}"}{{ "," if not loop.last else "" }}
5556
{% endfor %}
5657
],
58+
{% endif %}
5759
"cluster_networks": [
5860
{% for i in range(cluster_network_cidr | length) %}
5961
{"cidr": "{{ cluster_network_cidr[i] }}", "host_prefix": {{ cluster_network_host_prefix[i] }} }{{ "," if not loop.last else "" }}
@@ -117,11 +119,13 @@
117119
"name": "{{ cluster_name }}",
118120
"openshift_version": "{{ openshift_version }}",
119121
"base_dns_domain": "{{ base_dns_name }}",
122+
{% if lab in rh_labs %}
120123
"machine_networks": [
121124
{% for network in controlplane_network %}
122125
{"cidr": "{{ network }}"}{{ "," if not loop.last else "" }}
123126
{% endfor %}
124127
],
128+
{% endif %}
125129
"cluster_networks": [
126130
{% for i in range(cluster_network_cidr | length) %}
127131
{"cidr": "{{ cluster_network_cidr[i] }}", "host_prefix": {{ cluster_network_host_prefix[i] }} }{{ "," if not loop.last else "" }}

ansible/roles/create-inventory/defaults/main/networks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ controlplane_network_prefix: [16]
1818
# Gateway for controlplane network - defaults to .1 of first network
1919
# Can be overridden for special cases (e.g., public VLAN)
2020
controlplane_network_gateway: "{{ controlplane_network[0] | ansible.utils.nthhost(1) }}"
21-
# Sets "bastion_controlplane_ip" as primary dns
21+
# Sets bastion as primary dns
2222
controlplane_bastion_as_dns: true
2323

2424
# OCP networks - always lists

ansible/roles/create-inventory/templates/inventory-sno.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ lab_interface={{ controlplane_lab_interface }}
7171
# network_prefix={{ controlplane_network_prefix }}
7272
# gateway={{ controlplane_network_gateway }}
7373
{% if controlplane_bastion_as_dns %}
74-
# dns1={{ bastion_controlplane_ip }}
74+
# dns1={{ controlplane_network[0] | ansible.utils.nthhost(1) }}
7575
{% else %}
7676
# dns1={{ labs[lab]['dns'][0] }}
7777
# dns2={{ labs[lab]['dns'][1] | default('') }}
@@ -142,7 +142,7 @@ bmc_password={{ bmc_password }}
142142
# network_prefix={{ controlplane_network_prefix }}
143143
# gateway={{ controlplane_network_gateway }}
144144
{% if controlplane_bastion_as_dns %}
145-
# dns1={{ bastion_controlplane_ip }}
145+
# dns1={{ controlplane_network[0] | ansible.utils.nthhost(1) }}
146146
{% else %}
147147
# dns1={{ labs[lab]['dns'][0] }}
148148
# dns2={{ labs[lab]['dns'][1] | default('') }}

ansible/roles/validate-vars/tasks/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@
124124
when: hostvars | json_query('(*)[?network_mac]')
125125

126126
- name: Validate network configuration
127+
when:
128+
- lab in rh_labs
127129
block:
128130
- name: Validate controlplane_network is a list
129131
fail:

0 commit comments

Comments
 (0)