# Get result content of ansible.playbook Playbook in python

**URL:** <https://forum.ansible.com/t/get-result-content-of-ansible-playbook-playbook-in-python/21539>\
**Category:** Ansible Project\
**Created:** [May 24, 2016, 12:43pm UTC](https://forum.ansible.com/t/get-result-content-of-ansible-playbook-playbook-in-python/21539 "2016-05-24T12:43:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![evelastlast](https://avatars.discourse-cdn.com/v4/letter/e/43a26b/32.png) [@evelastlast](https://forum.ansible.com/u/evelastlast)\
**Post date:** [May 24, 2016, 12:43pm UTC](https://forum.ansible.com/t/get-result-content-of-ansible-playbook-playbook-in-python/21539/1 "2016-05-24T12:43:45Z")

</div>

Hello,

I have a playbook.yml which outputs password, please see this task:

`

tasks:

- name: get  
command: echo {{ test\_password }}  
register: result

- debug: var=result.stdout\_lines

`

I run this playbook in python script:

`

def run\_playbook():  
stats = callbacks.AggregateStats()  
playbook\_cb = callbacks.PlaybookCallbacks(  
verbose=ansible.utils.VERBOSITY)  
runner\_cb = callbacks.PlaybookRunnerCallbacks(  
stats, verbose=ansible.utils.VERBOSITY)  
pb = PlayBook(playbook=‘playbook.yml’,  
stats=stats,  
callbacks=playbook\_cb,  
runner\_callbacks=runner\_cb,  
check=True,  
vault\_password=‘abcd’)  
pb.run()

`

`Print pb`

returns an object, but I fail to figure out how to return the content of password so I can use it in the python script for the authentication.  
Any ideas?

Thanks in advance,  
Eve
