Hey all,
I’m having an issue trying to get ansible to use my environment variable to pull through a proxy server.
Running: ansible 2.9.10
Here’s my variable declarations:
Hey all,
I’m having an issue trying to get ansible to use my environment variable to pull through a proxy server.
Running: ansible 2.9.10
Here’s my variable declarations:
Hey all,
I'm having an issue trying to get ansible to use my environment variable to pull through a proxy server.
Running: ansible 2.9.10
Here's my variable declarations:
---
- name: puppet5
hosts: ALL_LINUX
become: yes
vars_files:
- passwd.yml
- vars.ymlvars:
os_version: "{{ ansible_distribution_major_version }}"
puppet5_repo: /etc/yum.repos.d/puppet5.repo
proxy_env:
https_proxy: http://proxy:8080 <http://proxy.swpc.noaa.gov:8080>
http_proxy: http://proxy:8080 <http://proxy.swpc.noaa.gov:8080>Here is it being used in my playbook:
tasks:
- name: check if repo files exists
stat:
path: "{{ puppet5_repo }}"
register: puppet5_exists\- name: "Install puppet5 EL\{\{ os\_version \}\}\.rpm for NCS or internal networks" yum: name: "https://yum.puppetlabs.com/puppet5-release-el-\{\{ <https://yum.puppetlabs.com/puppet5-release-el-%7B%7B>
os_version }}.noarch.rpm"
state: present
disable_gpg_check: yes
environment: "{{ proxy_envy }}"
when:
- puppet5_exists.stat.exists == False
- ansible_default_ipv4.address is match('192\.168\.226\.') or
ansible_default_ipv4.address is match('192\.168\.223\.')Notice that the URL I'm trying to pull is https. When I run the playbook, it's defaulting to http. If I hard code the
environment with:environment:
- https_proxy: http://proxy:8080This works. Is there a bug somewhere in this version of ansible?
Is the name of the variable proxy_envy a typo in your playbook?
Regards
Racke
Interesting. That must have been my own typo.
I’ve verified that my variable name says proxy_env on both the declaration and where it’s trying to be applied to.
Here’s the verbose output – it keeps trying to use the http_proxy instead of the https_proxy.
SSH: EXEC sshpass -d10 ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o ‘User=“tsg”’ -o ConnectTimeout=90 -o ControlPath=/home/chris.bidwell/.ansible/cp/84c0dc074e -tt corona-lx ‘/bin/sh -c ‘"’“'sudo -H -S -p “[sudo via ansible, key=roxxdufstmkkexijnydloqgrgbewanlx] password:” -u root /bin/sh -c '”’“'”‘"’“'”‘"’“‘echo BECOME-SUCCESS-roxxdufstmkkexijnydloqgrgbewanlx ; http_proxy=http://proxy:8080 /usr/libexec/platform-python /home/tsg/.ansible/tmp/ansible-tmp-1595008297.67-12298-28530305002590/AnsiballZ_dnf.py’”‘"’“'”‘"’“'”‘"’ && sleep 0’“'”‘’
Escalation succeeded