diff --git a/roles/mgrote.apt_manage_sources/tasks/main.yml b/roles/mgrote.apt_manage_sources/tasks/main.yml index 8d5272f3..494ac87e 100644 --- a/roles/mgrote.apt_manage_sources/tasks/main.yml +++ b/roles/mgrote.apt_manage_sources/tasks/main.yml @@ -3,16 +3,16 @@ include_tasks: ubuntu.yml when: - ansible_distribution == 'Ubuntu' - - manage_sources_apt_proxy | length > 0 + - manage_sources_apt_proxy is defined - name: include Linux Mint tasks (determined by "ansible_distribution") include_tasks: mint.yml when: - ansible_distribution == 'Linux Mint' - - manage_sources_apt_proxy | length > 0 + - manage_sources_apt_proxy is defined - name: include proxmox tasks (determined by group) include_tasks: proxmox.yml when: - "'proxmox' in group_names" - - manage_sources_apt_proxy | length > 0 + - manage_sources_apt_proxy is defined diff --git a/roles/mgrote.apt_manage_sources/templates/apt.conf b/roles/mgrote.apt_manage_sources/templates/apt.conf index 495e5e87..7c98d3a5 100644 --- a/roles/mgrote.apt_manage_sources/templates/apt.conf +++ b/roles/mgrote.apt_manage_sources/templates/apt.conf @@ -1,3 +1,5 @@ {{ file_header | default () }} +{% if manage_sources_apt_proxy | length > 0 %} Acquire::http::proxy "http://{{ manage_sources_apt_proxy | default() }}"; Acquire::https::proxy "http://{{ manage_sources_apt_proxy | default() }}"; +{% endif %}