|
1 | 1 | --- |
2 | | -- name: Check if multicluster-engine Namespace exists |
3 | | - k8s_info: |
| 2 | +- name: Create CatalogSource.yaml from template |
| 3 | + ansible.builtin.template: |
| 4 | + src: CatalogSource.yaml.j2 |
| 5 | + dest: /root/ansible_workdir/CatalogSource.yaml |
| 6 | + mode: '0644' |
| 7 | + when: hcp.mce.catalogsource_image is defined and hcp.mce.catalogsource_image | length > 0 |
| 8 | + |
| 9 | +- name: Deploy CatalogSource |
| 10 | + ansible.builtin.command: oc apply -f /root/ansible_workdir/CatalogSource.yaml |
| 11 | + when: hcp.mce.catalogsource_image is defined and hcp.mce.catalogsource_image | length > 0 |
| 12 | + |
| 13 | +- name: Check if multicluster-engine Namespace exists |
| 14 | + kubernetes.core.k8s: |
4 | 15 | api_version: v1 |
5 | 16 | kind: Namespace |
6 | 17 | name: "{{ hcp.asc.mce_namespace }}" |
7 | 18 | register: namespace_check |
8 | | - ignore_errors: yes |
| 19 | + ignore_errors: true |
9 | 20 |
|
10 | | -- name: Create multicluster-engine Namespace |
11 | | - k8s: |
| 21 | +- name: Create multicluster-engine Namespace |
| 22 | + kubernetes.core.k8s: |
12 | 23 | api_version: v1 |
13 | 24 | kind: Namespace |
14 | 25 | name: "{{ hcp.asc.mce_namespace }}" |
15 | 26 | state: present |
16 | | - when: namespace_check.resources | length == 0 |
| 27 | + when: namespace_check.resources | length == 0 |
17 | 28 |
|
18 | 29 | - name: Create OperatorGroup.yaml |
19 | | - template: |
| 30 | + ansible.builtin.template: |
20 | 31 | src: OperatorGroup.yaml.j2 |
21 | 32 | dest: /root/ansible_workdir/OperatorGroup.yaml |
| 33 | + mode: '0644' |
22 | 34 |
|
23 | 35 | - name: Deploy OperatorGroup |
24 | | - command: oc apply -f /root/ansible_workdir/OperatorGroup.yaml |
| 36 | + ansible.builtin.command: oc apply -f /root/ansible_workdir/OperatorGroup.yaml |
25 | 37 |
|
26 | 38 | - name: Create Subscription.yaml |
27 | | - template: |
| 39 | + ansible.builtin.template: |
28 | 40 | src: Subscription.yaml.j2 |
29 | 41 | dest: /root/ansible_workdir/Subscription.yaml |
| 42 | + mode: '0644' |
30 | 43 |
|
31 | 44 | - name: Deploy Subscription for MCE |
32 | | - command: oc apply -f /root/ansible_workdir/Subscription.yaml |
| 45 | + ansible.builtin.command: oc apply -f /root/ansible_workdir/Subscription.yaml |
33 | 46 |
|
34 | 47 | - name: Wait for MCE deployment to be created |
35 | | - shell: oc get all -n {{ hcp.asc.mce_namespace }} | grep -i deployment | grep -i multicluster-engine | wc -l |
36 | | - register: mce_deploy |
| 48 | + ansible.builtin.shell: | |
| 49 | + set -o pipefail |
| 50 | + oc get all -n {{ hcp.asc.mce_namespace }} | grep -i deployment | grep -i multicluster-engine | wc -l |
37 | 51 | until: mce_deploy.stdout == '1' |
38 | 52 | retries: 20 |
39 | 53 | delay: 5 |
40 | 54 |
|
41 | 55 | - name: Wait for MCE deployment to be available |
42 | | - shell: oc get deployment multicluster-engine-operator -n {{ hcp.asc.mce_namespace }} -o=jsonpath='{.status.replicas}{" "}{.status.availableReplicas}' |
| 56 | + ansible.builtin.shell: > |
| 57 | + oc get deployment multicluster-engine-operator -n {{ hcp.asc.mce_namespace }} |
| 58 | + -o=jsonpath='{.status.replicas}{" "}{.status.availableReplicas}' |
43 | 59 | register: mce_pod_status |
44 | 60 | until: mce_pod_status.stdout.split(' ')[0] == mce_pod_status.stdout.split(' ')[1] |
45 | 61 | retries: 20 |
46 | 62 | delay: 5 |
47 | 63 |
|
48 | 64 | - name: Create MultiClusterEngine.yaml |
49 | | - template: |
| 65 | + ansible.builtin.template: |
50 | 66 | src: MultiClusterEngine.yaml.j2 |
51 | 67 | dest: /root/ansible_workdir/MultiClusterEngine.yaml |
| 68 | + mode: '0644' |
52 | 69 |
|
53 | 70 | - name: Deploy MCE Instance |
54 | | - command: oc apply -f /root/ansible_workdir/MultiClusterEngine.yaml |
| 71 | + ansible.builtin.command: oc apply -f /root/ansible_workdir/MultiClusterEngine.yaml |
55 | 72 |
|
56 | 73 | - name: Wait for MCE to be Available |
57 | | - shell: oc get mce --no-headers | awk '{print $2}' |
| 74 | + ansible.builtin.shell: | |
| 75 | + set -o pipefail |
| 76 | + oc get mce --no-headers | awk '{print $2}' |
58 | 77 | register: mce_status |
59 | 78 | until: mce_status.stdout == "Available" |
60 | 79 | retries: 40 |
61 | | - delay: 10 |
| 80 | + delay: 10 |
62 | 81 |
|
63 | 82 | - name: Enable hypershift-preview component in MCE |
64 | | - command: oc patch mce {{ hcp.mce.instance_name }} -p '{"spec":{"overrides":{"components":[{"name":"hypershift-preview","enabled":true}]}}}' --type merge |
| 83 | + ansible.builtin.command: > |
| 84 | + oc patch mce {{ hcp.mce.instance_name }} |
| 85 | + -p '{"spec":{"overrides":{"components":[{"name":"hypershift-preview","enabled":true}]}}}' |
| 86 | + --type merge |
65 | 87 |
|
66 | 88 | - name: Create ClusterImageSet.yaml |
67 | | - template: |
| 89 | + ansible.builtin.template: |
68 | 90 | src: ClusterImageSet.yaml.j2 |
69 | 91 | dest: /root/ansible_workdir/ClusterImageSet.yaml |
| 92 | + mode: '0644' |
70 | 93 |
|
71 | | -- name: Deploy ClusterImageSet |
72 | | - command: oc apply -f /root/ansible_workdir/ClusterImageSet.yaml |
| 94 | +- name: Deploy ClusterImageSet |
| 95 | + ansible.builtin.command: oc apply -f /root/ansible_workdir/ClusterImageSet.yaml |
73 | 96 |
|
74 | 97 | - name: Create Provisioning.yaml |
75 | | - template: |
| 98 | + ansible.builtin.template: |
76 | 99 | src: Provisioning.yaml.j2 |
77 | 100 | dest: /root/ansible_workdir/Provisioning.yaml |
| 101 | + mode: '0644' |
78 | 102 |
|
79 | | -- name: Deploy Provisioning |
80 | | - command: oc apply -f /root/ansible_workdir/Provisioning.yaml |
| 103 | +- name: Deploy Provisioning |
| 104 | + ansible.builtin.command: oc apply -f /root/ansible_workdir/Provisioning.yaml |
0 commit comments