Embedded Ansible Ouput


Does anyone know how to access the output of the embedded ansible jobs? For example I’m deploying an instance in OpenStack and I want the floating IP address that is auto generated by Ansible to pass in an email to the customer.


$evm.root['service_template_provision_task'].destination should point to your service being created (ansible playbook can be run as service).
The service’s service_resources.first.resource.stdout has your playbook’s output that you could process further.

I did not try to put this into an automation workflow, but rails engine shows the information is there (root_password is an service provisioned from an embedded ansible playbook):

> s=$evm.vmdb(:service).find_by_name('root_password')
> puts s.service_resources.first.resource.stdout

PLAY [all] *********************************************************************

TASK [Log activity] ************************************************************
skipping: [localhost]

TASK [Change root password based on root_password variable] ********************
skipping: [localhost]

PLAY RECAP *********************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=0


Thank you!