0
0
mirror of https://github.com/saltstack-formulas/sysctl-formula.git synced 2025-02-17 18:24:37 +01:00

Added support for dictionary params (params2)

This commit is contained in:
Enver 2016-02-11 15:16:46 +01:00
parent a9082ccfcd
commit 936c990809
2 changed files with 30 additions and 5 deletions

View File

@ -11,3 +11,10 @@ sysctl:
- -
name: vm.swappiness name: vm.swappiness
value: 20 value: 20
# Setting params2 excludes all params values
params2:
fs.file-max:
value: 100000
config: fs.conf
vm.swappiness:
value: 20

View File

@ -4,7 +4,23 @@
{## import settings from map.jinja ##} {## import settings from map.jinja ##}
{% from "sysctl/map.jinja" import sysctl_settings with context %} {% from "sysctl/map.jinja" import sysctl_settings with context %}
{% for param in sysctl_settings.get('params', {}) %} {% if sysctl_settings.get('params2', '') != '' %}
{% for param_name, param in sysctl_settings.get('params2', {}).items() %}
{% if param is mapping %}
sysctl-present-{{ param_name }}:
sysctl.present:
- name: {{ param_name }}
- value: {{ param.value }}
{% if param.config is defined %}
- config: {{ sysctl_settings.config.location }}/{{ param.config }}
{% endif %}
{% endif %}
{% endfor %}
{% else %}
{% for param in sysctl_settings.get('params', {}) %}
{% if param is mapping %} {% if param is mapping %}
sysctl-present-{{ param.name }}: sysctl-present-{{ param.name }}:
sysctl.present: sysctl.present:
@ -14,4 +30,6 @@ sysctl-present-{{ param.name }}:
- config: {{ sysctl_settings.config.location }}/{{ param.config }} - config: {{ sysctl_settings.config.location }}/{{ param.config }}
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endif %}