Skip to content

Instantly share code, notes, and snippets.

@lee-pai-long
Created February 5, 2016 15:15
Show Gist options
  • Save lee-pai-long/10c0b85257a4d903c1bf to your computer and use it in GitHub Desktop.
Save lee-pai-long/10c0b85257a4d903c1bf to your computer and use it in GitHub Desktop.

[SALTSTACK] OpenLDAP standard state


State file

ldap:
  pkg:
    - installed
    - names:
      - openldap-servers
      - openldap-clients
  file:
    - managed
    {% grains['os'] == 'CentOS' %}
    - name: /etc/openldap/ldap.conf
    {% elif grains['os'] == 'Debian' %}
    - name: /etc/ldap/ldap.conf
    {% endif %}
    - source: salt://ldap/ldap.conf
    - template: jinja
    - user: root
    - context: {
      ldap_uri: "ldaps://ldap.domain.tld/ ldaps://ldap-master.domain.tld/",
      ldap_base: "dc=domain,dc=tld" }
    - group: root
    - mode: 644
    - makedirs: True
    - require:
      - pkg: openldap-servers
      - pkg: openldap-clients

LDAP configuration with jinja templating

# LDAP Example Configuration
# This file should be world readable but not world writable.

#URI ldap://ldap.domain.tld ldap://ldap-master.domain.tld
{{ ldap_uri }}

#BASE	dc=example,dc=com
{{ ldap_base }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment