# vim: set ft=ansible
|
---
|
# Implement your Workload removal tasks here
|
- name: remove logging cr
|
k8s:
|
state: absent
|
definition:
|
apiVersion: "logging.openshift.io/v1"
|
kind: "ClusterLogging"
|
metadata:
|
name: "instance"
|
namespace: "openshift-logging"
|
|
# operator nukes all pods once cr is gone
|
# waiting for just one to remain is a bit of a hack
|
- name: wait for only one pod
|
k8s_facts:
|
api_version: v1
|
kind: Pod
|
namespace: openshift-logging
|
register: logging_pods
|
until: logging_pods.resources | list | length <= 1
|
retries: 100
|
delay: 10
|
|
- name: logging operatorgroup
|
k8s:
|
state: absent
|
definition:
|
apiVersion: operators.coreos.com/v1
|
kind: OperatorGroup
|
metadata:
|
name: openshift-logging-operatorgroup
|
namespace: openshift-logging
|
|
### elastic catalog source config
|
- name: catalog source config
|
k8s:
|
state: absent
|
definition:
|
apiVersion: operators.coreos.com/v1
|
kind: CatalogSourceConfig
|
metadata:
|
name: elasticsearch-operator
|
namespace: openshift-marketplace
|
|
### elastic subscription
|
- name: elastic subscription
|
k8s:
|
state: absent
|
definition:
|
apiVersion: operators.coreos.com/v1alpha1
|
kind: Subscription
|
metadata:
|
name: elasticsearch-operator
|
namespace: openshift-operators
|
|
### logging catalog source config
|
- name: logging catalog source config
|
k8s:
|
state: absent
|
definition:
|
apiVersion: operators.coreos.com/v1
|
kind: CatalogSourceConfig
|
metadata:
|
name: cluster-logging-operator
|
namespace: openshift-marketplace
|
|
### logging subscription
|
- name: logging subscription
|
k8s:
|
state: absent
|
definition:
|
apiVersion: operators.coreos.com/v1alpha1
|
kind: Subscription
|
metadata:
|
name: cluster-logging
|
namespace: openshift-logging
|
|
- name: logging project
|
k8s:
|
state: absent
|
definition:
|
apiVersion: v1
|
kind: Namespace
|
metadata:
|
name: openshift-logging
|
|
# Leave this as the last task in the playbook.
|
- name: remove_workload tasks complete
|
debug:
|
msg: "Remove Workload tasks completed successfully."
|
when: not silent|bool
|