I have created a new domain, namespace, class, Instances and 2 methods.
Method 1 : method type - Playbook
-
hosts: localhost
connection: local
gather_facts: falsevars:
- manageiq_validate_certs: false
roles:
- syncrou.manageiq-automate
tasks:
-
name: task1
xyz module:
register: output -
name:
set_stats:
data:
ansi_output: “{{ output }}” -
name: print info
debug:
var: item
with_items: “{{ output | json_query(‘output[*].name’) }}” -
name: “Set an attribute”
manageiq_automate:
workspace: “{{ workspace }}”
set_attribute:
object: “root”
attribute: “ansi_output”
value: “{{ output }}”
register: workspace -
name: “Save the job ID back into $evm.root”
manageiq_automate:
workspace: “{{ workspace }}”
set_attribute:
object: “root”
attribute: “tower_job_id”
value: “{{ tower_job_id }}”
Method 2 : method type - inline
Trying to call ansible playbook method
$evm.instantiate(‘domain/namespace/class/Instance Name’)
JOB_CLASS = ‘ManageIQ_Providers_EmbeddedAnsible_AutomationManager_Job’.freeze
tower_job_id = $evm.root[‘tower_job_id’].to_s
if tower_job_id.blank?
raise “No Tower Job ID returned, cannot get output”
else
job = $evm.vmdb(JOB_CLASS).where([“ems_ref = ?”, tower_job_id]).first
$evm.log(:info, “Output from previous Ansible playbook: \n#{job.stdout}”)
end
Setting values to dynamic drop down
dialog_field = $evm.object
dialog_field[“data_type”] = “string”
dialog_field[“value”] = $evm.get_state_var(“ansible_stats_ansi_output”)
I am getting Script error in the dynamic dropdown field
Need help to troubleshoot and resolve the error.
Please provide your suggestions.