62 lines
1.6 KiB
YAML
62 lines
1.6 KiB
YAML
- name: install apt cacher
|
|
package:
|
|
name: apt-cacher-ng
|
|
state: present
|
|
|
|
- name: configure apt cacher
|
|
copy:
|
|
content: |
|
|
CacheDir: /var/cache/apt-cacher-ng
|
|
LogDir: /var/log/apt-cacher-ng
|
|
SupportDir: /usr/lib/apt-cacher-ng
|
|
Port: 3142
|
|
|
|
# Mappings
|
|
Remap-debrep: file:deb_mirror*.gz /debian ; file:backends_debian # Debian Archives
|
|
Remap-uburep: file:ubuntu_mirrors /ubuntu ; file:backends_ubuntu # Ubuntu Archives
|
|
Remap-secdeb: security.debian.org ; security.debian.org deb.debian.org/debian-security
|
|
Remap-fai: fai-project.org /download
|
|
|
|
# The Report page
|
|
ReportPage: acng-report.html
|
|
|
|
# 120 days till a package will expire
|
|
ExThreshold: 120
|
|
|
|
# use one connection to reduce disruptions
|
|
ReuseConnections: 1
|
|
PipelineDepth: 1
|
|
|
|
# don't wait to long for server
|
|
NetworkTimeout: 5
|
|
|
|
# Only serve available files
|
|
Offlinemode: {% if apt_cacher_offline_mode %}1{% else %}0{% endif %}
|
|
dest: /etc/apt-cacher-ng/acng.conf
|
|
owner: root
|
|
group: root
|
|
mode: u=rw,g=r,o=r
|
|
register: apt_cacher_config
|
|
|
|
- name: ensure service is started and enabled
|
|
service:
|
|
name: apt-cacher-ng
|
|
enabled: yes
|
|
state: started
|
|
|
|
- name: reload apt cacher if reconfigured
|
|
systemd:
|
|
name: apt-cacher-ng
|
|
state: restarted
|
|
when: apt_cacher_config.changed
|
|
|
|
- name: set apt cache also for installer host
|
|
copy:
|
|
dest: /etc/apt/apt.conf.d/00proxy
|
|
content: |
|
|
Acquire::http::Proxy "http://localhost:3142";
|
|
owner: root
|
|
group: root
|
|
mode: u=rw,g=r,o=r
|
|
|