0
0
mirror of https://github.com/saltstack-formulas/sysctl-formula.git synced 2024-11-28 03:28:13 +01:00
sysctl-formula/sysctl/map.jinja

56 lines
1.3 KiB
Django/Jinja

# -*- coding: utf-8 -*-
# vim: ft=jinja
{## Start with defaults from defaults.sls ##}
{% import_yaml 'sysctl/defaults.yml' as default_settings %}
{% set sysctl_lookup = salt['pillar.get']('sysctl:lookup', {}).copy() %}
{% if sysctl_lookup.params is defined %}
{% do sysctl_lookup.pop('params') %}
{% endif %}
{% if sysctl_lookup.params2 is defined %}
{% do sysctl_lookup.pop('params2') %}
{% endif %}
{## setup variable using grains['os_family'] based logic ##}
{% set os_family_map = salt['grains.filter_by']({
'Arch': {
"config": {
"location": '/etc/sysctl.d',
}
},
'RedHat': {
"config": {
"location": '/etc/sysctl.conf',
}
},
'Suse': {
"pkg": "procps",
"config": {
"location": '/etc/sysctl.d',
}
},
'Debian': {
"pkg": "procps",
"config": {
"location": '/etc/sysctl.d',
}
},
},
grain="os_family",
merge=sysctl_lookup)
%}
{## Merge the flavor_map to the default settings ##}
{% do default_settings.sysctl.update(os_family_map) %}
{## Merge in sysctl pillar ##}
{% set sysctl_settings = salt['pillar.get'](
'sysctl',
default=default_settings.sysctl,
merge=True
)
%}