Procházet zdrojové kódy

Merge pull request #38 from ze42/apt_conf

apt.conf.d
master
Niels Abspoel před 6 roky
rodič
revize
2893b0dc39
Žádný účet není propojen s e-mailovou adresou tvůrce revize
4 změnil soubory, kde provedl 92 přidání a 1 odebrání
  1. +36
    -0
      apt/apt_conf.sls
  2. +4
    -1
      apt/map.jinja
  3. +30
    -0
      apt/templates/apt_conf.jinja
  4. +22
    -0
      pillar.example

+ 36
- 0
apt/apt_conf.sls Zobrazit soubor

@@ -0,0 +1,36 @@
{% from "apt/map.jinja" import apt as apt_map with context %}
{% set remove_apt_conf = salt['pillar.get']('apt:remove_apt_conf', apt_map.remove_apt_conf) %}
{% set confd_dir = salt['pillar.get']('apt:confd_dir', apt_map.confd_dir) %}
{% set clean_apt_conf_d = salt['pillar.get']('apt:clean_apt_conf_d', apt_map.clean_apt_conf_d) %}
{% set apt_conf_d = salt['pillar.get']('apt:apt_conf_d', apt_map.apt_conf_d) %}

/etc/apt/apt.conf:
file.managed:
- mode: '0644'
- user: root
- group: root
{% if remove_apt_conf %}
- contents: ''
- contents_newline: False
{% else %}
- replace: False
{% endif %}

{{ confd_dir }}:
file.directory:
- mode: 755
- user: root
- group: root
- clean: {{ clean_apt_conf_d }}

{% for file, contents in apt_conf_d|dictsort %}
{{ confd_dir }}/{{ file }}:
file.managed:
- source: salt://apt/templates/apt_conf.jinja
- template: jinja
- user: root
- group: root
- mode: 644
- context:
data: {{ contents }}
{% endfor %}

+ 4
- 1
apt/map.jinja Zobrazit soubor

@@ -14,6 +14,9 @@
'preferences': {},
'remove_preferences': false,
'clean_preferences_d': false,
'remove_apt_conf': false,
'clean_apt_conf_d': false,
'apt_conf_d': {},
'default_keyserver': 'pool.sks-keyservers.net',
'default_url': 'http://deb.debian.org/debian/',
'default_keyring_package': 'debian-archive-keyring',
@@ -30,6 +33,6 @@
'arch': arch,
'comps': ['main'],
},
},
},
},
}, merge=salt['pillar.get']('apt:lookup'), default='Debian') %}

+ 30
- 0
apt/templates/apt_conf.jinja Zobrazit soubor

@@ -0,0 +1,30 @@
{%- macro print(mname, mvalue) %}
{%- if mvalue is string %}
{{ mname }} "{{ mvalue }}";
{%- elif mvalue is sequence %}
{{ mname }} {
{%- for item in mvalue %}
"{{ item }}";
{%- endfor %}
};
{%- endif %}
{%- endmacro -%}
// This file is managed by salt
{%- for opt, opt_data in data|dictsort -%}
{%- if opt_data is string %}
{{ opt }} "{{ opt_data }}";
{%- elif opt_data is mapping %}
{{ opt }}
{
{%- for name, value in opt_data|dictsort %}
{{- print(name, value) }}
{%- endfor %}
};
{%- elif opt_data is sequence %}
{{ opt }} {
{%- for item in opt_data %}
"{{ item }}";
{%- endfor %}
};
{%- endif %}
{%- endfor -%}

+ 22
- 0
pillar.example Zobrazit soubor

@@ -8,6 +8,28 @@ apt:
remove_preferences: true
clean_preferences_d: true

apt_conf_d:
30release:
'APT::Default-Release': stable
'40dpkg-options':
'Dpkg::Options':
- '--force-confdef'
- '--force-confold'
60proxy:
'Acquire::ftp':
Proxy: "ftp://127.0.0.1/"
'Proxy::http.us.debian.org': DIRECT
ProxyLogin:
- "USER $(PROXY_USER)"
- "PASS $(PROXY_PASS)"
- "USER $(SITE_USER)@$(SITE):$(SITE_PORT)"
- "PASS $(SITE_PASS)"
DSelect:
Clean: auto
Options: -f
UpdateOptions: ""
PromptAfterUpdate: "no"

unattended:
allowed_origins:
- origin1

Načítá se…
Zrušit
Uložit