Browse Source

[apt/repositories] more flexible options in pillars

contributed initialy by @javierbertoli <javier@netmanagers.com.ar>

fixes #30
tags/v0.7.0
Arthur Lutz 7 years ago
parent
commit
5868f22c47
2 changed files with 31 additions and 4 deletions
  1. +24
    -3
      apt/repositories.sls
  2. +7
    -1
      pillar.example

+ 24
- 3
apt/repositories.sls View File

- group: root - group: root
- clean: {{ clean_sources_list_d }} - clean: {{ clean_sources_list_d }}




{% for repo, args in repositories.iteritems() %} {% for repo, args in repositories.iteritems() %}
{%- set r_arch = '[arch=' ~ args.arch|join(',') ~ ']' if args.arch is defined else '' %}

{% set r_opts = '' %}
{%- set r_arch = 'arch=' ~ args.arch|join(',') if args.arch is defined else '' %}
{% if args.opts is defined %}
{% if args.opts is string %}
{% set r_opts = args.opts %}
{% else %}
{% set r_opts_list = [] %}
{%- for k, v in args.opts.items() %}
{% do r_opts_list.append(' ' ~ k ~ '=' ~ v) %}
{%- endfor %}
{% set r_opts = r_opts_list|join(' ') %}
{% endif %}
{% endif %}

{% if r_arch != '' or r_opts != '' %}
{% set r_options = '[' ~ r_arch ~ ' ' ~ r_opts ~ ' ]' %}
{% else %}
{% set r_options = '' %}
{% endif %}

{%- set r_url = args.url or default_url %} {%- set r_url = args.url or default_url %}
{%- set r_distro = args.distro or 'stable' %} {%- set r_distro = args.distro or 'stable' %}
{%- set r_opts = args.opts if args.opts is defined else '' %}
{%- set r_comps = args.comps|default(['main'])|join(' ') %} {%- set r_comps = args.comps|default(['main'])|join(' ') %}
{%- set r_keyserver = args.keyserver if args.keyserver is defined else apt_map.default_keyserver %} {%- set r_keyserver = args.keyserver if args.keyserver is defined else apt_map.default_keyserver %}




{{ r_type }} {{ repo }}: {{ r_type }} {{ repo }}:
pkgrepo.managed: pkgrepo.managed:
- name: {{ r_type }} {{ r_arch }} {{ r_opts }} {{ r_url }} {{ r_distro }} {{ r_comps }}
- name: {{ r_type }} {{ r_options }} {{ r_url }} {{ r_distro }} {{ r_comps }}
- file: {{ sources_list_dir }}/{{ repo }}-{{ type }}.list - file: {{ sources_list_dir }}/{{ repo }}-{{ type }}.list
{# You can use either keyid+keyserver or key_url. If both are provided {# You can use either keyid+keyserver or key_url. If both are provided
the latter will be used. #} the latter will be used. #}

+ 7
- 1
pillar.example View File

intranet: intranet:
distro: stretch distro: stretch
url: http://intranet.example.org url: http://intranet.example.org
opts: "[trusted=yes]"
opts: "trusted=yes"
extranet:
distro: stretch
url: https://extranet.example.org
opts:
trusted: 'yes'
another: whatever


preferences: preferences:
00-rspamd: 00-rspamd:

Loading…
Cancel
Save