Home:ALL Converter>Ansible: return value from playbook

Ansible: return value from playbook

Ask Time:2014-11-21T05:17:31         Author:Xanxir

Json Formatter

Is there a way to return a value from one included playbook to use in another? Consider the following playbook:

 ---
 - include: provisionPostgres.yml store=09123
 - include: provisionWebserver.yml store=09123

Each of these included playbooks provisions an AWS instance, and then installs software on that instance. Postgres and my web app respectively.

The use case I'm trying to handle is to have the first included playbook return the IP address of my database server so that I can use it to point my web server to in the 2nd included playbook.

I know that I can register values from tasks to use in other tasks, but I can't find out how to return a value from a playbook.

How can I accomplish this in ansible?

Author:Xanxir,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/27049723/ansible-return-value-from-playbook
yy