12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- ---
- - name: "Checking for logging project"
- command: oc get project logging
- register: logging_project
- failed_when: "'FAILED' in logging_project.stderr"
- tags:
- - cleanup
- - name: "Changing projects"
- command: oc project logging
- tags:
- - cleanup
- - build
- - name: Create temp directory for kubeconfig
- command: mktemp -d /tmp/openshift-ansible-XXXXXX
- register: mktemp
- changed_when: False
- - name: Copy the admin client config(s)
- command: >
- cp {{ openshift_master_config_dir }}/admin.kubeconfig {{ mktemp.stdout }}/admin.kubeconfig
- changed_when: False
- - name: "Changing projects"
- command: oc project logging
- tags:
- - cleanup
- - build
- - name: "Cleanup any previous logging infrastructure"
- command: oc delete --ignore-not-found all --selector logging-infra={{ item }}
- with_items:
- - kibana
- - fluentd
- - elasticsearch
- ignore_errors: yes
- tags:
- - cleanup
- - name: "Cleanup existing support infrastructure"
- command: oc delete --ignore-not-found all,sa,oauthclient --selector logging-infra=support
- ignore_errors: yes
- tags:
- - cleanup
- - name: "Cleanup existing secrets"
- command: oc delete secret logging-fluentd logging-elasticsearch logging-es-proxy logging-kibana logging-kibana-proxy logging-kibana-ops-proxy
- ignore_errors: yes
- register: clean_result
- failed_when: clean_result.rc == 1 and 'not found' not in clean_result.stderr
- tags:
- - cleanup
- - name: "Cleanup existing logging deployers"
- command: oc delete pods --all
- tags:
- - cleanup
- - name: "Make sure to remove deployer template"
- command: oc delete template logging-deployer-template -n openshift
- register: delete_ouput
- failed_when: delete_ouput.rc == 1 and 'exists' not in delete_ouput.stderr
- tags:
- - cleanup
- - name: Delete temp directory
- file:
- name: "{{ mktemp.stdout }}"
- state: absent
- changed_when: False
- - debug: msg="Success!"
|