Using Software Collections (SCL) in Ansible

4,130 views
Skip to first unread message

Daniel Wyatt

unread,
Jul 31, 2015, 1:57:15 PM7/31/15
to Ansible Project
RHEL and similar OSes have Software Collections (SCL): 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.

Paul Markham

unread,
Aug 1, 2015, 12:45:10 AM8/1/15
to Ansible Project
You can probably just enable the software collection before running Ansible.

scl enable rh-python34 ansible-playbook ...

or

#!/bin/bash
source /opt/rh/rh-python34/enable
ansible-playbook ...

Martin

unread,
Aug 1, 2015, 2:18:35 AM8/1/15
to Ansible Project
I think the question is about SCL on the targets not the controller
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/998ac5f5-f49f-4da3-b6f4-a97ad91b469b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--

Paul Markham

unread,
Aug 1, 2015, 2:50:04 AM8/1/15
to Ansible Project
Yep, this will only work if you're running Ansible against localhost

Toshio Kuratomi

unread,
Aug 2, 2015, 3:49:06 PM8/2/15
to ansible...@googlegroups.com

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


jitakirin

unread,
Aug 4, 2015, 9:49:22 AM8/4/15
to Ansible Project
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.
Reply all
Reply to author
Forward
0 new messages