ansible / awx-resource-operator

41 stars 34 forks source link

Upgrade Operator-SDK to 1.12.0 #53

Closed rooftopcellist closed 2 years ago

rooftopcellist commented 3 years ago

PR for awx-operator: https://github.com/ansible/awx-operator/pull/569

This dramatically changes the structure of the repo. Here are some highlights:

rooftopcellist commented 2 years ago

I can now create an AnsibleJob and get the stdout from the CR.

Secret

$ cat awxaccess-secret.yml 
apiVersion: v1
kind: Secret
metadata:
  name: awxaccess
  type: Opaque
stringData:
  token: <redacted>
  host: https://e2e9-107-<redacted>.ngrok.io

I was testing manually with the operator deployed on a cluster in the public cloud, so I used ngrok to make my local awx dev environment available temporarily.

AnsibleJob yaml

$ cat launch-job-cr.yml 
---
apiVersion: tower.ansible.com/v1alpha1
kind: AnsibleJob
metadata:
  generateName: demo-job-1 # generate a unique suffix per 'kubectl create'
spec:
  tower_auth_secret: awxaccess
  job_template_name: Demo Job Template
  inventory: Demo Inventory # Inventory prompt on launch needs to be enabled
  extra_vars: # Extra variables prompt on launch needs to be enabled
    test_var: test

Apply the yaml to create the resources.

oc create -f awxaccess-secret.yml
oc create -f launch-job-cr.yml

image

Resulting job:

image

Similarly, I can create JobTemplates

$ cat create-jt.yml 
apiVersion: tower.ansible.com/v1alpha1
kind: JobTemplate
metadata:
  generateName: jobtemplate-
spec:
  tower_auth_secret: awxaccess
  job_template_name: ExampleJobTemplate
  job_template_project: Demo Project
  job_template_playbook: hello_world.yml
  job_template_inventory: Demo Inventory

image