Added labels to AWX kind resource

This commit is contained in:
Marcelo Moreira de Mello
2021-04-07 00:35:56 -04:00
parent f73cff3cb3
commit 4d4ed3e827
2 changed files with 33 additions and 0 deletions

View File

@@ -7,6 +7,22 @@
ansible_python_interpreter: '{{ ansible_playbook_python }}'
tasks:
- name: Get AWX Kind data
k8s_info:
api_version: awx.ansible.com/v1beta1
kind: AWX
namespace: example-awx
label_selectors:
- "app.kubernetes.io/name=example-awx"
- "app.kubernetes.io/part-of=example-awx"
- "app.kubernetes.io/managed-by=awx-operator"
- "app.kubernetes.io/component=awx"
register: awx_kind
- name: Verify there is one AWX kind
assert:
that: '{{ (awx_kind.resources | length) == 1 }}'
- name: Get AWX Pod data
k8s_info:
kind: Pod

View File

@@ -1,4 +1,21 @@
---
- name: Patching labels to AWX kind
k8s:
state: present
definition:
apiVersion: awx.ansible.com/v1beta1
kind: AWX
name: '{{ meta.name }}'
namespace: '{{ meta.namespace }}'
metadata:
name: '{{ meta.name }}'
namespace: '{{ meta.namespace }}'
labels:
app.kubernetes.io/name: '{{ meta.name }}'
app.kubernetes.io/part-of: '{{ meta.name }}'
app.kubernetes.io/managed-by: awx-operator
app.kubernetes.io/component: awx
- name: Get current version
set_fact:
tower_image_version: "{{ tower_image.split(':')[1] }}"