# Executing python script on ansible master once playbook finishes

**URL:** <https://forum.ansible.com/t/executing-python-script-on-ansible-master-once-playbook-finishes/20647>\
**Category:** Ansible Project\
**Created:** [February 22, 2016, 10:37am UTC](https://forum.ansible.com/t/executing-python-script-on-ansible-master-once-playbook-finishes/20647 "2016-02-22T10:37:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin\_Schenk](https://avatars.discourse-cdn.com/v4/letter/m/e5b9ba/32.png) [@Martin\_Schenk](https://forum.ansible.com/u/Martin_Schenk)\
**Post date:** [February 22, 2016, 10:37am UTC](https://forum.ansible.com/t/executing-python-script-on-ansible-master-once-playbook-finishes/20647/1 "2016-02-22T10:37:51Z")

</div>

Dear all,

i am new to the awesomeness of ansible.  
i’ve done some playbooks for now an am amazed of the capability of ansible. 🙂  
great product.

Now i got to a certain point where i could need some help.

My Setup:  
The ansible version i am using is: Anisble 1.9.4  
I am running ansible on a Red Hat Enterprise Linux Server release 6.7 (Santiago)  
i am controlling Linux nodes with Ansible from the same system distribution

My Problem/Question:  
I’ve created a Playbook that is going to copy a template towards my node.  
while doing this it inserts some facts information via the template plugin.  
After that i am going to fetch that file back to my Ansible master.

Now i want to execute a local python script on my ansible master to parse those files into a database.  
But i don’t have any idea how to do that.  
I would be so happy if anyone could give me a hint 🙂

Thanks in advance.

Best regards,  
Martin

Playbook

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [February 22, 2016, 1:55pm UTC](https://forum.ansible.com/t/executing-python-script-on-ansible-master-once-playbook-finishes/20647/2 "2016-02-22T13:55:21Z")

</div>

something like this:

- name: run script locally # can also use the script module  
shell: /path/to/script  
delegate\_to: localhost  
run\_once: True

---

<div class="post-metadata">

**Author:** ![Martin\_Schenk](https://avatars.discourse-cdn.com/v4/letter/m/e5b9ba/32.png) [@Martin\_Schenk](https://forum.ansible.com/u/Martin_Schenk)\
**Post date:** [February 22, 2016, 2:39pm UTC](https://forum.ansible.com/t/executing-python-script-on-ansible-master-once-playbook-finishes/20647/3 "2016-02-22T14:39:47Z")

</div>

DUDE!  
thank you so much! ^^  
it is exactly what i was looking for!

hell yeah ;D

again, thank you very much
