# Execute a python script on a remote server

**URL:** <https://forum.ansible.com/t/execute-a-python-script-on-a-remote-server/14360>\
**Category:** Ansible Project\
**Created:** [January 16, 2014, 11:44am UTC](https://forum.ansible.com/t/execute-a-python-script-on-a-remote-server/14360 "2014-01-16T11:44:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chinmaya\_Patanaik](https://avatars.discourse-cdn.com/v4/letter/c/7feea3/32.png) [@Chinmaya\_Patanaik](https://forum.ansible.com/u/Chinmaya_Patanaik)\
**Post date:** [January 16, 2014, 11:44am UTC](https://forum.ansible.com/t/execute-a-python-script-on-a-remote-server/14360/1 "2014-01-16T11:44:24Z")

</div>

I am planning to execute a python script on a remote server using ansible playbook.

src.py -

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [January 16, 2014, 3:36pm UTC](https://forum.ansible.com/t/execute-a-python-script-on-a-remote-server/14360/2 "2014-01-16T15:36:48Z")

</div>

You are using local\_action to run the command module, which will attempt to run the python script on localhost.

Additionally, if you are using the python binary to invoke the script, you won’t need to make it executable.

---

<div class="post-metadata">

**Author:** ![Robert\_Wehner](https://avatars.discourse-cdn.com/v4/letter/r/51bf81/32.png) [@Robert\_Wehner](https://forum.ansible.com/u/Robert_Wehner)\
**Post date:** [January 16, 2014, 6:04pm UTC](https://forum.ansible.com/t/execute-a-python-script-on-a-remote-server/14360/3 "2014-01-16T18:04:00Z")

</div>

You might try using the ‘script’ module ([http://docs.ansible.com/script\_module.html](http://docs.ansible.com/script_module.html)). I think it’ll do what you want in a single task.
