Running an Embedded Ansible Playbook method as part of an Automate State Machine



Use Case: Provision a VM using CFME and then run an Ansible Playbook on the newly provisioned VM.

  • Provision a VM thats gets an ip address. (vmware tools installed)Ansible vmware tools installed

  • Update the State Machine and add 2 steps (WaitForIP and Playbook)

  • Use METHOD:: syntax in your State Machine for WaitForIp:

  • If you don’t use the WaitForIp method the VM will not be ready and the Playbook will fail. The WaitForIp method will retry until the VM is ready.

Ansible Host field value

       -  For Cloud: ${/#miq_provision.destination.floating_ip_addresses.first}

Ansible Cloud host field value


What’s in mk_sample_playbook? Why don’t you use /AutomationManagement/AnsibleTower/Operations/Statemachines/Job/default ?



My use case is: If you want to have CFME provision a VM and then run a playbook as part of the provisioning workflow.

mk_sample_playbook is a very simple playbook which requires some input values to be passed to it. If you just wanted to run this playbook on an existing VM, you could setup a service and run it using /AutomationManagement/AnsibleTower/Operations/Statemachines/Job/default.