From e6f39789ed0728e61e1f7d52148397f0700b1013 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 26 May 2024 22:30:19 +0200 Subject: apt-cacher-ng: use nginx for publishing --- chaos-at-home/ch-apt.yml | 1 + inventory/host_vars/ch-apt.yml | 2 ++ roles/apt-cacher-ng/defaults/main.yml | 2 ++ roles/apt-cacher-ng/tasks/main.yml | 18 +++++++++++++++++- 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/chaos-at-home/ch-apt.yml b/chaos-at-home/ch-apt.yml index b159a854..29a28036 100644 --- a/chaos-at-home/ch-apt.yml +++ b/chaos-at-home/ch-apt.yml @@ -12,4 +12,5 @@ hosts: ch-apt roles: - role: storage/lvm/base + - role: nginx/base - role: apt-cacher-ng diff --git a/inventory/host_vars/ch-apt.yml b/inventory/host_vars/ch-apt.yml index e23a6c20..c4a539f1 100644 --- a/inventory/host_vars/ch-apt.yml +++ b/inventory/host_vars/ch-apt.yml @@ -52,6 +52,8 @@ apt_cacher_ng_storage: size: 15G fs: ext4 +apt_cacher_ng_hostname: apt.chaos-at-home.org + apt_cacher_ng_remaps: debian: path: /debian diff --git a/roles/apt-cacher-ng/defaults/main.yml b/roles/apt-cacher-ng/defaults/main.yml index eb50d456..e172d7da 100644 --- a/roles/apt-cacher-ng/defaults/main.yml +++ b/roles/apt-cacher-ng/defaults/main.yml @@ -2,6 +2,8 @@ # apt_cacher_ng_storage: # type: ... +# apt_cacher_ng_hostname: apt.example.com + # apt_cacher_ng_remaps: # debrep: # path: /debian diff --git a/roles/apt-cacher-ng/tasks/main.yml b/roles/apt-cacher-ng/tasks/main.yml index eb1620cc..df47ee9e 100644 --- a/roles/apt-cacher-ng/tasks/main.yml +++ b/roles/apt-cacher-ng/tasks/main.yml @@ -56,8 +56,10 @@ copy: content: | # ansible managed - ForceManaged: 1 + BindAddress: 127.0.0.1 + + ForceManaged: 1 {% for name, config in apt_cacher_ng_remaps.items() %} Remap-{{ name }}: {{ config.path }} ; file:backends_{{ name }} {% endfor %} @@ -82,3 +84,17 @@ regexp: '#\s*AdminAuth:' line: "AdminAuth: {{ apt_cacher_ng_admin_auth.username }}:{{ apt_cacher_ng_admin_auth.password }}" notify: restart apt-cacher-ng + +- name: configure nginx vhost + vars: + nginx_vhost: + default: yes + name: apt-cacher-ng + template: generic + hostnames: + - "{{ apt_cacher_ng_hostname }}" + locations: + '/': + proxy_pass: http://127.0.0.1:3142 + include_role: + name: nginx/vhost -- cgit v1.2.3