Closed fatimazahrae2104 closed 1 year ago
Hi, based on my understanding of your question: you want to launch a job instance for the job template you created?
inventory
and extra_vars
have prompt on launch enabled on the awx side if you want to use those optional fields.Hello @mikeshng, First of all thank you for your immediate response.
I already created the secret where I put the awx token which I generated from https://awxhost/api/v2/tokens (can you Confirm this pls?)
I created the Ansible Job for the job template but I don't get the output of the job as I get it on Tower.
kubectl -n awx logs -f job.batch/demo-job9mn2s
However my Inventory contains localhost as a unique host with Prompt on launch checked, and I don't have extra vars so I deleted this section.
Hi, this is working as expected for now.
The AnsibleJob CR triggers the job launch and gives you an overview of the result of the tower job. So if you do:
kubectl -n awx get AnsibleJob demo-job
status:
ansibleJobResult:
changed: true
failed: false
status: error
url: >-
https://ansible-tower-web-svc-tower.apps.-redacted-.com/#/jobs/playbook/5
Users are meant to use that url and actually see the all the details of the job execution. Maybe you can make a feature request regarding displaying the output of the actual tower job execution log in Kubernetes log some where?
As for the secret, it should be fine since you were able to create a job and communicate with the awx/tower successfully.
Actually, it's not very important for me to display the AnsibleJob execution log using Kubernetes as long as I can see it on tower, but I just thought that I didn't follow the right steps to make them appear in kubernetes, but now it's fine :) .
But what if I want to re-execute the Job Template, should I create another Ansible Job to do So?
Yep. Each AnsibleJob represent an instance of Job on awx/tower. It behaves similar to how awx/tower keeps a list of already ran jobs. In short, to re-execute use https://github.com/ansible/awx-resource-operator/blob/devel/deploy/crds/tower.ansible.com_v1alpha1_joblaunch_cr.yaml#L4 which should give you another instance with a unique enough suffix.
your 2nd question
The operator does not need to communicate with your "target hosts", it only needs to talk to the tower. The tower is responsible for communicating with the various hosts that it's managing. In short, without using the operator, first make sure the Job Template can be executed successfully using your AWX/Tower instance only. Then afterwards, you can use the operator to trigger those jobs.
Hello @mikeshng
Ok, so the role of this operator is only to trigger the jobs created on AWX, nothing else, is it?
Right, as of now, this operator is only responsible for managing job templates and creating job instances for job templates.
See the CRDs and examples that this operator deals with here: https://github.com/ansible/awx-resource-operator/tree/devel/deploy/crds
Ok, I got it now.
Thank you so much for the help 👍
It would seem all questions have been answered. I would suggest /close
@fatimazahrae2104 would you confirm you are satisfied and close this issue?
Recently I deployed Ansible AWX on my Openshift cluster, and it works fine, and I also deployed the Ansible automation platform resource operator from the OperatorHub, Then I used the Ansible JobTemplate API instance, where I mentioned all the informations of the JobTemplate i have already on my AWX.
I want to know how to launch the JobTemplate from the Operator, can anyone help me how it works?!!
Thanks in advance!
This is my JobTemplate yaml.