Open jfilipcz opened 3 years ago
Hey @jfilipcz I like the direction this is headed. The first thing I am noticing as a potential consumer of this playbook, is that the inventory could be more declarative. When I see the exarmple, I assume that we are wanting the thing to exist:
---
ocp_object_name: argo-app-abc
ocp_object_kind: Application
ocp_object_namespace: argocd-apps
ocp_object_api_version: argoproj.io/v1alpha1
While the current feature request might not be full CRUD functionality, would it make sense to define the state
here in the inventory? The most common pattern would be to have present
assumed and rarely defined, but absent always declared explicitly.
Example playbook:
- name: Manage OpenShift object
k8s:
state: "{{ ocp_object_state | default("present") }}"
Example inventory:
---
ocp_object_name: argo-app-abc
ocp_object_kind: Application
ocp_object_namespace: argocd-apps
ocp_object_api_version: argoproj.io/v1alpha1
ocp_object_state: absent
One other comment, and this may take a bit more time but would be worth the effort. At the moment this would only be able to operate on a single object. It would be nice to have this operate on a list of objects, something like:
---
ocp_objects:
- name: argo-app-abc
kind: Application
namespace: argocd-apps
api_version: argoproj.io/v1alpha1
state: absent
- name: argocd-apps
kind: Namespace
api_version: v1
state: absent
Of course you would need to make the task a loop, but would give us much greater flexibility and let us plug in more functionality later with ease.
What does this PR do?
That PR adds a simple OpenShift Objects Manage Ansible role, along with playbook that uses that and generic inventory
How should this be tested?
Run the object removal on any OpenShift cluster
Is there a relevant Issue open for this?
N/A
Other Relevant info, PRs, etc.
N/A
People to notify
cc: @redhat-cop/infra-ansible