---
|
- include_tasks:
|
file: loop.yml
|
loop_control:
|
loop_var: _venv
|
loop: "{{ tower_custom_virtualenvs }}"
|
tags:
|
- virtualenvs
|
|
#curl -X PATCH 'https://user:password@tower.example.org/api/v2/settings/system/' \
|
#-d '{"CUSTOM_VENV_PATHS": ["/opt/my-envs/"]}' -H 'Content-Type:application/json'
|
- when: >-
|
tower_user_accounts | json_query('[?superuser==`true`]') | list | length > 0
|
and tower_custom_virtualenvs | length > 0
|
|
name: Specify in Tower which directories to look for custom venvs
|
|
tags:
|
- virtualenvs
|
|
vars:
|
venv_paths: >-
|
{{ tower_custom_virtualenvs
|
| json_query('[].dest')
|
| unique
|
| list }}
|
|
first_superuser: >-
|
{{ tower_user_accounts
|
| json_query("[?superuser==`true`]")
|
| first }}
|
|
uri:
|
url: https://tower.{{ guid }}{{ subdomain_base_suffix }}/api/v2/settings/system/
|
method: PATCH
|
|
user: "{{ first_superuser.user }}"
|
password: "{{ first_superuser.password }}"
|
|
force_basic_auth: true
|
validate_certs: false
|
body_format: json
|
body:
|
CUSTOM_VENV_PATHS: "{{ venv_paths }}"
|