From 2c454511575bce7c5902d13f922c8e43c892d24f Mon Sep 17 00:00:00 2001 From: Alexander Weidinger Date: Fri, 27 Apr 2018 22:27:40 +0200 Subject: [PATCH] no proxy for local mirrors --- apt-cacher/ng/files/client.conf | 3 +++ apt-cacher/ng/map.jinja | 1 + pillar.example | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/apt-cacher/ng/files/client.conf b/apt-cacher/ng/files/client.conf index 7e52d68..51f3c12 100644 --- a/apt-cacher/ng/files/client.conf +++ b/apt-cacher/ng/files/client.conf @@ -1,3 +1,6 @@ {% from "apt-cacher/ng/map.jinja" import apt_cacher_ng with context -%} Acquire::http::Proxy "http://{{ apt_cacher_ng.server_address }}:{{ apt_cacher_ng.server_port }}"; Acquire::https::Proxy "{{ apt_cacher_ng.https_proxy }}"; +{% for host in apt_cacher_ng.local_mirrors -%} +Acquire::http::Proxy::{{ host }} "DIRECT"; +{% endfor -%} diff --git a/apt-cacher/ng/map.jinja b/apt-cacher/ng/map.jinja index 8dde861..5dbbc3f 100644 --- a/apt-cacher/ng/map.jinja +++ b/apt-cacher/ng/map.jinja @@ -14,5 +14,6 @@ 'credentials': '/etc/apt-cacher-ng/security.conf', 'client_config': '/etc/apt/apt.conf.d/80proxy', 'https_proxy': 'DIRECT', + 'local_mirrors': [], }, }, merge=salt['pillar.get']('apt_cacher_ng')) %} diff --git a/pillar.example b/pillar.example index a8a94cd..4efe140 100644 --- a/pillar.example +++ b/pillar.example @@ -36,6 +36,12 @@ apt_cacher_ng: # Default value ignores proxy for HTTPS connections https_proxy: DIRECT + # Local mirrors don't need a proxy + # See https://linux.die.net/man/5/apt.conf + local_mirrors: + - 192.168.0.1 + - host.example.test + ## # require/require_in/include example