master
blallo 2021-02-21 00:44:04 +01:00
commit a5b7a9ab5b
Signed by: blallo
GPG Key ID: 0CBE577C9B72DC3F
5 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,5 @@
---
- name: restart apt-cacher-ng
systemd:
name: apt-cacher-ng
state: restarted

25
tasks/cacher.yml 100644
View File

@ -0,0 +1,25 @@
---
- name: Ensure apt-cacher-ng is present
apt:
name: apt-cacher-ng
state: present
- name: Allow to proxy every domain
lineinfile:
path: /etc/apt-cacher-ng/acng.conf
insertafter: EOF
line: "PassThroughPattern: .*"
notify: restart apt-cacher-ng
- name: Ensure apt-cacher-ng listens on all addresses
lineinfile:
path: /etc/apt-cacher-ng/acng.conf
insertafter: EOF
line: "BindAddress: 0.0.0.0"
notify: restart apt-cacher-ng
- name: Ensure apt-cacher-ng is started and enabled
systemd:
name: apt-cacher-ng
enabled: yes
state: started

8
tasks/client.yml 100644
View File

@ -0,0 +1,8 @@
---
- name: Ensure the client uses the cacher
template:
src: aptproxy.conf.j2
dest: /etc/apt/apt.conf.d/02proxy
owner: root
group: root
mode: 0644

5
tasks/main.yml 100644
View File

@ -0,0 +1,5 @@
---
- include_tasks: cacher.yml
when: apt_cacher_ng_is_cacher is defined and apt_cacher_ng_is_cacher
- include_tasks: client.yml

View File

@ -0,0 +1 @@
Acquire::http { Proxy "http://{{ apt_cacher_ng_cacher_ip }}:3142"; };