diff --git a/ansible/group_vars/all.example b/ansible/group_vars/all.example index a8178beb..827d0ea5 100644 --- a/ansible/group_vars/all.example +++ b/ansible/group_vars/all.example @@ -310,3 +310,6 @@ system_email_recipient: # `enableMOTD` to the value `false` or uncomment the line afterwards ( default # value is `true`). # enableMOTD: false + +# To enable proxy usage for APT, please uncomment the line below. +# ENABLE_PROXY_FOR_APT: "true" diff --git a/ansible/roles/common/tasks/main.yml b/ansible/roles/common/tasks/main.yml index ffcb5000..d6a02a98 100644 --- a/ansible/roles/common/tasks/main.yml +++ b/ansible/roles/common/tasks/main.yml @@ -1,10 +1,12 @@ --- - name: Configure proxy for apt - when: http_proxy is defined + when: + - http_proxy is defined + - ENABLE_PROXY_FOR_APT == true template: src=apt.proxy.conf.j2 dest=/etc/apt/apt.conf.d/01proxy - name: Remove apt proxy configuration when no proxy is configured - when: http_proxy is not defined + when: ENABLE_PROXY_FOR_APT == false or http_proxy is not defined file: dest=/etc/apt/apt.conf.d/01proxy state=absent # Installing dnsmasq is a chicken/egg problem: the apt cache must be updated