Running vRO Workflows from Ansible playbook

I had a need to run vRealize Orchestrator workflow directly form my Ansible Tower.
To do that I wrote a dedicated Ansible module that allows to run any vRO workflow form Ansible playbook. This is useful if you want to reuse automation you already done in vRO or if you are dealing with something that is simple to do in vRO like VUM automation but difficult or impossible otherwise. I’m using it to import bare-metal servers as DynamicType in to my vRA instance.

Ansible library code is also accessible here: https://github.com/oporanski/Ansible_RunvROWorkflow

Short instruction:

  • Download the Ansible module below,
  • Create library folder,
  • Put there a downloaded file: run_vro_workflow.py
  • Create playbook my_playbook.yaml
  • run: ansible-playbook myplaybook.yaml

How does it work:
You have to create a vRO workflow that will be run form Ansible. Only string and array strings are allowed as inputs

Note Workflow ID on the first tab it will be needed for Ansible playbook

Now create playbook (I’ll not cover a role creation or password handling in Ansible here):

---

- hosts: localhost
  tasks:
    - name: Create Baseline - Run vRO Workflow
      run_vro_wf:
        vro_server: "https://vro.domain.corp:8281"
        username: "Administrator@vsphere.local"
        password: "my$ecredPassw0rd"
        workflow_id: "09122576-4c03-4e3b-9aca-363644d2b64a"
        input_values:
          msg: TestFromAnsible
          list: 
            - VM1
            - VM2
            - VM3
      register: result
    - name: output result
      debug: 
        msg: " {{ result }} "

Run your playbook and watch vRO workflow tokens toy should see a new run…

Ansible Module: