2020-02-13 02:23:30 +00:00
|
|
|
# checks complex ansible_python_interpreter values as well as jinja in the ansible_python_interpreter value
|
|
|
|
---
|
|
|
|
|
|
|
|
- name: integration/interpreter_discovery/complex_args.yml
|
|
|
|
hosts: test-targets
|
|
|
|
gather_facts: true
|
|
|
|
tasks:
|
2020-02-19 01:45:38 +00:00
|
|
|
- name: create temp file to source
|
|
|
|
file:
|
|
|
|
path: /tmp/fake
|
|
|
|
state: touch
|
2020-02-19 00:13:20 +00:00
|
|
|
|
2020-02-26 20:05:46 +00:00
|
|
|
# TODO: this works in Mac 10.15 because sh defaults to bash
|
|
|
|
# but due to Mac SIP we can't write to /bin so we can't change
|
|
|
|
# /bin/sh to point to /bin/bash
|
|
|
|
# Mac 10.15 is failing python interpreter discovery tests from ansible 2.8.8
|
|
|
|
# because Mac doesn't make default python /usr/bin/python anymore
|
|
|
|
# so for now, can't use `source` since it's a bash builtin
|
|
|
|
# - name: set python using sourced file
|
|
|
|
# set_fact:
|
|
|
|
# special_python: source /tmp/fake && python
|
2020-02-19 01:45:38 +00:00
|
|
|
- name: set python using sourced file
|
|
|
|
set_fact:
|
2020-02-26 20:05:46 +00:00
|
|
|
special_python: source /tmp/fake || true && python
|
2020-02-13 02:23:30 +00:00
|
|
|
|
2020-02-19 01:45:38 +00:00
|
|
|
- name: run get_url with specially-sourced python
|
|
|
|
get_url:
|
2020-03-21 17:47:08 +00:00
|
|
|
url: https://google.com
|
2020-02-19 01:45:38 +00:00
|
|
|
dest: "/tmp/"
|
|
|
|
mode: 0644
|
2020-02-19 22:50:07 +00:00
|
|
|
# this url is the build pic from mitogen's github site; some python versions require ssl stuff installed so will disable need to validate certs
|
|
|
|
validate_certs: no
|
2020-02-19 01:45:38 +00:00
|
|
|
vars:
|
|
|
|
ansible_python_interpreter: "{{ special_python }}"
|
|
|
|
environment:
|
|
|
|
https_proxy: "{{ lookup('env', 'https_proxy')|default('') }}"
|
|
|
|
no_proxy: "{{ lookup('env', 'no_proxy')|default('') }}"
|
2020-02-13 02:23:30 +00:00
|
|
|
|
2020-02-19 01:45:38 +00:00
|
|
|
- name: run get_url with specially-sourced python including jinja
|
|
|
|
get_url:
|
2020-03-21 17:47:08 +00:00
|
|
|
url: https://google.com
|
2020-02-19 01:45:38 +00:00
|
|
|
dest: "/tmp/"
|
|
|
|
mode: 0644
|
2020-02-19 22:50:07 +00:00
|
|
|
# this url is the build pic from mitogen's github site; some python versions require ssl stuff installed so will disable need to validate certs
|
|
|
|
validate_certs: no
|
2020-02-19 01:45:38 +00:00
|
|
|
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('') }}"
|
2021-11-02 20:07:28 +00:00
|
|
|
tags:
|
|
|
|
- complex_args
|