73 lines
1.8 KiB
YAML
73 lines
1.8 KiB
YAML
- name: "Install apt cacher"
|
|
become: true
|
|
ansible.builtin.package:
|
|
name:
|
|
- apt-cacher-ng
|
|
state: present
|
|
|
|
- name: "Configure apt cacher"
|
|
become: true
|
|
ansible.builtin.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: '0644'
|
|
notify: restart apt-cacher-ng
|
|
|
|
- name: "Set ubuntu server as backend"
|
|
become: true
|
|
ansible.builtin.copy:
|
|
content: |
|
|
http://archive.ubuntu.com/ubuntu/
|
|
dest: "/etc/apt-cacher-ng/backends_ubuntu"
|
|
owner: root
|
|
group: root
|
|
mode: '0644'
|
|
|
|
- name: "Ensure service is started and enabled"
|
|
become: true
|
|
ansible.builtin.service:
|
|
name: apt-cacher-ng
|
|
enabled: true
|
|
state: started
|
|
|
|
- name: "Set apt cache also for installer host"
|
|
become: true
|
|
ansible.builtin.copy:
|
|
dest: "/etc/apt/apt.conf.d/02proxy"
|
|
content: |
|
|
Acquire::http::Proxy "http://localhost:3142";
|
|
owner: root
|
|
group: root
|
|
mode: '0644'
|
|
when:
|
|
- use_apt_cache_for_server
|
|
|