You can do this by looking at the operating system type of the template, which is the attribute $evm.root['miq_provision'].source.platform
(when viewed from the VM Provision state machine). This will either be ‘linux’ or ‘windows’.
I’d probably suggest conditionally launching your post-provisioning step from a Ruby method as a new Ansible service request, then it runs asynchronously with the remainder of the VM Provision state machine. You could use something like (untested):
if $evm.root['miq_provision'].source.platform == 'linux'
service_template = $evm.vmdb(TEMPLATE_CLASS).where(:name => 'Configure a VM').first
credential = $evm.vmdb(CREDENTIAL_CLASS).where(:name => 'Root Password').first
options = {
"credential" => credential.id,
"hosts" => $evm.root['miq_provision'].destination.ipaddresses.first,
"param_something" => "this_or_that"
}
$evm.execute('create_service_provision_request', service_template, options)
end
Another advantage of doing this from a playbook service rather than a playbook method is that you can specify a credential id at launch-time, which might be useful in your scenario.
You might need to add some logic that waits until the VM is booted and has an IP address before you call this.
Hope this helps,
pemcg