2014-07-06 19:27:51 -04:00
|
|
|
{% if grains['os_family'] == 'Debian' %}
|
|
|
|
{% from "apt-cacher/ng/map.jinja" import apt_cacher_ng with context %}
|
|
|
|
|
2016-11-02 19:48:46 -04:00
|
|
|
{% if 'include' in apt_cacher_ng %}
|
|
|
|
include:
|
|
|
|
{% for include_line in apt_cacher_ng.include %}
|
|
|
|
- {{ include_line }}
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
|
|
|
2014-07-06 19:27:51 -04:00
|
|
|
apt-cacher-ng:
|
2014-12-13 02:19:58 -05:00
|
|
|
pkg.installed:
|
2014-07-06 19:27:51 -04:00
|
|
|
- name: {{ apt_cacher_ng.pkg }}
|
2014-12-13 02:19:58 -05:00
|
|
|
service.running:
|
2014-07-06 19:27:51 -04:00
|
|
|
- name: {{ apt_cacher_ng.service }}
|
|
|
|
- enable: True
|
|
|
|
- watch:
|
|
|
|
- pkg: {{ apt_cacher_ng.pkg }}
|
|
|
|
- file: {{ apt_cacher_ng.credentials }}
|
|
|
|
- file: {{ apt_cacher_ng.server_config }}
|
|
|
|
- file: {{ apt_cacher_ng.server_cache_dir }}
|
|
|
|
- file: {{ apt_cacher_ng.server_log_dir }}
|
2016-12-04 19:05:43 -05:00
|
|
|
{%- if 'require' in apt_cacher_ng %}
|
|
|
|
- require:
|
|
|
|
{%- for require in apt_cacher_ng.require %}
|
|
|
|
- {{ require }}
|
|
|
|
{%- endfor %}
|
|
|
|
{%- endif %}
|
|
|
|
{%- if 'require_in' in apt_cacher_ng %}
|
2016-11-02 19:48:46 -04:00
|
|
|
- require_in:
|
2016-12-04 19:05:43 -05:00
|
|
|
{%- for require_in in apt_cacher_ng.require_in %}
|
2016-11-02 19:48:46 -04:00
|
|
|
- {{ require_in }}
|
2016-12-04 19:05:43 -05:00
|
|
|
{%- endfor %}
|
|
|
|
{%- endif %}
|
2014-07-06 19:27:51 -04:00
|
|
|
|
|
|
|
{{ apt_cacher_ng.server_config }}:
|
2014-12-13 02:19:58 -05:00
|
|
|
file.managed:
|
2014-07-06 19:27:51 -04:00
|
|
|
- user: root
|
|
|
|
- group: root
|
|
|
|
- mode: '644'
|
|
|
|
- source: salt://apt-cacher/ng/files/server.conf
|
|
|
|
- template: jinja
|
|
|
|
|
|
|
|
{{ apt_cacher_ng.server_cache_dir }}:
|
2014-12-13 02:19:58 -05:00
|
|
|
file.directory:
|
2014-11-27 17:38:31 -05:00
|
|
|
- makedirs: True
|
2014-07-06 19:27:51 -04:00
|
|
|
- user: {{ apt_cacher_ng.user }}
|
|
|
|
- group: {{ apt_cacher_ng.group }}
|
|
|
|
- mode: '2755'
|
|
|
|
|
|
|
|
{{ apt_cacher_ng.server_log_dir }}:
|
2014-12-13 02:19:58 -05:00
|
|
|
file.directory:
|
2014-11-27 17:38:31 -05:00
|
|
|
- makedirs: True
|
2014-07-06 19:27:51 -04:00
|
|
|
- user: {{ apt_cacher_ng.user }}
|
|
|
|
- group: {{ apt_cacher_ng.group }}
|
|
|
|
- mode: '2755'
|
|
|
|
|
|
|
|
{{ apt_cacher_ng.credentials }}:
|
2014-12-13 02:19:58 -05:00
|
|
|
file.managed:
|
2014-07-06 19:27:51 -04:00
|
|
|
- user: {{ apt_cacher_ng.user }}
|
|
|
|
- group: {{ apt_cacher_ng.group }}
|
|
|
|
- mode: '600'
|
|
|
|
- source: salt://apt-cacher/ng/files/security.conf
|
|
|
|
- template: jinja
|
|
|
|
{% endif %}
|