Created formula; supports Debian and RedHat OSes
This commit is contained in:
parent
96a3d5d909
commit
4af6d8a062
10
files/nslcd.conf.jinja
Normal file
10
files/nslcd.conf.jinja
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{% set nslcd_conf = salt['pillar']['get']('nslcd') -%}
|
||||||
|
|
||||||
|
#
|
||||||
|
## This file is being managed by Salt.
|
||||||
|
## Any manual modifications will be overwritten the next time Salt runs.
|
||||||
|
#
|
||||||
|
|
||||||
|
{% for key,value in nslcd_conf.items() -%}
|
||||||
|
{{ key }} = {{ value }}
|
||||||
|
{% endfor %}
|
10
nslcd/defaults.yaml
Normal file
10
nslcd/defaults.yaml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
nslcd:
|
||||||
|
package_name: nslcd
|
||||||
|
|
||||||
|
conf_path: /etc/nslcd.conf
|
||||||
|
conf_user: root
|
||||||
|
conf_group: root
|
||||||
|
conf_mode: 640
|
||||||
|
|
||||||
|
service_name: nslcd
|
||||||
|
service_enable: True
|
23
nslcd/init.sls
Normal file
23
nslcd/init.sls
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{% from "nslcd/map.jinja" import nslcd_settings as nslcd with context %}
|
||||||
|
|
||||||
|
nslcd_package:
|
||||||
|
pkg.installed:
|
||||||
|
- name: {{ nslcd.package_name }}
|
||||||
|
|
||||||
|
nslcd_conf:
|
||||||
|
file.managed:
|
||||||
|
- name: {{ nslcd.conf_path }}
|
||||||
|
- user: {{ nslcd.conf_user }}
|
||||||
|
- group: {{ nslcd.conf_group }}
|
||||||
|
- mode: {{ nslcd.conf_mode }}
|
||||||
|
- template: jinja
|
||||||
|
- source: salt://nslcd/files/nslcd.conf.jinja
|
||||||
|
- require:
|
||||||
|
- pkg: nslcd_package
|
||||||
|
|
||||||
|
nslcd_service:
|
||||||
|
service.running:
|
||||||
|
- name: {{ nslcd.service_name }}
|
||||||
|
- watch:
|
||||||
|
- pkg: nslcd_package
|
||||||
|
- file: nslcd_conf
|
29
nslcd/map.jinja
Normal file
29
nslcd/map.jinja
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: ft=jinja
|
||||||
|
|
||||||
|
{## Start with defaults from defaults.sls ##}
|
||||||
|
{% import_yaml 'nslcd/defaults.yaml' as default_settings %}
|
||||||
|
|
||||||
|
{##
|
||||||
|
Setup variable using grains['os_family'] based logic, only add key:values here
|
||||||
|
that differ from whats in defaults.yaml
|
||||||
|
##}
|
||||||
|
{% set flavor_map = salt['grains.filter_by'](
|
||||||
|
{
|
||||||
|
'RedHat': {
|
||||||
|
'package_name': 'nss-pam-ldapd'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
grain='os_family',
|
||||||
|
merge=salt['pillar.get']('nslcd:lookup')
|
||||||
|
) %}
|
||||||
|
|
||||||
|
{## Merge the flavor_map over the default settings ##}
|
||||||
|
{% do default_settings.nslcd.update(flavor_map) %}
|
||||||
|
|
||||||
|
{## Merge in changes from the nslcd:lookup pillar ##}
|
||||||
|
{% set nslcd_settings = salt['pillar.get'](
|
||||||
|
'nslcd',
|
||||||
|
default=default_settings.nslcd,
|
||||||
|
merge=True
|
||||||
|
) %}
|
Loading…
Reference in New Issue
Block a user