[Solved] Variables on Cloud-Init Customization Templates


#1

I’m trying to use variables on a Cloud-Init Customization:

<%
  fqdn = "#{evm[:vm_target_hostname]}.#{evm[:dialog_domain]}"
%>
hostname: <%= fqdn %>

(“dialog_domain” is a dialog variable)

As I understand from the kickstart customization templates examples, it should work. It doesn’t, any idea?

Thanks!


#2

The above code it’s ok.
The problem was on preprovisioning (variable should be proper defined):

[...]
service_template_provision_task = $evm.root['service_template_provision_task']
[...]
service_template_provision_task.miq_request_tasks.each do |child_task|
[...]
  grandchild_tasks = child_task.miq_request_tasks
[...]
  grandchild_tasks.each do |grandchild_task|
[...]
    grandchild_task.set_option(:dialog_domain, domain)

:wink: