summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2024-05-26 22:30:19 +0200
committerChristian Pointner <equinox@spreadspace.org>2024-05-26 22:30:19 +0200
commite6f39789ed0728e61e1f7d52148397f0700b1013 (patch)
treeb6254579824dcadfc9e00f2e149ca36fd47d6ff5
parentapt-cacher-ng: initial working role (diff)
apt-cacher-ng: use nginx for publishing
-rw-r--r--chaos-at-home/ch-apt.yml1
-rw-r--r--inventory/host_vars/ch-apt.yml2
-rw-r--r--roles/apt-cacher-ng/defaults/main.yml2
-rw-r--r--roles/apt-cacher-ng/tasks/main.yml18
4 files changed, 22 insertions, 1 deletions
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