Skip to content
Snippets Groups Projects
openldap_install.pp 1.89 KiB
Newer Older
# Basic configuration: /etc/ldap/ldap.conf, /etc/default/slapd, et al.

Adam Lewenberg's avatar
Adam Lewenberg committed
# Install the OpenLDAP Debian packages.
#
# $distribution: A valid Debian distribution. This can
#   be the usual ones, such as "jessie", "stretch", "buster", "sid".
#   It can also be one of the stanford special ones, e.g.,
#   "stretch-acs-dev", "stretch-acs-prod", etc.
#
# $repository: If the package is found in a non-standard location,
#   you can indicate the repository here. Note that the repositories
#     - http://debian.stanford.edu/debian-local
#     - http://debian.stanford.edu/debian-stanford
#   should already be convered and are considerd standard locations.
#
#  #########
#  Example 1
#
#  class {'su_ldap::openldap_install':
#    distribution => 'stretch'
#  }
#
#  This will install the stock OpenLDAP packages from the stretch distribution.
#
#
#  #########
#  Example 2:
#
#  class {'su_ldap::openldap_install':
#    distribution => 'stretch-acs-dev'
#  }
#
# This will install the OpenLDAP packages from the special stretch-acs-dev
# distribution that resides in the "stanford" repository.


class su_ldap::openldap_install (
  $distribution = undef,
  $repository   = undef,
Adam Lewenberg's avatar
Adam Lewenberg committed
) {

  # Only need to do something if $distribution is defined.

  if ($distribution) {
    # If $repository is defined, we need to add a file in
    # /etc/apt/sources.list.d.
    if ($repository) {
Adam Lewenberg's avatar
Adam Lewenberg committed
      file { '/etc/apt/sources.list.d/ldap.list':
        content => template('su_ldap/etc/apt/sources.list.d/ldap.erb')
      }
    }

    # Pin some OpenLDAP packages.
    file { '/etc/apt/preferences.d/ldap':
      content => template('su_ldap/etc/apt/preferences.d/ldap.erb'),
      notify  => Exec['ldap aptitude update'];
    }

    # What about special sasl? LATER.

    # Update aptitude.
    exec { 'ldap aptitude update':
Adam Lewenberg's avatar
Adam Lewenberg committed
      path        => '/usr/bin:/usr/sbin:/bin',
      command     => 'aptitude update',
      refreshonly => true,
    }

  }