stolostron / ansible-collection.core

OCM/ACM Ansible Collection
Apache License 2.0
19 stars 13 forks source link

RHACM Ansible automations failing with AWX #163

Closed asaf-refaeli closed 1 year ago

asaf-refaeli commented 1 year ago

I am trying to run automations using AWX and Red Hat Advanced Cluster Management I configured the Credentilas to my awx server, and created a proper Ansible template. I tried to create a cluster, I selected the template i have created in the 'Automation' section in 'Create Cluster', launched the creation and the pre-hook failed with the error:

curator-job-**** DesiredCuration: install Failed - AnsibleJob test/prehook-xxxx exited with an error. so I went to the created cluster project and saw that there are pods named - prehookjob-****-**** : 0/1 Error I did oc logs on those pods and these are the results:

TASK [job_runner : ansible.controller.job_launch] **************************************************************** [WARNING]: You are using the controller version oc this collection but connecting to AWX fatal: [localhost]: FAILED! => {"changed": false, "errors": ["The field extra vars was specified but the job template does not allow for it to be overridden"], "msg": "Parameters specified which can not be passed into job template, see errors for details"} So I got the yaml of the AnsibleJob that has been created and I noticed that in the 'specs': there is another field that called extra_vars - as written in the error (that i did not put myself) that contains all the details of the created cluster for some reason, for example: clusterName, platform, compute(nodes resources) and all the parameters that i put in while creating the cluster. Is there a way to remove this field while creation? - I think this field makes all the problems. By the way, I tried to manually create the ansible job without the 'extra_vars' field and it worked. Help will be much appreciated, Thank you

andreadecorte commented 1 year ago

your job template needs to have ask_variables_on_launch set to true (displayed as Prompt on launch in the UI)

to fix this

asaf-refaeli commented 1 year ago

@andreadecorte it worked! Thanks a lot!