Skip to content

Instantly share code, notes, and snippets.

@dseira
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dseira/5e8911ef898674843732 to your computer and use it in GitHub Desktop.
Save dseira/5e8911ef898674843732 to your computer and use it in GitHub Desktop.
sysctl formula
sysctl:
config:
location: '/etc/sysctl.d'
params:
-
name: net.ipv4.ip_forward
value: 0
-
name: kernel.sysrq
value: 0
{% import_yaml 'sysctl/defaults.yaml' as defaults_settings %}
{% set sysctl_settings = salt['pillar.get'](
'sysctl',
default=defaults_settings.sysctl,
merge=True
)
%}
{% from "sysctl/map.jinja" import sysctl_settings with context %}
{% for param in sysctl_settings.params %}
{% if param is mapping %}
sysctl_present_{{ param.name }}:
sysctl.present:
- name: {{ param.name }}
- value: {{ param.value }}
{% endif %}
{% endfor %}
{% elif grains['fqdn'] == 'server1' %}
sysctl:
config:
location: '/etc/sysctl.d'
params:
-
name: net.ipv4.ip_forward
value: 1
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment