|
22 | 22 | set_fact:
|
23 | 23 | static_network_config: []
|
24 | 24 |
|
25 |
| -- name: Populate static network configuration with controlplane nodes |
26 |
| - include_tasks: static_network_config.yml |
27 |
| - loop: "{{ groups['controlplane'] }}" |
| 25 | +- name: SNO Cluster Creation |
| 26 | + block: |
| 27 | + - name: SNO - Populate static network configuration with SNO node |
| 28 | + include_tasks: static_network_config.yml |
| 29 | + when: not sno_use_lab_dhcp |
| 30 | + loop: "{{ groups['sno'] }}" |
28 | 31 |
|
29 |
| -- name: MNO - Populate static network configuration with worker nodes |
30 |
| - include_tasks: static_network_config.yml |
31 |
| - when: |
32 |
| - - cluster_type == "mno" |
33 |
| - loop: "{{ groups['worker'] }}" |
| 32 | + - name: SNO - Set cluster_name |
| 33 | + set_fact: |
| 34 | + cluster_name: "{{ groups['sno'][0] }}" |
34 | 35 |
|
35 |
| -- name: Create MNO cluster |
36 |
| - uri: |
37 |
| - url: "http://{{ assisted_installer_host }}:{{ assisted_installer_port }}/api/assisted-install/v2/clusters" |
38 |
| - method: POST |
39 |
| - body_format: json |
40 |
| - status_code: [201] |
41 |
| - return_content: true |
42 |
| - body: { |
43 |
| - "name": "{{ cluster_name }}", |
44 |
| - "openshift_version": "{{ openshift_version }}", |
45 |
| - "base_dns_domain": "{{ base_dns_name }}", |
46 |
| - "cluster_network_cidr": "{{ cluster_network_cidr }}", |
47 |
| - "cluster_network_host_prefix": "{{ cluster_network_host_prefix }}", |
48 |
| - "service_network_cidr": "{{ service_network_cidr }}", |
49 |
| - "pull_secret": "{{ pull_secret | to_json }}", |
50 |
| - "ssh_public_key": "{{ lookup('file', ssh_public_key_file) }}", |
51 |
| - "vip_dhcp_allocation": "{{ vip_dhcp_allocation }}", |
52 |
| - "additional_ntp_source": "{{ bastion_controlplane_ip if use_bastion_registry else labs[lab]['ntp_server'] }}", |
53 |
| - "api_vips": [{"ip": "{{ controlplane_network_api }}"}], |
54 |
| - "ingress_vips": [{"ip": "{{ controlplane_network_ingress }}"}], |
55 |
| - "network_type": "OVNKubernetes" |
56 |
| - } |
57 |
| - register: create_cluster_return |
| 36 | + - name: SNO - Create cluster |
| 37 | + uri: |
| 38 | + url: "http://{{ assisted_installer_host }}:{{ assisted_installer_port }}/api/assisted-install/v2/clusters" |
| 39 | + method: POST |
| 40 | + body_format: json |
| 41 | + status_code: [201] |
| 42 | + return_content: true |
| 43 | + body: { |
| 44 | + "name": "{{ cluster_name }}", |
| 45 | + "openshift_version": "{{ openshift_version }}", |
| 46 | + "high_availability_mode": "None", |
| 47 | + "base_dns_domain": "{{ base_dns_name }}", |
| 48 | + "cluster_network_cidr": "{{ cluster_network_cidr }}", |
| 49 | + "cluster_network_host_prefix": "{{ cluster_network_host_prefix }}", |
| 50 | + "service_network_cidr": "{{ service_network_cidr }}", |
| 51 | + "pull_secret": "{{ pull_secret | to_json }}", |
| 52 | + "ssh_public_key": "{{ lookup('file', ssh_public_key_file) }}", |
| 53 | + "additional_ntp_source": "{{ bastion_controlplane_ip if (lab in cloud_labs) or use_bastion_registry else labs[lab]['ntp_server'] }}" |
| 54 | + } |
| 55 | + register: create_cluster_return |
58 | 56 |
|
59 |
| -- name: Set ai_cluster_id |
60 |
| - set_fact: |
61 |
| - ai_cluster_id: "{{ create_cluster_return.json.id }}" |
| 57 | + - name: SNO - Add entries in /etc/hosts |
| 58 | + blockinfile: |
| 59 | + path: "/etc/hosts" |
| 60 | + backup: true |
| 61 | + block: | |
| 62 | + {{ hostvars[cluster_name]['ip'] }} api.{{ cluster_name }}.{{ base_dns_name }} |
| 63 | + {{ hostvars[cluster_name]['ip'] }} api-int.{{ cluster_name }}.{{ base_dns_name }} |
| 64 | + {% for route in etc_hosts_ingress_routes %} |
| 65 | + {{ hostvars[cluster_name]['ip'] }} {{ route }}.apps.{{ cluster_name }}.{{ base_dns_name }} |
| 66 | + {% endfor %} |
| 67 | + insertafter: "EOF" |
| 68 | + marker: "# {mark} {{ cluster_name }} OCP CLUSTER MANAGED BLOCK" |
| 69 | + |
| 70 | + - name: SNO - Set ai_cluster_id |
| 71 | + set_fact: |
| 72 | + ai_cluster_id: "{{ create_cluster_return.json.id }}" |
| 73 | + when: cluster_type == "sno" |
| 74 | + |
| 75 | +- name: MNO Cluster Creation |
| 76 | + block: |
| 77 | + - name: MNO - Populate static network configuration with controlplane nodes |
| 78 | + include_tasks: static_network_config.yml |
| 79 | + loop: "{{ groups['controlplane'] }}" |
| 80 | + |
| 81 | + - name: MNO - Populate static network configuration with worker nodes |
| 82 | + include_tasks: static_network_config.yml |
| 83 | + loop: "{{ groups['worker'] }}" |
| 84 | + |
| 85 | + - name: MNO - Create cluster |
| 86 | + uri: |
| 87 | + url: "http://{{ assisted_installer_host }}:{{ assisted_installer_port }}/api/assisted-install/v2/clusters" |
| 88 | + method: POST |
| 89 | + body_format: json |
| 90 | + status_code: [201] |
| 91 | + return_content: true |
| 92 | + body: { |
| 93 | + "name": "{{ cluster_name }}", |
| 94 | + "openshift_version": "{{ openshift_version }}", |
| 95 | + "base_dns_domain": "{{ base_dns_name }}", |
| 96 | + "cluster_network_cidr": "{{ cluster_network_cidr }}", |
| 97 | + "cluster_network_host_prefix": "{{ cluster_network_host_prefix }}", |
| 98 | + "service_network_cidr": "{{ service_network_cidr }}", |
| 99 | + "pull_secret": "{{ pull_secret | to_json }}", |
| 100 | + "ssh_public_key": "{{ lookup('file', ssh_public_key_file) }}", |
| 101 | + "vip_dhcp_allocation": "{{ vip_dhcp_allocation }}", |
| 102 | + "additional_ntp_source": "{{ bastion_controlplane_ip if use_bastion_registry else labs[lab]['ntp_server'] }}", |
| 103 | + "api_vips": [{"ip": "{{ controlplane_network_api }}"}], |
| 104 | + "ingress_vips": [{"ip": "{{ controlplane_network_ingress }}"}], |
| 105 | + "network_type": "OVNKubernetes" |
| 106 | + } |
| 107 | + register: create_cluster_return |
| 108 | + |
| 109 | + - name: MNO - Add entries in /etc/hosts |
| 110 | + blockinfile: |
| 111 | + path: "/etc/hosts" |
| 112 | + backup: true |
| 113 | + block: | |
| 114 | + {{ controlplane_network_api }} api.{{ cluster_name }}.{{ base_dns_name }} |
| 115 | + {{ controlplane_network_api }} api-int.{{ cluster_name }}.{{ base_dns_name }} |
| 116 | + {% for route in etc_hosts_ingress_routes %} |
| 117 | + {{ controlplane_network_ingress }} {{ route }}.apps.{{ cluster_name }}.{{ base_dns_name }} |
| 118 | + {% endfor %} |
| 119 | + insertafter: "EOF" |
| 120 | + marker: "# {mark} {{ cluster_name }} OCP CLUSTER MANAGED BLOCK" |
| 121 | + |
| 122 | + - name: MNO - Set ai_cluster_id |
| 123 | + set_fact: |
| 124 | + ai_cluster_id: "{{ create_cluster_return.json.id }}" |
| 125 | + when: cluster_type == "mno" |
| 126 | + |
| 127 | +- name: Restart dnsmasq after /etc/hosts update |
| 128 | + systemd: |
| 129 | + state: restarted |
| 130 | + name: dnsmasq |
| 131 | + when: |
| 132 | + - controlplane_bastion_as_dns |
| 133 | + - not setup_coredns |
62 | 134 |
|
63 | 135 | - name: Patch cluster network settings
|
64 | 136 | uri:
|
|
83 | 155 | ]
|
84 | 156 | }
|
85 | 157 |
|
| 158 | +# - debug: |
| 159 | +# msg: "{{ static_network_config }}" |
| 160 | + |
86 | 161 | - name: Create a connected infra-env
|
87 | 162 | uri:
|
88 | 163 | url: "http://{{ assisted_installer_host }}:{{ assisted_installer_port }}/api/assisted-install/v2/infra-envs"
|
|
118 | 193 | }
|
119 | 194 | when: use_bastion_registry | default(false)
|
120 | 195 |
|
121 |
| -- name: Add entries in /etc/hosts |
122 |
| - blockinfile: |
123 |
| - path: "/etc/hosts" |
124 |
| - backup: true |
125 |
| - block: | |
126 |
| - {{ controlplane_network_api }} api.{{ cluster_name }}.{{ base_dns_name }} |
127 |
| - {{ controlplane_network_api }} api-int.{{ cluster_name }}.{{ base_dns_name }} |
128 |
| - {% for route in etc_hosts_ingress_routes %} |
129 |
| - {{ controlplane_network_ingress }} {{ route }}.apps.{{ cluster_name }}.{{ base_dns_name }} |
130 |
| - {% endfor %} |
131 |
| - insertafter: "EOF" |
132 |
| - marker: "# {mark} {{ cluster_name }} OCP CLUSTER MANAGED BLOCK" |
133 |
| - |
134 |
| -- name: Restart dnsmasq after /etc/hosts update |
135 |
| - systemd: |
136 |
| - state: restarted |
137 |
| - name: dnsmasq |
138 |
| - when: |
139 |
| - - controlplane_bastion_as_dns |
140 |
| - - not setup_coredns |
141 |
| - |
142 |
| -- name: Include custom manifests |
| 196 | +# Disable lab interface manifests, skip if SNO has sno_use_lab_dhcp=true |
| 197 | +- name: Include custom manifests to disable the lab interface |
143 | 198 | include_tasks: 01_manifest_update.yml
|
144 |
| - with_items: |
| 199 | + when: (cluster_type == "mno") or (cluster_type == "sno" and not sno_use_lab_dhcp) |
| 200 | + loop: |
145 | 201 | - file_name: 50-controlplane-disable-lab-dhcp-interface.yaml
|
146 | 202 | template_name: 50-controlplane-disable-lab-dhcp-interface.yml.j2
|
147 | 203 | - file_name: 50-worker-disable-lab-dhcp-interface.yaml
|
148 | 204 | template_name: 50-worker-disable-lab-dhcp-interface.yml.j2
|
149 |
| - - file_name: 50-controlplane-tune-kni-haproxy.yaml |
150 |
| - template_name: 50-controlplane-tune-kni-haproxy.yml.j2 |
151 |
| - enabled: "{{ override_kni_infra_haproxy }}" |
| 205 | + |
| 206 | +# MNO and SNO Custom manifests |
| 207 | +- name: Include custom manifests |
| 208 | + include_tasks: 01_manifest_update.yml |
| 209 | + loop: |
152 | 210 | - file_name: 06-kdump-master.yaml
|
153 | 211 | template_name: 06-kdump-master.yaml
|
154 | 212 | enabled: "{{ kdump_master_config }}"
|
155 |
| - - file_name: kubeletconfig-max-pods.yml |
156 |
| - template_name: kubeletconfig-max-pods.yml |
157 |
| - enabled: "{{ kubelet_config }}" |
158 | 213 | - file_name: 99-disconnected-dns-workaround.yml
|
159 | 214 | template_name: 99-disconnected-dns-workaround.yml
|
160 | 215 | enabled: "{{ use_bastion_registry }}"
|
| 216 | + |
| 217 | +# MNO Custom manifests only |
| 218 | +- name: MNO - Include custom manifests |
| 219 | + include_tasks: 01_manifest_update.yml |
| 220 | + when: cluster_type == "mno" |
| 221 | + loop: |
| 222 | + - file_name: 50-controlplane-tune-kni-haproxy.yaml |
| 223 | + template_name: 50-controlplane-tune-kni-haproxy.yml.j2 |
| 224 | + enabled: "{{ override_kni_infra_haproxy }}" |
| 225 | + - file_name: kubeletconfig-max-pods.yml |
| 226 | + template_name: kubeletconfig-max-pods.yml |
| 227 | + enabled: "{{ kubelet_config }}" |
| 228 | + |
| 229 | +# SNO Custom manifests only |
| 230 | +- name: SNO - Include custom manifests |
| 231 | + include_tasks: 01_manifest_update.yml |
| 232 | + when: cluster_type == "sno" |
| 233 | + loop: |
| 234 | + - file_name: kubeletconfig-max-pods.yml |
| 235 | + template_name: kubeletconfig-max-pods.yml |
| 236 | + enabled: "{{ kubelet_config }}" |
| 237 | + vars: |
| 238 | + kubelet_config_max_pods_label: "pools.operator.machineconfiguration.openshift.io/master: ''" |
| 239 | + |
| 240 | +# SNO with DU profile manifests |
| 241 | +- name: SNO - Include DU Profile manifests |
| 242 | + include_tasks: du_profile_manifest_tasks.yml |
| 243 | + when: |
| 244 | + - cluster_type == "sno" |
| 245 | + - du_profile |
0 commit comments