Browse Source

Add linux.system.apt state

Change-Id: I1e190f1f5b34a049335efbecffad3dddf7c41644
pull/128/head
Filip Pytloun 7 years ago
parent
commit
c512e6c73f
4 changed files with 54 additions and 0 deletions
  1. +15
    -0
      README.rst
  2. +9
    -0
      linux/files/apt.conf
  3. +27
    -0
      linux/system/apt.sls
  4. +3
    -0
      linux/system/init.sls

+ 15
- 0
README.rst View File

@@ -626,6 +626,21 @@ Remove all repositories:
system:
purge_repos: true

Setup custom apt config options:

.. code-block:: yaml

linux:
system:
apt:
config:
compression-workaround:
"Acquire::CompressionTypes::Order": "gz"
docker-clean:
"DPkg::Post-Invoke":
- "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"
"APT::Update::Post-Invoke":
- "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"

RC
~~

+ 9
- 0
linux/files/apt.conf View File

@@ -0,0 +1,9 @@
// apt.conf file managed by salt-minion
// DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN

{%- for key, value in config.iteritems() %}
{{ key }} {% if value is iterable and value is not string %}{ {% for entry in value %}"{{ entry }}";{% endfor %} } {% else %}{{ value }};{% endif %}
{%- endfor %}
{#-
vim: syntax=jinja
-#}

+ 27
- 0
linux/system/apt.sls View File

@@ -0,0 +1,27 @@
{%- from "linux/map.jinja" import system with context %}
{%- if system.enabled %}
{%- if grains.os_family == 'Debian' %}

{%- if system.repo|length > 0 %}
include:
- linux.system.repo
{%- endif %}

{%- for key, config in system.apt.get('config', {}).iteritems() %}

linux_apt_conf_{{ key }}
file.managed:
- name: /etc/apt/apt.conf.d/99{{ key }}-salt:
- template: jinja
- source: salt://linux/files/apt.conf
- defaults:
config: {{ config|yaml }}
{%- if system.repo|length > 0 %}
- require_in:
- pkg: linux_repo_prereq_pkgs
{%- endif %}

{%- endfor %}

{%- endif %}
{%- endif %}

+ 3
- 0
linux/system/init.sls View File

@@ -99,3 +99,6 @@ include:
{%- if system.directory is defined %}
- linux.system.directory
{%- endif %}
{%- if system.apt is defined and grains.os_family == 'Debian' %}
- linux.system.apt
{%- endif %}

Loading…
Cancel
Save