Hi Everyone,
I am quite new to ManageIQ automation and I am trying to automate provisioning of VM’s with cloud-init and Ansible.
-
I have created a new tags category like ansibleroles and added tags based on roles like apache, jboss etc. User has to select appropriate tags for the role they want VM to have.
-
Now I want to use these selected tags by user in cloud init script . Similar to what we do for assigning hostname, password , fqdn
chpasswd:
expire: false
list: "root:<%= MiqPassword.decrypt(evm[:root_password]) %>\n"
hostname: <%= (evm[:hostname]) %>
fqdn: <%= evm[:hostname] %>.example.comHere I want to use tag variable values using something like <%= (evm[:ansibleroles]) %>
But getting empty values
I have also added following method in postprovision
tags = prov.get_tags
$evm.log(“info”,“Tags: #{tags.inspect}”)
ansibleroles = tags[:ansibleroles]
$evm.log(“info”, “Mapping custom spec based on Category RoleofVM < #{ansibleroles} > chosen in the dialog”)
EVM logs here throws the correct tags selected by user but I am not able to use this in cloud-init script.
Most likely either I am missing something or may be this approach is not right.
Can anyone point me to the right direction ?
Thanks