# Set up apt to get the correct 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. # # IMPORTANT! This class assumes that the APT sources list file is already # present # # ######### # 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::apt_setup ( $debian_distribution = undef, $debian_archive = 'debian-stanford', $debian_repository = undef, ) { # Only need to do something if $debian_distribution is defined. if ($debian_distribution != undef) { # If the debian_distribution is "special" (e.g., not one of the normal ones like # the current codename), then we need to create an apt source list file. if ($debian_distribution != $facts['os']['distro']['codename']) { su_apt::source { $debian_distribution: comment => 'Special sources.list.d file for OpenLDAP', archive => $debian_archive, distribution => $debian_distribution, repository => $debian_repository, notify => Exec['ldap_aptitude_update']; } } # 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']; } # Update aptitude. exec { 'ldap_aptitude_update': path => '/usr/bin:/usr/sbin:/bin', command => 'aptitude update', refreshonly => true, } } }