Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Configure this server to sync the suGAL person attributes using the
# the ldap-sync-sugal-attributes script.
#
# See also https://ikiwiki.stanford.edu/service/ldap/sync-scripts/
class s_ldap::base::syncs::ldap_sync_sugal_attributes (
$ensure = undef,
){
# Do we want the service to be running or stopped?
if ($ensure == 'present') {
$service_status = 'running'
} elsif ($ensure == 'absent') {
$service_status = 'stopped'
} else {
fail("ensure must be one 'present' or 'absent'")
}
# Load the package containing the ldap-sync-sugal-attributes script.
package { 'libstanford-directory-sync-sugal-perl':
ensure => installed,
require => Package['slapd'],
}
# Install the configuration file for the listener
file { '/etc/ldapadmin/ldap-sync-sugal-attributes-daemon.conf':
content => template('s_ldap/etc/ldapadmin/ldap-sync-sugal-attributes-daemon.conf.erb'),
require => File['/etc/ldapadmin'],
}
# Install the configuration file for the NON-listener
file { '/etc/ldapadmin/ldap-sync-sugal-attributes.conf':
content => template('s_ldap/etc/ldapadmin/ldap-sync-sugal-attributes.conf.erb'),
require => File['/etc/ldapadmin'],
}
# Install the visibility attributes mapping file.
file { '/etc/ldapadmin/sugal-visibility.yaml':
source => 'puppet:///modules/s_ldap/etc/ldapadmin/sugal-visibility.yaml',
require => File['/etc/ldapadmin'],
}
# Need a cron job to run the sync job against ALL the entries once per
# day.
file { '/etc/cron.d/ldap-sync-sugal-attributes':
ensure => $ensure,
mode => '0644',
source => 'puppet:///modules/s_ldap/etc/cron.d/ldap-sync-sugal-attributes',
require => File['/etc/ldapadmin/ldap-sync-sugal-attributes.conf'],
}
## Service (listener)
include s_ldap::base::systemd
# We want to reload the systemd daemon on any change to the unit
# file. We use the systemd shared library's systemd-daemon-reload to
# do this.
file { '/lib/systemd/system/ldap-sync-sugal-attributes.service':
ensure => present,
source => 'puppet:///modules/s_ldap/lib/systemd/system/ldap-sync-sugal-attributes.service',
mode => '0644',
notify => Exec['systemd-daemon-reload']
}
service { 'ldap-sync-sugal-attributes':
ensure => $service_status,
require => [
File['/lib/systemd/system/ldap-sync-sugal-attributes.service'],
Package['libstanford-directory-sync-sugal-perl'],
],
}
}