Ansible Tower call with evaluated `'job_template_name' does not work


#1

Hello All,

We are trying to launch a job template.

The method calculating which template to call is the following:

 if  $evm.get_state_var(:OS) == "linux"
  $evm.root['job_template_name'] = "cf_postinstall_linux"
  else
  $evm.root['job_template_name'] = "cf_postintall_windows"
end
$evm.log(:info, "TWR AD registration job:  #{$evm.root['job_template_name']}")

``
Then we call the Tower Job via a relation with:

/AutomationManagement/AnsibleTower/Operations/StateMachines/Job/default?job_template_name=${/#job_template_name} 

`According to logs, the call is correct:

Following Relationship [miqaedb:/AutomationManagement/AnsibleTower/Operations/StateMachines/Job/default?job_template_name=cf-postintall-linux#create]

Followed  Relationship [miqaedb:/AutomationManagement/AnsibleTower/Operations/StateMachines/Job/default?job_template_name=cf-postintall-linux#create]

``However the job template call is giving:

Following Relationship [miqaedb:/AutomationManagement/AnsibleTower/Operations/StateMachines/Job/default?job_template_name=#create] `

The job_template_name is empty when the actual template method is called.

Does anyone see a syntax or usage error here?

Calling the Job by statically defining a job_template_name variable value, and then pointing to that instance, makes it work perfectly.

However we need it to be as evaluated as possible.

Instantiation is an alternative however, it would be interesting to identify the root cause.

Any ideas will be highly appreciated.