瀏覽代碼

Merge pull request #17 from alxwr/master

FreeBSB support
tags/v0.5.0
Niels Abspoel 6 年之前
父節點
當前提交
7c7215c0f0
沒有連結到貢獻者的電子郵件帳戶。
共有 5 個檔案被更改,包括 72 行新增23 行删除
  1. +3
    -1
      README.rst
  2. +17
    -0
      apt-cacher/ng/defaults.yaml
  3. +12
    -19
      apt-cacher/ng/map.jinja
  4. +14
    -0
      apt-cacher/ng/osfamilymap.yaml
  5. +26
    -3
      apt-cacher/ng/server.sls

+ 3
- 1
README.rst 查看文件

@@ -36,7 +36,9 @@ Sets up the system to use the apt-cacher server as the caching proxy
``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``
------------

+ 17
- 0
apt-cacher/ng/defaults.yaml 查看文件

@@ -0,0 +1,17 @@
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: []

+ 12
- 19
apt-cacher/ng/map.jinja 查看文件

@@ -1,19 +1,12 @@
{% 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')
%}

+ 14
- 0
apt-cacher/ng/osfamilymap.yaml 查看文件

@@ -0,0 +1,14 @@
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

+ 26
- 3
apt-cacher/ng/server.sls 查看文件

@@ -1,4 +1,3 @@
{% if grains['os_family'] == 'Debian' %}
{% from "apt-cacher/ng/map.jinja" import apt_cacher_ng with context %}

{%- if 'include' in apt_cacher_ng %}
@@ -8,6 +7,31 @@ include:
{%- endfor %}
{%- 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:
pkg.installed:
- name: {{ apt_cacher_ng.pkg }}
@@ -36,7 +60,7 @@ apt-cacher-ng:
{{ apt_cacher_ng.server_config }}:
file.managed:
- user: root
- group: root
- group: {{ apt_cacher_ng.root_group }}
- mode: '644'
- source: salt://apt-cacher/ng/files/server.conf
- template: jinja
@@ -62,4 +86,3 @@ apt-cacher-ng:
- mode: '600'
- source: salt://apt-cacher/ng/files/security.conf
- template: jinja
{% endif %}

Loading…
取消
儲存