Apologies in advance: I’ve been working with salt for the last few years . . .
I want to be able to use proxy_envs
from group_vars/all to be able to set proxies in the environment
for get_url
tasks.
So my task will look like this:
- name: Download something via http
ansible.builtin.get_url:
url: http://example.com/
environment: "{{ proxy_env }}"
And I want to use yaml anchors, e.g.:
proxy_server: &proxy_server "http://squid:3128"
proxy_env:
http_proxy: *proxy_server
https_proxy: *proxy_server
ftp_proxy: *proxy_server
This seems to work fine. My problem is with no_proxy . . . I want it to be a list, e.g.
no_proxy: &no_proxy
- url1
- url2
But THEN I want to be able to set no_proxy with proxy_env like this:
no_proxy: &no_proxy
- url1
- url2
proxy_server: &proxy_server "http://squid:3128"
proxy_env:
http_proxy: *proxy_server
https_proxy: *proxy_server
ftp_proxy: *proxy_server
no_proxy: "{{ *no_proxy|join(',') }}"
Ansible does not like this:
template error while templating string: unexpected '*'. String: {{ *no_proxy|join(',') }}. unexpected '*'"
Is this possible? Thanks!