Browse Source

feat(map): sync map.jinja with template-formula

tags/v0.7.0
Nicolas Rodriguez 5 years ago
parent
commit
2b4c4d5f4c
5 changed files with 118 additions and 13 deletions
  1. +48
    -11
      apt-cacher/ng/map.jinja
  2. +35
    -0
      apt-cacher/ng/osarchmap.yaml
  3. +9
    -2
      apt-cacher/ng/osfamilymap.yaml
  4. +13
    -0
      apt-cacher/ng/osfingermap.yaml
  5. +13
    -0
      apt-cacher/ng/osmap.yaml

+ 48
- 11
apt-cacher/ng/map.jinja View File

@@ -1,12 +1,49 @@
{% import_yaml "apt-cacher/ng/defaults.yaml" as defaults %}
{% import_yaml "apt-cacher/ng/osfamilymap.yaml" as osfamilymap %}

{%- set apt_cacher_ng = salt['grains.filter_by'](
defaults,
merge=salt['grains.filter_by'](
osfamilymap,
grain='os_family',
merge=salt['pillar.get']('apt_cacher_ng', {}),
),
base='apt_cacher_ng')
# -*- coding: utf-8 -*-
# vim: ft=jinja

{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{#- Start imports as #}
{%- import_yaml tplroot ~ "/ng/defaults.yaml" as default_settings %}
{%- import_yaml tplroot ~ "/ng/osarchmap.yaml" as osarchmap %}
{%- import_yaml tplroot ~ "/ng/osfamilymap.yaml" as osfamilymap %}
{%- import_yaml tplroot ~ "/ng/osmap.yaml" as osmap %}
{%- import_yaml tplroot ~ "/ng/osfingermap.yaml" as osfingermap %}

{#- Retrieve the config dict only once #}
{%- set _config = salt['config.get']('apt_cacher_ng', default={}) %}

{%- set defaults = salt['grains.filter_by'](
default_settings,
default='apt_cacher_ng',
merge=salt['grains.filter_by'](
osarchmap,
grain='osarch',
merge=salt['grains.filter_by'](
osfamilymap,
grain='os_family',
merge=salt['grains.filter_by'](
osmap,
grain='os',
merge=salt['grains.filter_by'](
osfingermap,
grain='osfinger',
merge=salt['grains.filter_by'](
_config,
default='lookup'
)
)
)
)
)
)
%}

{%- set config = salt['grains.filter_by'](
{'defaults': defaults},
default='defaults',
merge=_config
)
%}

{%- set apt_cacher_ng = config %}

+ 35
- 0
apt-cacher/ng/osarchmap.yaml View File

@@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
#
# Setup variables using grains['osarch'] based logic.
# You just need to add the key:values for an `osarch` that differ
# from `defaults.yaml`.
# Only add an `osarch` which is/will be supported by the formula.
#
# If you do not need to provide defaults via the `osarch` grain,
# you will need to provide at least an empty dict in this file, e.g.
# osarch: {}
---
amd64:
arch: amd64

x86_64:
arch: amd64

386:
arch: 386

arm64:
arch: arm64

armv6l:
arch: armv6l

armv7l:
arch: armv7l

ppc64le:
arch: ppc64le

s390x:
arch: s390x

+ 9
- 2
apt-cacher/ng/osfamilymap.yaml View File

@@ -1,8 +1,15 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
#
# Setup variables using grains['os_family'] based logic.
# You just need to add the key:values for an `os_family` that differ
# from `defaults.yaml` + `osarch.yaml`.
# Only add an `os_family` which is/will be supported by the formula.
#
# If you do not need to provide defaults via the `os_family` grain,
# you will need to provide at least an empty dict in this file, e.g.
# osfamilymap: {}
---
Debian: {}

FreeBSD:
credentials: /usr/local/etc/apt-cacher-ng/security.conf
root_group: wheel

+ 13
- 0
apt-cacher/ng/osfingermap.yaml View File

@@ -0,0 +1,13 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
#
# Setup variables using grains['osfinger'] based logic.
# You just need to add the key:values for an `osfinger` that differ
# from `defaults.yaml` + `osarch.yaml` + `os_family.yaml` + `osmap.yaml`.
# Only add an `osfinger` which is/will be supported by the formula.
#
# If you do not need to provide defaults via the `os_finger` grain,
# you will need to provide at least an empty dict in this file, e.g.
# osfingermap: {}
---
osfingermap: {}

+ 13
- 0
apt-cacher/ng/osmap.yaml View File

@@ -0,0 +1,13 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
#
# Setup variables using grains['os'] based logic.
# You just need to add the key:values for an `os` that differ
# from `defaults.yaml` + `osarch.yaml` + `os_family.yaml`.
# Only add an `os` which is/will be supported by the formula.
#
# If you do not need to provide defaults via the `os` grain,
# you will need to provide at least an empty dict in this file, e.g.
# osmap: {}
---
osmap: {}

Loading…
Cancel
Save