Using a different provisioning state machine for user group


#1

Hi, I want to run an embedded ansible playbook against a provisioned VM when a certain group provisions a VMware VM. I want to run the playbook according to this article

I think,

that kicks off the ansible playbook via the provisioning state machine. But I don’t want all VMs provisioned in MIQ to use that state machine. Am I correct in thinking that I create a profile for that group under provisioning/profile and copy the [provision vm from template] statemachine to a new name and modify it per the article above and call that from the profile? Or is there a better way to do it? Diving a little deeper into automate than I have gone before, any advice pointers to examples or anything is appreciated.

Bill


#2

I’d follow your approach. You may want to read The Provisioning Profile section in the book, if you have not done so.


#3

thanks, that is what I was reading… its just it seemed to think ALL VMs needed to be and I want to do it by a specific groups. Appreciate your input!

Bill


#4

Just had an idea if you don’t want to maintain two state machines. In the extra instance (referenced from the state machine) add an assertion something like "${/#miq_group.name} == 'mygroup'" to prevent the instance running except for the desired group. You need to create this instance to trigger Ansible, and cannot use the direct METHOD:: notation in this case in the state machine, but can fine-tune the conditions when to run the runbook.