diff --git a/modules/utilities/unix/authentication/ldap_server/manifests/install.pp b/modules/utilities/unix/authentication/ldap_server/manifests/install.pp index c9b403301..51b4bb507 100644 --- a/modules/utilities/unix/authentication/ldap_server/manifests/install.pp +++ b/modules/utilities/unix/authentication/ldap_server/manifests/install.pp @@ -53,22 +53,6 @@ class ldap_server::install { ensure => installed, } - -> - # Configure phpLDAPadmin base DN to match LDAP domain - exec { 'configure-phpldapadmin-base-dn': - command => "/bin/sed -i \"s/\\$servers->setValue('server','base',array('dc=example,dc=com'));/\\$servers->setValue('server','base',array('${base_dn}'));/\" /etc/phpldapadmin/config.php", - onlyif => "/bin/grep -q \"dc=example,dc=com\" /etc/phpldapadmin/config.php", - path => ['/bin', '/usr/bin'], - } - -> - # Configure phpLDAPadmin to start auto-incrementing UIDs at 10000 and GIDs at 5000 - # This avoids conflicts with local system users (typically 1000-9999) - # Inserts the configuration line before the closing ?> tag - exec { 'configure-phpldapadmin-auto-uid': - command => "/bin/sed -i \"/^?>$/i \\$servers->setValue('auto_number','min',array('uidNumber'=>10000,'gidNumber'=>5000));\" /etc/phpldapadmin/config.php", - unless => "/bin/grep -q \"auto_number.*uidNumber\" /etc/phpldapadmin/config.php", - path => ['/bin', '/usr/bin'], - } -> # Enable PHP module in Apache (version-agnostic) # Uses find to locate the installed PHP module and enables it @@ -102,4 +86,25 @@ class ldap_server::install { command => '/usr/sbin/service apache2 restart', path => ['/bin', '/usr/bin', '/usr/sbin'], } + -> + + # Configure phpLDAPadmin base DN to match LDAP domain + exec { 'configure-phpldapadmin-base-dn': + command => "/bin/sed -i \"s/\\$servers->setValue('server','base',array('dc=example,dc=com'));/\\$servers->setValue('server','base',array('${base_dn}'));/\" /etc/phpldapadmin/config.php", + onlyif => "/bin/grep -q \"dc=example,dc=com\" /etc/phpldapadmin/config.php", + path => ['/bin', '/usr/bin'], + } + -> + # Configure phpLDAPadmin to start auto-incrementing UIDs at 10000 and GIDs at 5000 + # This avoids conflicts with local system users (typically 1000-9999) + # Inserts the configuration line before the closing ?> tag (with flexible whitespace matching) + exec { 'configure-phpldapadmin-auto-uid': + command => "/bin/sed -i \"/^?>\\s*$/i \\\$servers->setValue('auto_number','min',array('uidNumber'=>10000,'gidNumber'=>5000));\" /etc/phpldapadmin/config.php && echo 'phpLDAPadmin auto-UID configured'", + onlyif => [ + "/bin/test -f /etc/phpldapadmin/config.php", + "/bin/grep -q '^?>' /etc/phpldapadmin/config.php" + ], + unless => "/bin/grep -q \"uidNumber.*10000\" /etc/phpldapadmin/config.php", + path => ['/bin', '/usr/bin'], + } }