Skip to content

Commit

Permalink
Initial commit for OpenShift Object Remove role
Browse files Browse the repository at this point in the history
  • Loading branch information
jfilipcz committed Sep 9, 2021
1 parent d84a5ab commit 339f6d1
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 0 deletions.
1 change: 1 addition & 0 deletions inventory/openshift-api/group_vars/all.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
---
4 changes: 4 additions & 0 deletions inventory/openshift-api/host_vars/localhost.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---

ansible_connection: local

3 changes: 3 additions & 0 deletions inventory/openshift-api/hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[openshift_api]
localhost

6 changes: 6 additions & 0 deletions playbooks/openshift-remove-object.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---

- hosts: openshift_api
roles:
- role: openshift/remove-object

54 changes: 54 additions & 0 deletions roles/openshift/remove-object/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
remove-openshift-object
========================

This role is used to remove specific OpenShift object. Role is expected to be run on Ansible Host running within OpenShift cluster, that's a target for object removal

## Requirements

- Ansible Host running within targetted OpenShift cluster


## Role Variables


| Variable | Description | Required | Defaults |
|:---------|:------------|:---------|:---------|
|ocp_object_name|Name of OpenShift object to be removed|yes||
|ocp_object_kind|Kind of object to be removed|yes||
|ocp_object_namespace|OpenShift Namespace in which object to be removed resides|yes||
|ocp_object_api_version|API version used for object|yes||




## Example Inventory

```yaml
---
ocp_object_name: argo-app-abc
ocp_object_kind: Application
ocp_object_namespace: argocd-apps
ocp_object_api_version: argoproj.io/v1alpha1

```
## Example Playbook
```yaml
---

- hosts: openshift-api
roles:
- role: remove-openshift-object
```
License
-------
Apache License 2.0
Author Information
------------------
Red Hat Community of Practice & staff of the Red Hat Open Innovation Labs.
1 change: 1 addition & 0 deletions roles/openshift/remove-object/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
---
3 changes: 3 additions & 0 deletions roles/openshift/remove-object/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---

- import_tasks: remove_object.yml
8 changes: 8 additions & 0 deletions roles/openshift/remove-object/tasks/remove_object.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
- name: Remove OpenShift object
k8s:
state: absent
name: "{{ ocp_object_name }}"
api_version: "{{ ocp_object_api_version }}"
kind: "{{ ocp_object_kind }}"
namespace: "{{ ocp_object_namespace }}"

0 comments on commit 339f6d1

Please sign in to comment.