``apt-cacher.ng.server`` | ``apt-cacher.ng.server`` | ||||
------- | ------- | ||||
Install and configure apt-cacher-ng | |||||
Install and configure apt-cacher-ng. | |||||
Supports Debian(ish) distributions and FreeBSD. | |||||
``apt-cacher.ng.client`` | ``apt-cacher.ng.client`` | ||||
------------ | ------------ |
apt_cacher_ng: | |||||
server_address: localhost | |||||
server_bind_address: 0.0.0.0 | |||||
server_port: 3142 | |||||
server_extra_config: | |||||
server_config: /etc/apt-cacher-ng/zzz_acng.conf | |||||
server_cache_dir: /var/cache/apt-cacher-ng | |||||
server_log_dir: /var/log/apt-cacher-ng | |||||
user: apt-cacher-ng | |||||
group: apt-cacher-ng | |||||
root_group: root | |||||
pkg: apt-cacher-ng | |||||
service: apt-cacher-ng | |||||
credentials: /etc/apt-cacher-ng/security.conf | |||||
client_config: /etc/apt/apt.conf.d/80proxy | |||||
https_proxy: DIRECT | |||||
local_mirrors: [] |
{% set apt_cacher_ng = salt['grains.filter_by']({ | |||||
'Debian': { | |||||
'server_address': 'localhost', | |||||
'server_bind_address': '0.0.0.0', | |||||
'server_port': '3142', | |||||
'server_extra_config': '', | |||||
'server_config': '/etc/apt-cacher-ng/zzz_acng.conf', | |||||
'server_cache_dir': '/var/cache/apt-cacher-ng', | |||||
'server_log_dir': '/var/log/apt-cacher-ng', | |||||
'user': 'apt-cacher-ng', | |||||
'group': 'apt-cacher-ng', | |||||
'pkg': 'apt-cacher-ng', | |||||
'service': 'apt-cacher-ng', | |||||
'credentials': '/etc/apt-cacher-ng/security.conf', | |||||
'client_config': '/etc/apt/apt.conf.d/80proxy', | |||||
'https_proxy': 'DIRECT', | |||||
'local_mirrors': [], | |||||
}, | |||||
}, merge=salt['pillar.get']('apt_cacher_ng')) %} | |||||
{% import_yaml "apt-cacher/ng/defaults.yaml" as defaults %} | |||||
{% import_yaml "apt-cacher/ng/osfamilymap.yaml" as osfamilymap %} | |||||
{%- set apt_cacher_ng = salt['grains.filter_by']( | |||||
defaults, | |||||
merge=salt['grains.filter_by']( | |||||
osfamilymap, | |||||
grain='os_family', | |||||
merge=salt['pillar.get']('apt_cacher_ng', {}), | |||||
), | |||||
base='apt_cacher_ng') | |||||
%} |
Debian: {} | |||||
FreeBSD: | |||||
credentials: /usr/local/etc/apt-cacher-ng/security.conf | |||||
root_group: wheel | |||||
server_cache_dir: /var/cache/apt-cacher-ng | |||||
server_config: /usr/local/etc/apt-cacher-ng/zzz_acng.conf | |||||
server_log_dir: /var/log/apt-cacher-ng | |||||
service: apt_cacher_ng | |||||
## | |||||
# We stick to the Debian user name in order to | |||||
# further separate apt-cacher-ng from other potentially present | |||||
# services running as 'proxy'. | |||||
#user: proxy | |||||
#group: proxy |
{% if grains['os_family'] == 'Debian' %} | |||||
{% from "apt-cacher/ng/map.jinja" import apt_cacher_ng with context %} | {% from "apt-cacher/ng/map.jinja" import apt_cacher_ng with context %} | ||||
{%- if 'include' in apt_cacher_ng %} | {%- if 'include' in apt_cacher_ng %} | ||||
{%- endfor %} | {%- endfor %} | ||||
{%- endif %} | {%- endif %} | ||||
apt-cacher-ng-group: | |||||
group.present: | |||||
- name: {{ apt_cacher_ng.group }} | |||||
- require: | |||||
- pkg: apt-cacher-ng | |||||
- watch_in: | |||||
- service: apt-cacher-ng | |||||
apt-cacher-ng-user: | |||||
user.present: | |||||
- name: {{ apt_cacher_ng.user }} | |||||
- require: | |||||
- group: apt-cacher-ng-group | |||||
- watch_in: | |||||
- service: apt-cacher-ng | |||||
{%- if grains['os_family'] == 'FreeBSD' %} | |||||
apt-cacher-ng-sysrc-user: | |||||
sysrc.managed: | |||||
- name: apt_cacher_ng_user | |||||
- value: "{{ apt_cacher_ng.user }}" | |||||
- watch_in: | |||||
- service: apt-cacher-ng | |||||
{%- endif %} | |||||
apt-cacher-ng: | apt-cacher-ng: | ||||
pkg.installed: | pkg.installed: | ||||
- name: {{ apt_cacher_ng.pkg }} | - name: {{ apt_cacher_ng.pkg }} | ||||
{{ apt_cacher_ng.server_config }}: | {{ apt_cacher_ng.server_config }}: | ||||
file.managed: | file.managed: | ||||
- user: root | - user: root | ||||
- group: root | |||||
- group: {{ apt_cacher_ng.root_group }} | |||||
- mode: '644' | - mode: '644' | ||||
- source: salt://apt-cacher/ng/files/server.conf | - source: salt://apt-cacher/ng/files/server.conf | ||||
- template: jinja | - template: jinja | ||||
- mode: '600' | - mode: '600' | ||||
- source: salt://apt-cacher/ng/files/security.conf | - source: salt://apt-cacher/ng/files/security.conf | ||||
- template: jinja | - template: jinja | ||||
{% endif %} |