<div dir="ltr"><div>Hi Samuel,</div><div><br></div><div>I have been writing a couple of ansible-playbooks but did not try it with SCL.</div><div>You playbook w/o comments look good.</div><div><br></div><div>But I don't understand the scenario.</div><div>How do you run the ansible-playbook?</div><div>From container or from shell?</div><div><br></div><div>Can you please give a reproducer steps, so I can analyze it?</div><div><br></div><div>Greetings</div><div>     Petr<br></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">pá 11. 10. 2019 v 11:23 odesílatel <<a href="mailto:viscapi@cines.fr">viscapi@cines.fr</a>> napsal:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Dear all,<br>
<br>
Silly question: is there a way to call "scl enable" from within an Ansible role ?<br>
<br>
So far we've been trying the command, shell and scripts modules, but to no avail...<br>
<br>
<a href="https://docs.ansible.com/ansible/latest/modules/command_module.html#command-module" rel="noreferrer" target="_blank">https://docs.ansible.com/ansible/latest/modules/command_module.html#command-module</a><br>
<a href="https://docs.ansible.com/ansible/latest/modules/shell_module.html#shell-module" rel="noreferrer" target="_blank">https://docs.ansible.com/ansible/latest/modules/shell_module.html#shell-module</a><br>
<a href="https://docs.ansible.com/ansible/latest/modules/script_module.html#script-module" rel="noreferrer" target="_blank">https://docs.ansible.com/ansible/latest/modules/script_module.html#script-module</a><br>
<br>
Here are some failed attempts:<br>
<br>
- name: Start using the software collection for maven<br>
  shell: scl_enabled rh-maven35  <br>
  register: swap_exists<br>
  ignore_errors: true<br>
#script: test.sh<br>
 # shell: scl enable /etc/scl/conf//opt/rh/rh-maven35 bash && echo toto<br>
 #shell: /usr/bin/scl enable rh-maven35 bash<br>
 # args:<br>
 #   warn: yes<br>
 #   chdir: "{{ path_to_pastis }}"<br>
  #easy_install:<br>
  #  name: scl<br>
#  args:<br>
#    executable: "/usr/bin/scl enable rh-maven35 bash"<br>
 # command: |<br>
 #   /usr/bin/scl enable rh-maven35 bash<br>
#bash<br>
 # shell: |<br>
 #   scl enable rh-maven35 bash <br>
#bash<br>
#  args:<br>
#    executable: /bin/bash<br>
<br>
I think the root issue is that, as far as I understand, "scl enable" starts a new shell and sources environment variables in there, while Ansible is still waiting for some RC in the parent shell. Thus Ansible is not really failing, but just keeps on waiting for ever...<br>
<br>
Any help would be greatly appreciated.<br>
<br>
Best regards,<br>
<br>
Samuel from CINES<br>
<br>
<a href="https://www.cines.fr/en/" rel="noreferrer" target="_blank">https://www.cines.fr/en/</a><br>
<br>
--<br>
<br>
Samuel VISCAPI<br>
<br>
+33(0)4 67 14 14 36<br>
<a href="mailto:viscapi@cines.fr" target="_blank">viscapi@cines.fr</a><br>
IM: sviscapi (Skype)<br>
<br>
_______________________________________________<br>
SCLorg mailing list<br>
<a href="mailto:SCLorg@redhat.com" target="_blank">SCLorg@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/sclorg" rel="noreferrer" target="_blank">https://www.redhat.com/mailman/listinfo/sclorg</a><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>Petr Hracek<br></div><div>email: <a href="mailto:phracek@redhat.com" target="_blank">phracek@redhat.com</a></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>