# How to add python path to environment variable using ansible

**URL:** <https://forum.ansible.com/t/how-to-add-python-path-to-environment-variable-using-ansible/33811>\
**Category:** Ansible Project\
**Created:** [September 15, 2020, 11:52am UTC](https://forum.ansible.com/t/how-to-add-python-path-to-environment-variable-using-ansible/33811 "2020-09-15T11:52:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![surabhy\_vaishakh](https://avatars.discourse-cdn.com/v4/letter/s/f07891/32.png) [@surabhy\_vaishakh](https://forum.ansible.com/u/surabhy_vaishakh)\
**Post date:** [September 15, 2020, 11:52am UTC](https://forum.ansible.com/t/how-to-add-python-path-to-environment-variable-using-ansible/33811/1 "2020-09-15T11:52:12Z")

</div>

Can any one help with this?

I am trying to install python 2.7 msi using ansible. Installation succeeded. But not sure how to add to environment variable using ansible.

Pls help.

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [September 15, 2020, 12:09pm UTC](https://forum.ansible.com/t/how-to-add-python-path-to-environment-variable-using-ansible/33811/2 "2020-09-15T12:09:43Z")

</div>

[https://docs.ansible.com/ansible/latest/modules/win\_environment\_module.html](https://docs.ansible.com/ansible/latest/modules/win_environment_module.html) ?

---

<div class="post-metadata">

**Author:** ![surabhy\_vaishakh](https://avatars.discourse-cdn.com/v4/letter/s/f07891/32.png) [@surabhy\_vaishakh](https://forum.ansible.com/u/surabhy_vaishakh)\
**Post date:** [September 16, 2020, 4:43am UTC](https://forum.ansible.com/t/how-to-add-python-path-to-environment-variable-using-ansible/33811/3 "2020-09-16T04:43:23Z")

</div>

Thanks for you help.  
I have tried using this module. Looks like post installation required a restart to work this. How can i avoid a restart.  
server node: windows 2012 R

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [September 16, 2020, 9:14am UTC](https://forum.ansible.com/t/how-to-add-python-path-to-environment-variable-using-ansible/33811/4 "2020-09-16T09:14:17Z")

</div>

> Thanks for you help.  
> I have tried using this module. Looks like post installation required a restart to work this. How can i avoid a restart.  
> server node: windows 2012 R

That is a question specific to the application specific question, or a  
Windows sysadmin question. Either way it's not something related to  
ansible.  
I would first check the docs for the python installer if I had to guess.
