Launching Ansible Tower job template failed with errors


#1

Hi,

I am trying to create a button to launch an simple Ansible Tower job template as shown on Peter McGowan’s book. It failed at launch_ansible_job with the following errors:

[----] I, [2017-02-09T09:14:58.713135 #12018:ebf140]  INFO -- : Q-task_id([resource_action_1000000000156]) Processing State=[Launch]
[----] I, [2017-02-09T09:14:59.316438 #12018:ebf140]  INFO -- : Q-task_id([resource_action_1000000000156]) Updated namespace [ConfigurationManagement/AnsibleTower/Operations/StateMachines/Job/launch_ansible_job  IIS/ConfigurationManagement/AnsibleTower/Operations/StateMachines]
[----] I, [2017-02-09T09:14:59.474302 #12018:ebf140]  INFO -- : Q-task_id([resource_action_1000000000156]) Invoking [inline] method [/IIS/ConfigurationManagement/AnsibleTower/Operations/StateMachines/Job/launch_ansible_job] with inputs [{}]
[----] I, [2017-02-09T09:14:59.475761 #12018:ebf140]  INFO -- : Q-task_id([resource_action_1000000000156]) <AEMethod [/IIS/ConfigurationManagement/AnsibleTower/Operations/StateMachines/Job/launch_ansible_job]> Starting
[----] I, [2017-02-09T09:15:00.203585 #12018:ecb5a8]  INFO -- : Q-task_id([resource_action_1000000000156]) <AEMethod launch_ansible_job> Processing Job Template eric-test
[----] I, [2017-02-09T09:15:00.210176 #12018:ecb5a8]  INFO -- : Q-task_id([resource_action_1000000000156]) <AEMethod launch_ansible_job> Job Arguments {:extra_vars=>{"packages_list"=>"gcc"}, :limit=>"ootest01"}
[----] E, [2017-02-09T09:15:04.391739 #12018:572ead4] ERROR -- : Q-task_id([resource_action_1000000000156]) <AEMethod launch_ansible_job> The following error occurred during method evaluation:
[----] E, [2017-02-09T09:15:04.392449 #12018:572ead4] ERROR -- : Q-task_id([resource_action_1000000000156]) <AEMethod launch_ansible_job>   DRb::DRbConnError: connection closed
[----] E, [2017-02-09T09:15:04.394007 #12018:572ead4] ERROR -- : Q-task_id([resource_action_1000000000156]) <AEMethod launch_ansible_job>   /opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:579:in `load'
/opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:641:in `recv_reply'
/opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:941:in `recv_reply'
/opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1254:in `send_message'
/opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1142:in `block (2 levels) in method_missing'
/opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1229:in `open'
/opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1141:in `block in method_missing'
/opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1160:in `with_friend'
/opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1140:in `method_missing'
<code: job = @handle.vmdb(JOB_CLASS).create_job(job_template, args)>:98:in `run'
<code: run(job_template, target)>:18:in `main'
[----] E, [2017-02-09T09:15:04.399161 #12018:572ead4] ERROR -- : Q-task_id([resource_action_1000000000156]) Method STDERR: /opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:579:in `load': connection closed (DRb::DRbConnError)
[----] E, [2017-02-09T09:15:04.399921 #12018:572ead4] ERROR -- : Q-task_id([resource_action_1000000000156]) Method STDERR:      from /opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:641:in `recv_reply'
[----] E, [2017-02-09T09:15:04.400642 #12018:572ead4] ERROR -- : Q-task_id([resource_action_1000000000156]) Method STDERR:      from /opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:941:in `recv_reply'
[----] E, [2017-02-09T09:15:04.401399 #12018:572ead4] ERROR -- : Q-task_id([resource_action_1000000000156]) Method STDERR:      from /opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1254:in `send_message'
[----] E, [2017-02-09T09:15:04.402079 #12018:572ead4] ERROR -- : Q-task_id([resource_action_1000000000156]) Method STDERR:      from /opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1142:in `block (2 levels) in method_missing'
[----] E, [2017-02-09T09:15:04.402834 #12018:572ead4] ERROR -- : Q-task_id([resource_action_1000000000156]) Method STDERR:      from /opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1229:in `open'
[----] E, [2017-02-09T09:15:04.403488 #12018:572ead4] ERROR -- : Q-task_id([resource_action_1000000000156]) Method STDERR:      from /opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1141:in `block in method_missing'
[----] E, [2017-02-09T09:15:04.404174 #12018:572ead4] ERROR -- : Q-task_id([resource_action_1000000000156]) Method STDERR:      from /opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1160:in `with_friend'
[----] E, [2017-02-09T09:15:04.404911 #12018:572ead4] ERROR -- : Q-task_id([resource_action_1000000000156]) Method STDERR:      from /opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1140:in `method_missing'
[----] E, [2017-02-09T09:15:04.405564 #12018:572ead4] ERROR -- : Q-task_id([resource_action_1000000000156]) Method STDERR:      from <code: job = @handle.vmdb(JOB_CLASS).create_job(job_template, args)>:98:in `run'
[----] E, [2017-02-09T09:15:04.406232 #12018:572ead4] ERROR -- : Q-task_id([resource_action_1000000000156]) Method STDERR:      from <code: run(job_template, target)>:18:in `main'
[----] E, [2017-02-09T09:15:04.406905 #12018:572ead4] ERROR -- : Q-task_id([resource_action_1000000000156]) Method STDERR:      from <code: LaunchAnsibleJob.new($evm).main>:106:in `<main>'
[----] I, [2017-02-09T09:15:04.433906 #12018:ebf140]  INFO -- : Q-task_id([resource_action_1000000000156]) <AEMethod [/IIS/ConfigurationManagement/AnsibleTower/Operations/StateMachines/Job/launch_ansible_job]> Ending
[----] E, [2017-02-09T09:15:04.434807 #12018:ebf140] ERROR -- : Q-task_id([resource_action_1000000000156]) State=<Launch> running  raised exception: <Method exited with rc=Unknown RC: [1]>
[----] W, [2017-02-09T09:15:04.435004 #12018:ebf140]  WARN -- : Q-task_id([resource_action_1000000000156]) Error in State=[Launch]

It seems getting the extra vars and job template OK, but failed when calling Ansible Tower. I tried calling the same job template via REST api and that works fine. Any idea what else to check?

Thanks


#2

Did you use job_template_name?

When you specify a template you can pass one of the following to uniquely identify a job template
job_template object passed in using ConfigurationScript::job_template=<>
job_template_id
job_template_name & ansible_provider_name
job_template_name


#3

Yes, I use “job_template_name” as attribute in the service dialog. It did pick up the job template name “eric-test”

Also, in the tower.log, it got a 400 error

2017-02-08 18:32:28,240 WARNING awx.api.generics status 400 received by user admin attempting to access /api/v1/job_templates/276/launch/ from 172.18.33.62


#4

OK, I found the problem. In the survey of my Ansible Tower job template, packages_list is a multiple selection field ( I am trying to make it install multiple packages at the same time). However, the created service dialog in CloudForms is a Drop Down List that only does a single select. As soon as I changed the survey in Ansible Tower to a single selection multiple choice, the button works fine.

Now it raises another question:

How to create a multiple selection service dialog in CloudForms to match Ansible Tower survey? Is multiple selection drop down list feature in ManageIQ/CloudForms road map for future release?

Thanks