ansible-install-server/roles/fai/tasks/apt-cacher-ng.yml

62 lines
1.6 KiB
YAML
Raw Normal View History

2020-08-26 17:25:16 +00:00
- name: install apt cacher
package:
2020-08-26 10:10:36 +00:00
name: apt-cacher-ng
state: present
2020-08-26 17:25:16 +00:00
- 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
2020-10-14 22:20:05 +00:00
# Mappings
2020-08-26 17:25:16 +00:00
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
2020-10-14 22:20:05 +00:00
Remap-fai: fai-project.org /download
2020-08-26 17:25:16 +00:00
2020-10-14 22:20:05 +00:00
# The Report page
2020-08-26 17:25:16 +00:00
ReportPage: acng-report.html
2020-10-14 22:20:05 +00:00
# 120 days till a package will expire
ExThreshold: 120
2020-08-26 17:25:16 +00:00
2020-10-14 22:20:05 +00:00
# use one connection to reduce disruptions
2020-08-26 17:25:16 +00:00
ReuseConnections: 1
PipelineDepth: 1
2020-10-14 22:20:05 +00:00
# don't wait to long for server
NetworkTimeout: 5
# Only serve available files
Offlinemode: {% if apt_cacher_offline_mode %}1{% else %}0{% endif %}
2020-08-26 17:25:16 +00:00
dest: /etc/apt-cacher-ng/acng.conf
owner: root
group: root
2020-10-14 22:20:05 +00:00
mode: u=rw,g=r,o=r
2020-08-26 17:25:16 +00:00
register: apt_cacher_config
- name: ensure service is started and enabled
service:
2020-08-26 17:25:16 +00:00
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
2020-10-14 22:20:05 +00:00
- 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