to not have to manage various python installs, use simplified 'source' test

pull/658/head
Steven Robertson 5 years ago
parent de114be821
commit c010feec59

@ -6,66 +6,38 @@
any_errors_fatal: true any_errors_fatal: true
gather_facts: true gather_facts: true
tasks: tasks:
- name: Run tests on either redhat or darwin only for now - name: create temp file to source
block: file:
- name: set redhat special python path: /tmp/fake
block: state: touch
- name: ensure we can install rh-python36
become: yes
package:
name:
- centos-release-scl
state: present
- name: ensure rh-python36 is installed - name: set python using sourced file
become: yes set_fact:
package: special_python: source /tmp/fake && python
name:
- rh-python36
- rh-python36-python-devel
state: present
- name: set special python fact - name: run get_url with specially-sourced python
set_fact: get_url:
special_python: source /opt/rh/rh-python36/enable && python url: https://camo.githubusercontent.com/65061efd40e810e88184d7d962bb079ce27d8f7f/68747470733a2f2f7472617669732d63692e6f72672f64772f6d69746f67656e2e7376673f6272616e63683d6d6173746572
when: ansible_os_family == 'RedHat' dest: "/tmp/"
mode: 0644
vars:
ansible_python_interpreter: "{{ special_python }}"
environment:
https_proxy: "{{ lookup('env', 'https_proxy')|default('') }}"
no_proxy: "{{ lookup('env', 'no_proxy')|default('') }}"
- name: set darwin "special" python - name: run get_url with specially-sourced python including jinja
block: get_url:
- name: create temp file to source url: https://camo.githubusercontent.com/65061efd40e810e88184d7d962bb079ce27d8f7f/68747470733a2f2f7472617669732d63692e6f72672f64772f6d69746f67656e2e7376673f6272616e63683d6d6173746572
file: dest: "/tmp/"
path: /tmp/fake mode: 0644
state: touch vars:
ansible_python_interpreter: >
- name: set python using sourced file {% if "1" == "1" %}
set_fact: {{ special_python }}
special_python: source /tmp/fake && python {% else %}
when: ansible_os_family == 'Darwin' python
{% endif %}
- name: run get_url with specially-sourced python environment:
get_url: https_proxy: "{{ lookup('env', 'https_proxy')|default('') }}"
url: https://camo.githubusercontent.com/65061efd40e810e88184d7d962bb079ce27d8f7f/68747470733a2f2f7472617669732d63692e6f72672f64772f6d69746f67656e2e7376673f6272616e63683d6d6173746572 no_proxy: "{{ lookup('env', 'no_proxy')|default('') }}"
dest: "/tmp/"
mode: 0644
vars:
ansible_python_interpreter: "{{ special_python }}"
environment:
https_proxy: "{{ lookup('env', 'https_proxy')|default('') }}"
no_proxy: "{{ lookup('env', 'no_proxy')|default('') }}"
- name: run get_url with specially-sourced python including jinja
get_url:
url: https://camo.githubusercontent.com/65061efd40e810e88184d7d962bb079ce27d8f7f/68747470733a2f2f7472617669732d63692e6f72672f64772f6d69746f67656e2e7376673f6272616e63683d6d6173746572
dest: "/tmp/"
mode: 0644
vars:
ansible_python_interpreter: >
{% if "1" == "1" %}
{{ special_python }}
{% else %}
python
{% endif %}
environment:
https_proxy: "{{ lookup('env', 'https_proxy')|default('') }}"
no_proxy: "{{ lookup('env', 'no_proxy')|default('') }}"
when: ansible_os_family in ('RedHat', 'Darwin')

Loading…
Cancel
Save