How to pass dialog values to embedded ansible playbook

#1

Hi,

I have something like this

I can see the value in the object walker

 |    |    $evm.root['miq_provision'].options[:dialog_password] = test-1   (type: String

But it is not passed to the playbook

INFO -- : Q-task_id([miq_provision_1000000000228]) Invoking [playbook] method [/TALMER/Infrastructure/VM/Provisioning/StateMachines/Methods/change_root_password] with inputs [{"password"=>""}]

Is there any way to pass the values from the dialog inside the embedded ansible call? This must be done as a part of provisioning process and must be non interactively.

#2

Your parameter default value of ${/#dialog_password} is trying to translate $evm.root['dialog_password'] which probably doesn’t exist. Try something like ${/#miq_provision.options.fetch(:dialog_password)}

#3

Hi, thank you for your help. Can you please share the doc, where I can find complete list of methods available for substitution? (Didn’t know there was ‘fetch’ method here)

#4

fetch is standard Ruby (https://apidock.com/ruby/Hash/fetch) and is a useful way of accessing a hash key.

value = my_hash[:this_key]
value = my_hash.fetch(:this_key)

It’s especially useful in a substitution string where the ‘[’ & ‘]’ characters are not legal.

pemcg

#5

So any ruby method is valid here? And what are the limitations? Except for the ‘[’ ‘]’?