|
37 | 37 | with_items: "{{ ironic_containers }}" |
38 | 38 |
|
39 | 39 | when: BOOTSTRAP_CLUSTER == "kind" |
40 | | - become: yes |
| 40 | + become: true |
41 | 41 | become_user: root |
42 | 42 |
|
43 | 43 | - name: Fetch container logs (minikube cluster) |
|
53 | 53 | shell: "sudo {{ CONTAINER_RUNTIME }} logs {{ item }} > /tmp/{{ CONTAINER_RUNTIME }}/{{ item }}/stdout.log 2> /tmp/{{ CONTAINER_RUNTIME }}/{{ item }}/stderr.log" |
54 | 54 | with_items: "{{ general_containers }}" |
55 | 55 |
|
56 | | - become: yes |
| 56 | + become: true |
57 | 57 | become_user: root |
58 | 58 | when: BOOTSTRAP_CLUSTER == "minikube" |
59 | 59 |
|
60 | | - - name: Remove Ironic from source cluster (minikube cluster) |
| 60 | + - name: Remove Ironic CR from source cluster (minikube cluster) |
61 | 61 | kubernetes.core.k8s: |
62 | | - name: "{{ NAMEPREFIX }}-ironic" |
63 | | - kind: Deployment |
| 62 | + name: ironic |
| 63 | + kind: Ironic |
| 64 | + api_version: ironic.metal3.io/v1alpha1 |
64 | 65 | state: absent |
65 | 66 | namespace: "{{ IRONIC_NAMESPACE }}" |
66 | 67 | when: BOOTSTRAP_CLUSTER == "minikube" |
67 | 68 |
|
| 69 | + - name: Remove IRSO from source cluster (minikube cluster) |
| 70 | + shell: "make -C {{ IRSOPATH }} uninstall undeploy" |
| 71 | + ignore_errors: true |
| 72 | + when: BOOTSTRAP_CLUSTER == "minikube" |
| 73 | + |
68 | 74 | - name: Label baremetalhost CRD to pivot. |
69 | 75 | shell: "kubectl label --overwrite crds baremetalhosts.metal3.io {{ item }}" |
70 | 76 | with_items: |
|
136 | 142 | args: |
137 | 143 | chdir: "{{ BMOPATH }}" |
138 | 144 |
|
139 | | - # Install Ironic |
140 | | - - name: Install Ironic |
141 | | - shell: "{{ BMOPATH }}/tools/deploy.sh -i {{ BMO_IRONIC_ARGS }}" |
142 | | - environment: |
143 | | - IRONIC_HOST: "{{ IRONIC_HOST }}" |
144 | | - IRONIC_HOST_IP: "{{ IRONIC_HOST_IP }}" |
145 | | - KUBECTL_ARGS: "{{ KUBECTL_ARGS }}" |
| 145 | + # Install IRSO and Ironic via IRSO |
| 146 | + - name: Set IPA_BASEURI in IRSO manager config |
| 147 | + lineinfile: |
| 148 | + path: "{{ IRSOPATH }}/config/manager/manager.env" |
| 149 | + line: 'IPA_BASEURI=https://artifactory.nordix.org/artifactory/openstack-remote-cache/ironic-python-agent/dib' |
| 150 | + create: yes |
| 151 | + |
| 152 | + - name: Install and deploy IRSO |
| 153 | + shell: "make install deploy IMG={{ IRSO_IMAGE }}" |
146 | 154 | args: |
147 | | - chdir: "{{ BMOPATH }}" |
| 155 | + chdir: "{{ IRSOPATH }}" |
| 156 | + environment: |
| 157 | + KUBECONFIG: "/tmp/kubeconfig-{{ CLUSTER_NAME }}.yaml" |
| 158 | + |
| 159 | + - name: Wait for IRSO controller manager to be available |
| 160 | + kubernetes.core.k8s_info: |
| 161 | + kind: Deployment |
| 162 | + name: ironic-standalone-operator-controller-manager |
| 163 | + namespace: ironic-standalone-operator-system |
| 164 | + kubeconfig: "/tmp/kubeconfig-{{ CLUSTER_NAME }}.yaml" |
| 165 | + wait: true |
| 166 | + wait_condition: |
| 167 | + type: Available |
| 168 | + status: "True" |
| 169 | + wait_timeout: 60 |
| 170 | + |
| 171 | + - name: Set Ironic spec |
| 172 | + set_fact: |
| 173 | + ironic_spec: |
| 174 | + apiVersion: ironic.metal3.io/v1alpha1 |
| 175 | + kind: Ironic |
| 176 | + metadata: |
| 177 | + name: ironic |
| 178 | + namespace: "{{ IRONIC_NAMESPACE }}" |
| 179 | + spec: |
| 180 | + images: |
| 181 | + deployRamdiskBranch: "{{ IPA_BRANCH }}" |
| 182 | + deployRamdiskDownloader: "{{ IPA_DOWNLOADER_IMAGE }}" |
| 183 | + ironic: "{{ IRONIC_IMAGE }}" |
| 184 | + keepalived: "{{ IRONIC_KEEPALIVED_IMAGE }}" |
| 185 | + version: "{{ IRSO_IRONIC_VERSION }}" |
| 186 | + networking: |
| 187 | + dhcp: |
| 188 | + rangeBegin: "{{ CLUSTER_DHCP_RANGE_START }}" |
| 189 | + rangeEnd: "{{ CLUSTER_DHCP_RANGE_END }}" |
| 190 | + networkCIDR: "{{ BARE_METAL_PROVISIONER_NETWORK }}" |
| 191 | + interface: "{{ BARE_METAL_PROVISIONER_INTERFACE }}" |
| 192 | + ipAddress: "{{ CLUSTER_BARE_METAL_PROVISIONER_IP }}" |
| 193 | + ipAddressManager: keepalived |
| 194 | + deployRamdisk: |
| 195 | + sshKey: "{{ SSH_PUB_KEY_CONTENT }}" |
| 196 | + |
| 197 | + - name: Add extraKernelParams for libvirt platform |
| 198 | + set_fact: |
| 199 | + ironic_spec: "{{ ironic_spec | combine({'spec': {'deployRamdisk': {'extraKernelParams': 'console=ttyS0'}}}, recursive=True) }}" |
| 200 | + when: NODES_PLATFORM == 'libvirt' |
| 201 | + |
| 202 | + - name: Deploy Ironic using IRSO (retry if webhook not ready) |
| 203 | + kubernetes.core.k8s: |
| 204 | + state: present |
| 205 | + kubeconfig: "/tmp/kubeconfig-{{ CLUSTER_NAME }}.yaml" |
| 206 | + definition: "{{ ironic_spec }}" |
| 207 | + register: ironic_create |
| 208 | + retries: 10 |
| 209 | + delay: 3 |
| 210 | + until: ironic_create is succeeded |
| 211 | + |
| 212 | + - name: Wait for Ironic to be ready |
| 213 | + kubernetes.core.k8s_info: |
| 214 | + kind: Ironic |
| 215 | + name: ironic |
| 216 | + namespace: "{{ IRONIC_NAMESPACE }}" |
| 217 | + kubeconfig: "/tmp/kubeconfig-{{ CLUSTER_NAME }}.yaml" |
| 218 | + wait: true |
| 219 | + wait_condition: |
| 220 | + type: Ready |
| 221 | + status: "True" |
| 222 | + wait_timeout: "{{ (IRONIC_ROLLOUT_WAIT | default(10) | int * 60) }}" |
148 | 223 |
|
149 | 224 | - name: Label baremetalhost CRD in target cluster to pivot back. |
150 | 225 | shell: "kubectl --kubeconfig /tmp/kubeconfig-{{ CLUSTER_NAME }}.yaml label crds baremetalhosts.metal3.io {{ item }} --overwrite " |
|
0 commit comments