Merge pull request #30 from n-rodriguez/wip/pillar

refactor(pillar): sync map.jinja with template-formula
This commit is contained in:
Nicolas Rodriguez 2019-08-27 08:34:33 +02:00 committed by GitHub
commit 535afa2b82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 104 additions and 30 deletions

View File

@ -4,21 +4,46 @@
{#- Get the `tplroot` from `tpldir` #} {#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %} {%- set tplroot = tpldir.split('/')[0] %}
{#- Start imports as #} {#- Start imports as #}
{%- import_yaml tplroot ~ "/defaults.yaml" or {} as default_settings %} {%- import_yaml tplroot ~ "/defaults.yaml" as default_settings %}
{%- import_yaml tplroot ~ "/osfamilymap.yaml" or {} as osfamilymap %} {%- import_yaml tplroot ~ "/osarchmap.yaml" as osarchmap %}
{%- import_yaml tplroot ~ "/osmap.yaml" or {} as osmap %} {%- import_yaml tplroot ~ "/osfamilymap.yaml" as osfamilymap %}
{%- import_yaml tplroot ~ "/osfingermap.yaml" or {} as osfingermap %} {%- import_yaml tplroot ~ "/osmap.yaml" as osmap %}
{%- import_yaml tplroot ~ "/osfingermap.yaml" as osfingermap %}
{%- set defaults = salt['grains.filter_by'](default_settings, {#- Retrieve the config dict only once #}
default='keepalived', {%- set _config = salt['config.get'](tplroot, default={}) %}
merge=salt['grains.filter_by'](osfamilymap, grain='os_family',
merge=salt['grains.filter_by'](osmap, grain='os', {%- set defaults = salt['grains.filter_by'](
merge=salt['grains.filter_by'](osfingermap, grain='osfinger', default_settings,
merge=salt['pillar.get']('keepalived:lookup', default={}) 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 keepalived pillar #} {%- set config = salt['grains.filter_by'](
{%- set keepalived = salt['pillar.get']('keepalived', default=defaults, merge=True) %} {'defaults': defaults},
default='defaults',
merge=_config
)
%}
{%- set keepalived = config %}

35
keepalived/osarchmap.yaml Normal file
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

View File

@ -1,6 +1,13 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: ft=yaml # 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: {} osfamilymap: {}
RedHat: {}
Suse: {}

View File

@ -1,11 +1,13 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: ft=yaml # 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: {}
--- ---
Debian-8: {} osfingermap: {}
Debian-9: {}
Ubuntu-16.04: {}
Ubuntu-18.04: {}
Fedora-28: {}
Fedora-29: {}
CentOS-7: {}
openSUSE-4.23: {}

View File

@ -1,8 +1,13 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: ft=yaml # 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: {}
--- ---
Debian: {} osmap: {}
Ubuntu: {}
Fedora: {}
CentOS: {}
openSUSE: {}