Skip to content

Fix convenience variables for proxy #735

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions ansible/roles/proxy/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
- name: Validate http_proxy definition
ansible.builtin.assert:
that: proxy_http_proxy != '' # this is default if squid not active
that: proxy_http_proxy != ''
fail_msg: >-
Variable proxy_http_proxy cannot be the empty string for hosts in the
proxy group. See environment/common/inventory/group_vars/all/proxy.yml.
proxy group. See environments/common/inventory/group_vars/all/proxy.yml
for convenience variables to set this.
- name: Define configuration in /etc/environment
tags: proxy
lineinfile:
Expand Down
8 changes: 4 additions & 4 deletions environments/common/inventory/group_vars/all/proxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ proxy_remove: false

# full http proxy string - override if the above don't provide enough control:
proxy_http_proxy: >-
{% if groups['squid'] | length > 0 %}
{%- if proxy_http_address != '' -%}
http://
{%- if proxy_basic_password -%}
{{ proxy_basic_user }}:{{ proxy_basic_password }}@
{%- endif -%}
{{ proxy_http_address }}:{{ proxy_http_port }}
{% else %}
{% endif %}
{%- else %}

{%- endif %}