Pass automate workspace GUID to External Tower/AWX

I have a requirement to get information from an ansible playbook which runs on an external AWX host into ManageIQ.
I am currently able to launch the playbook from Ruby and wait for the task to complete. But I am unable to figure out where to get the GUID for the automate_workspace in order to get Ansible to update the workspace so that I can use the result in Ruby.
The playbook run against a windows server and produces an array which I need inside ruby.
I am currently testing using a custom button, but eventually need to run this as part of a new deployment.

Regards
Fred

If you have the job template defined as a ‘Ansible Tower Job Template’ automate method type, then you should get the manageiq.* extra_vars passed into the playbook that will allow to you connect back using the syncrou.manageiq-automate role. That was a new feature with MIQ Ivanchuk.

Hope the helps,
pemcg

Unfortunately I am trying to do this with SCVMM. So was hoping there is some attribute that links to the the automation_workspace. From what I understand $evm is the workspace. I tried all kinds of things with looking at the $evm and $evm.root objects trying to see what methods and attributes they contain but can’t seem to get the guid out which links to the automate_workspace.

Did you look at the manageiq.automate_workspace playbook variable? It should be something like:

“automate_workspace”: “automate_workspaces/cf7df7bd-b871-46e3-a634-a3c30d644e5c”

SCVMM should be irrelevant as long as your AWX server is added as a Tower provider in ManageIQ.

pemcg

I don’t get manageiq_connection other other values being passed into the AWX instance extra vars. I am not using the embedded ansible. The only values being passed in are those I define in dialog_param, etc.

Are you creating an automate method of type “Ansible Tower Job Template”?

The automate workspace is only accessible from playbook methods, not playbook (or Tower job template) services.

pemcg

I was trying to use inline:
ANSIBLE_NAMESPACE = ‘AutomationManagement/AnsibleTower/Operations/StateMachines’.freeze
ANSIBLE_STATE_MACHINE_CLASS = ‘Job’.freeze
ANSIBLE_STATE_MACHINE_INSTANCE = ‘default’.freeze
request = $evm.execute(‘create_automation_request’, options, $evm.root[‘user’].userid, auto_approve)

I have tested it with the Tower Job Template and that passes the values through.
Thanks for the pointer in that direction.
I will use that instead.

Best Regards
Fred