Wolfgang Kulhanek
2020-03-14 c37a78f35516ddd06f3430fcb2ea545175a83269
commit | author | age
a637ad 1 ---
998e0c 2 - name: Set up combined ocp4_workload_quay_operator dictionary
WK 3   set_fact:
4     ocp4_workload_quay_operator: >-
5       {{ ocp4_workload_quay_operator_defaults
1d687a 6        | combine(ocp4_workload_quay_operator_vars    | default( {} ),
WK 7                  ocp4_workload_quay_operator_secrets | default( {} ), recursive=true)
998e0c 8       }}
a637ad 9
c37a78 10 - name: Get ClusterVersion
WK 11   k8s_facts:
12     api_version: config.openshift.io/v1
13     kind: ClusterVersion
14     name: version
15   register: r_cluster_version
16 - name: Set ocp4_workload_quay_operator_cluster_version fact
17   set_fact:
18     ocp4_workload_quay_operator_cluster_version: "{{ r_cluster_version.resources[0].status.history[0].version }}"
19 - name: Print OpenShift version
20   debug:
21     msg: "Removing Quay Operator for OpenShift Version: {{ ocp4_workload_quay_operator_cluster_version }}"
22
23 - name: Remove Quay
a637ad 24   k8s:
WK 25     state: absent
1598bb 26     definition: "{{ lookup('template', item ) | from_yaml }}"
WK 27   loop:
28   - ./templates/quay.j2
a637ad 29
c37a78 30 - name: Wait for all Quay Pods to be terminated
WK 31   k8s_facts:
32     api_version: v1
33     kind: Pod
34     namespace: "{{ ocp4_workload_quay_operator.project }}"
35   register: r_running_pods
36   until: r_running_pods.resources | list | length <= 1
e2d8ee 37   ignore_errors: true
c37a78 38   retries: 20
WK 39   delay: 10
e2d8ee 40
c37a78 41 - name: Remove Red Hat Quay Operator
d111f6 42   k8s:
NS 43     state: absent
44     definition: "{{ lookup('template', item ) | from_yaml }}"
45   loop:
c37a78 46   - ./templates/subscription.j2
WK 47   - ./templates/operatorgroup.j2
48   - ./templates/catalogsourceconfig.j2
d111f6 49   - ./templates/pull_secret.j2
NS 50   - ./templates/quay_superuser_secret.j2
51   - ./templates/quay_config_secret.j2
52   - ./templates/quay_ssl_certificate_secret.j2
53   - ./templates/project.j2
54
c37a78 55 - name: Remove serviceaccounts from anyuid scc (if they are still there)
WK 56   shell: "oc adm policy remove-scc-from-user anyuid system:serviceaccount:{{ ocp4_workload_quay_operator.project }}:{{ item }}"
57   loop:
58   - quay
59   - clair
60   ignore_errors: true
61
a637ad 62 # Leave this as the last task in the playbook.
WK 63 - name: remove_workload tasks complete
64   debug:
65     msg: "Remove Workload tasks completed successfully."
66   when: not silent|bool