# Using Software Collections (SCL) in Ansible

**URL:** <https://forum.ansible.com/t/using-software-collections-scl-in-ansible/18911>\
**Category:** Ansible Project\
**Tags:** rhel\
**Created:** [July 31, 2015, 5:52pm UTC](https://forum.ansible.com/t/using-software-collections-scl-in-ansible/18911 "2015-07-31T17:52:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Wyatt](https://avatars.discourse-cdn.com/v4/letter/d/c0e974/32.png) [@Daniel\_Wyatt](https://forum.ansible.com/u/Daniel_Wyatt)\
**Post date:** [July 31, 2015, 5:52pm UTC](https://forum.ansible.com/t/using-software-collections-scl-in-ansible/18911/1 "2015-07-31T17:52:46Z")

</div>

RHEL and similar OSes have Software Collections (SCL): [https://www.softwarecollections.org](https://www.softwarecollections.org).  
Some typical ways to use Python 3.4 from SCL, for example:

yum -y install rh-python34

Interactive:  
scl enable rh-python34 bash  
Scripted:  
echo pip3 install Django==1.7 | scl enable rh-python34 -  
Scripted(alt):  
#!/bin/bash  
source /opt/rh/rh-python34/enable  
pip3 install Django==1.7

Is there any general way to support SCL with Ansible?  
Or even a specific way to force the pip module to work with it?  
I’m trying to decide whether Ansible has enough advantage over shell scripts for deploying this particular application.

---

<div class="post-metadata">

**Author:** ![Paul\_Markham](https://avatars.discourse-cdn.com/v4/letter/p/9d8465/32.png) [@Paul\_Markham](https://forum.ansible.com/u/Paul_Markham)\
**Post date:** [August 1, 2015, 4:45am UTC](https://forum.ansible.com/t/using-software-collections-scl-in-ansible/18911/2 "2015-08-01T04:45:10Z")

</div>

You can probably just enable the software collection before running Ansible.

> scl enable rh-python34 ansible-playbook …

or

---

<div class="post-metadata">

**Author:** ![Martin2](https://avatars.discourse-cdn.com/v4/letter/m/9de053/32.png) [@Martin2](https://forum.ansible.com/u/Martin2)\
**Post date:** [August 1, 2015, 6:18am UTC](https://forum.ansible.com/t/using-software-collections-scl-in-ansible/18911/3 "2015-08-01T06:18:19Z")

</div>

I think the question is about SCL on the targets not the controller

---

<div class="post-metadata">

**Author:** ![Paul\_Markham](https://avatars.discourse-cdn.com/v4/letter/p/9d8465/32.png) [@Paul\_Markham](https://forum.ansible.com/u/Paul_Markham)\
**Post date:** [August 1, 2015, 6:50am UTC](https://forum.ansible.com/t/using-software-collections-scl-in-ansible/18911/4 "2015-08-01T06:50:03Z")

</div>

Yep, this will only work if you’re running Ansible against localhost

---

<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:** [August 2, 2015, 7:48pm UTC](https://forum.ansible.com/t/using-software-collections-scl-in-ansible/18911/5 "2015-08-02T19:48:58Z")

</div>

Depends on what you’re trying to do. If any of these are true then doing this with ansible might make sense:

A) already have an ansible infrastructure and want to deploy something the same way as the rest of your infra

B) need to deploy this on multiple remote systems

If the following is true then it might not:

A) you just have this single app to deploy to a single host.

I think I’d probably use the script module to use scls at this point in time. Which allows you to integrate a script that you write with ansible. But if you don’t need the other features of ansible then you could just add a little bit of extra smarts to your script instead.

Someone could write an scl module in the future (similar to the virtual env module) which would make things like you want to do more natural but there isn’t one at the moment.

-Toshio

---

<div class="post-metadata">

**Author:** ![jitakirin](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@jitakirin](https://forum.ansible.com/u/jitakirin)\
**Post date:** [August 4, 2015, 7:46am UTC](https://forum.ansible.com/t/using-software-collections-scl-in-ansible/18911/6 "2015-08-04T07:46:17Z")

</div>

You should be able to set `ansible_python_interpreter` to sth like `/opt/rh/rh-python34/bin/python` and then pip module will do what you want.
