diff --git a/roles/apt/defaults/main.yml b/roles/apt/defaults/main.yml index a79c73b..d5b19aa 100644 --- a/roles/apt/defaults/main.yml +++ b/roles/apt/defaults/main.yml @@ -1,6 +1,6 @@ --- debian_source: "http://deb.debian.org/debian/" debian_version: stretch -apt_proxy: "" +apt_proxy: false update_apt_sources: false enable_sid: false diff --git a/roles/apt/tasks/main.yml b/roles/apt/tasks/main.yml index 803fbdb..58495c7 100644 --- a/roles/apt/tasks/main.yml +++ b/roles/apt/tasks/main.yml @@ -35,21 +35,8 @@ with_fileglob: - files/apt.conf.d/* -# d-i puts the apt config in apt.conf, but we prefer a .d file -- name: ensure apt proxy isn't in apt.conf - lineinfile: - dest: /etc/apt/apt.conf - regexp: ^Acquire::http::Proxy - state: absent - -- name: setup apt proxy - template: - src: templates/30apt-proxy.j2 - dest: /etc/apt/apt.conf.d/30apt-proxy - when: apt_proxy != "" - -- name: unconfigure apt proxy +- name: unconfigure apt proxy that D-I set file: path: /etc/apt/apt.conf.d/30apt-proxy state: absent - when: apt_proxy == "" + when: not apt_proxy diff --git a/roles/apt/templates/30apt-proxy.j2 b/roles/apt/templates/30apt-proxy.j2 deleted file mode 100644 index 5cbccc8..0000000 --- a/roles/apt/templates/30apt-proxy.j2 +++ /dev/null @@ -1,2 +0,0 @@ -// {{ ansible_managed }} -Acquire::http::Proxy "{{ apt_proxy }}"; diff --git a/roles/tftp-server/defaults/main.yml b/roles/tftp-server/defaults/main.yml index 97cdafc..da88a9d 100644 --- a/roles/tftp-server/defaults/main.yml +++ b/roles/tftp-server/defaults/main.yml @@ -5,7 +5,7 @@ late_command_url: https://anonscm.debian.org/cgit/debconf-video/ansible.git/plai time_zone: UTC domain: video.debconf.org -apt_proxy: "" +apt_proxy: false # Defaults to deb.debian.org | archive.ubuntu.com #mirror: deb.debian.org diff --git a/roles/tftp-server/templates/preseed.cfg.j2 b/roles/tftp-server/templates/preseed.cfg.j2 index 714b450..b579bb3 100644 --- a/roles/tftp-server/templates/preseed.cfg.j2 +++ b/roles/tftp-server/templates/preseed.cfg.j2 @@ -109,7 +109,9 @@ d-i mirror/http/directory string /debian d-i mirror/http/hostname string {{ mirror | default('archive.ubuntu.com') }} d-i mirror/http/directory string /ubuntu {% endif %} -d-i mirror/http/proxy string {{ apt_proxy }} +{% if apt_proxy %} +d-i mirror/http/proxy string http://{{ inventory_hostname }}:8000/ +{% endif %} # Suite to install. #d-i mirror/suite string testing