Browse Source

feat(pillar): update map.jinja from template-formula

tags/v0.4.0
Nicolas Rodriguez 5 years ago
parent
commit
c027735548
6 changed files with 108 additions and 18 deletions
  1. +0
    -0
      syslog_ng/defaults.yaml
  2. +42
    -14
      syslog_ng/map.jinja
  3. +35
    -0
      syslog_ng/osarchmap.yaml
  4. +0
    -0
      syslog_ng/osfamilymap.yaml
  5. +18
    -4
      syslog_ng/osfingermap.yaml
  6. +13
    -0
      syslog_ng/osmap.yaml

syslog_ng/defaults.yml → syslog_ng/defaults.yaml View File


+ 42
- 14
syslog_ng/map.jinja View File

# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: ft=jinja # vim: ft=jinja


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


{# get the settings for the os_family grain #}
{% set osfam = salt['grains.filter_by'](os_family_map) or {} %}
{#- Retrieve the config dict only once #}
{%- set _config = salt['config.get'](tplroot, default={}) %}


{# get the settings for the oscodename grain, os_family data will override oscodename data #}
{% set oscode = salt['grains.filter_by'](os_codename_map, grain='oscodename', merge=osfam) or {} %}
{%- set defaults = salt['grains.filter_by'](
default_settings,
default=tplroot,
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'
)
)
)
)
)
)
%}


{# merge the os family/os codename specific data over the defaults #}
{% do defaults.syslog_ng.update(oscode) %}
{%- set config = salt['grains.filter_by'](
{'defaults': defaults},
default='defaults',
merge=_config
)
%}


{# merge the pillar:lookup dict into the defaults/os specific dict #}
{% set lookup = salt['pillar.get']('syslog_ng:lookup', default=defaults.syslog_ng, merge=True) %}

{# merge the actual syslog_ng pillar into the above combined dict #}
{% set syslog_ng = salt['pillar.get']('syslog_ng', default=lookup, merge=True) %}
{%- set syslog_ng = config %}

+ 35
- 0
syslog_ng/osarchmap.yaml View File

# -*- 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

syslog_ng/os_family_map.yml → syslog_ng/osfamilymap.yaml View File


syslog_ng/os_codename_map.yml → syslog_ng/osfingermap.yaml View File

# vim: ft=yaml # vim: ft=yaml
--- ---
# Debian # Debian
wheezy:
Debian-7:
version: 3.3 version: 3.3
include: include:
- scl.conf - scl.conf
last_include: last_include:
- /etc/syslog-ng/conf.d/ - /etc/syslog-ng/conf.d/


jessie:
Debian-8:
version: 3.5 version: 3.5
include: include:
- scl.conf - scl.conf
last_include: last_include:
- /etc/syslog-ng/conf.d/*.conf - /etc/syslog-ng/conf.d/*.conf


stretch:
Debian-9:
version: 3.8 version: 3.8
include: include:
- scl.conf - scl.conf
last_include: last_include:
- /etc/syslog-ng/conf.d/*.conf - /etc/syslog-ng/conf.d/*.conf


Debian-10:
version: 3.12
include:
- scl.conf
last_include:
- /etc/syslog-ng/conf.d/*.conf

# Ubuntu # Ubuntu
xenial:
Ubuntu-16.04:
version: 3.5 version: 3.5
include: include:
- scl.conf - scl.conf
- '`scl-root`/system/tty10.conf' - '`scl-root`/system/tty10.conf'
last_include: last_include:
- /etc/syslog-ng/conf.d/*.conf - /etc/syslog-ng/conf.d/*.conf

Ubuntu-18.04:
version: 3.13
include:
- scl.conf
last_include:
- /etc/syslog-ng/conf.d/*.conf

+ 13
- 0
syslog_ng/osmap.yaml View File

# -*- 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