Add support pillar attr for apt-cacher

This commit is contained in:
root 2014-09-04 13:18:34 +09:00
parent 6b105e5881
commit 3de3ac23bb
3 changed files with 18 additions and 3 deletions

View file

@ -1,5 +1,6 @@
# vim:sts=2 ts=2 sw=2 et ai
{% from "apt-cacher/map.jinja" import apt_cacher with context %}
# This file is managed by Salt, do not edit by hand!! # This file is managed by Salt, do not edit by hand!!
{% set apt_cacher = pillar.get('apt-cacher', {}) -%}
################################################################################# #################################################################################
# This is the config file for apt-cacher. On most Debian systems you can safely # # This is the config file for apt-cacher. On most Debian systems you can safely #
# leave the defaults alone. # # leave the defaults alone. #
@ -42,8 +43,8 @@ admin_email = {{ apt_cacher.get('admin_email', 'root@localhost') }}
# sufficient permissions within the cache and log directories. Comment the # sufficient permissions within the cache and log directories. Comment the
# settings to run apt-cacher as the invoking user. # settings to run apt-cacher as the invoking user.
# #
group = www-data group = {{ apt_cacher.get('group', 'www-data') }}
user = www-data user = {{ apt_cacher.get('user', 'www-data') }}
# optional setting, binds the listening daemon to specified IP(s). # optional setting, binds the listening daemon to specified IP(s).
# #
@ -112,6 +113,9 @@ user = www-data
# Specify an interface name, an IP address or a host name. # Specify an interface name, an IP address or a host name.
# If unset, the default route is used. # If unset, the default route is used.
# #
{%- if apt_cacher.get('interface', 'False') != 'False' %}
interface = {{ apt_cacher.get('interface', 'False') }}
{%- endif %}
#interface = eth0 #interface = eth0
# Rate limiting sets the maximum bandwidth in bytes per second to use for # Rate limiting sets the maximum bandwidth in bytes per second to use for

7
apt-cacher/map.jinja Normal file
View file

@ -0,0 +1,7 @@
{% set apt_cacher = salt['grains.filter_by']({
'Debian': {
'group': 'www-data',
'user': 'www-data',
'interface': 'False'
},
}, merge=salt['pillar.get']('apt_cacher')) %}

View file

@ -1,6 +1,10 @@
apt_cacher: apt_cacher:
host: cacher.mycompany.com host: cacher.mycompany.com
admin_email: admin@mycompany.com admin_email: admin@mycompany.com
group: www-data
user: www-data
#ip for upstream connection
interface: 10.10.0.1
apt_cacher_ng: apt_cacher_ng:
# Setting up server_address is the minimal configuration requirement. # Setting up server_address is the minimal configuration requirement.