# Using Ansible in Python Licensing Question

**URL:** <https://forum.ansible.com/t/using-ansible-in-python-licensing-question/20006>\
**Category:** Ansible Developer\
**Created:** [December 14, 2015, 8:28pm UTC](https://forum.ansible.com/t/using-ansible-in-python-licensing-question/20006 "2015-12-14T20:28:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Usman\_Ehtesham](https://avatars.discourse-cdn.com/v4/letter/u/8e8cbc/32.png) [@Usman\_Ehtesham](https://forum.ansible.com/u/Usman_Ehtesham)\
**Post date:** [December 14, 2015, 8:28pm UTC](https://forum.ansible.com/t/using-ansible-in-python-licensing-question/20006/1 "2015-12-14T20:28:12Z")

</div>

Hello,

I wanted to import ansible in my Python code; this is for work. But i was told the following:

“Any python code that you import from ansible automatically requires the code your writing to be licensed under the GPL  
You are legally required to open source that code even if does not want you to”

Is this true?

---

<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:** [December 15, 2015, 12:09am UTC](https://forum.ansible.com/t/using-ansible-in-python-licensing-question/20006/2 "2015-12-15T00:09:56Z")

</div>

As in with all legal questions, check with your company's legal  
department. IANAL and this is not legal advice.

The GPL license (under which Ansible is distributed) requires  
redistribution under the same license of any code that uses GPL code.

Ansible does ship some code under a BSD v2 license, the files in  
lib/ansible/module\_utils this is so you can still use the facilities  
to easily produce modules but use any licensing they want to  
distribute them.

---

<div class="post-metadata">

**Author:** ![Toshio\_Kuratomi](https://avatars.discourse-cdn.com/v4/letter/t/41988e/32.png) [@Toshio\_Kuratomi](https://forum.ansible.com/u/Toshio_Kuratomi)\
**Post date:** [December 15, 2015, 3:57am UTC](https://forum.ansible.com/t/using-ansible-in-python-licensing-question/20006/3 "2015-12-15T03:57:31Z")

</div>

Also, it is generally accepted that calling out to a program does not  
subject your code to the GPL in the way that using a library does. So  
most lawyers will tell you that you can use /usr/bin/ansible and  
/usr/bin/ansible-playbook via python's subprocess.Popen() without  
releasing your code as GPL.

As with any legal question, though, and as Brian mentioned, you'll  
want to talk to your lawyer about this.

-Toshio

---

<div class="post-metadata">

**Author:** ![Serge\_van\_Ginderacht](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@Serge\_van\_Ginderacht](https://forum.ansible.com/u/Serge_van_Ginderacht)\
**Post date:** [December 15, 2015, 8:38am UTC](https://forum.ansible.com/t/using-ansible-in-python-licensing-question/20006/4 "2015-12-15T08:38:58Z")

</div>

​Is that what Tower does?

- Serge​

---

<div class="post-metadata">

**Author:** ![Chris\_Church1](https://avatars.discourse-cdn.com/v4/letter/c/ac8455/32.png) [@Chris\_Church1](https://forum.ansible.com/u/Chris_Church1)\
**Post date:** [December 15, 2015, 1:46pm UTC](https://forum.ansible.com/t/using-ansible-in-python-licensing-question/20006/5 "2015-12-15T13:46:03Z")

</div>

Yes. Tower runs ansible and ansible-playbook as subprocesses with  
appropriate command line options and environment variables.

---

<div class="post-metadata">

**Author:** ![Usman\_Ehtesham](https://avatars.discourse-cdn.com/v4/letter/u/8e8cbc/32.png) [@Usman\_Ehtesham](https://forum.ansible.com/u/Usman_Ehtesham)\
**Post date:** [December 15, 2015, 6:27pm UTC](https://forum.ansible.com/t/using-ansible-in-python-licensing-question/20006/6 "2015-12-15T18:27:14Z")

</div>

Hello Toshio,

This is actually very helpful. If my team is okay with using /usr/bin/ansible\* via python’s subprocess.Popen() then that would be great.

Usman
