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
|
# File 'manifests/clientinstall.pp', line 1
define ipa::clientinstall (
$host = $name,
$masterfqdn = {},
$domain = {},
$realm = {},
$adminpw = {},
$otp = {},
$mkhomedir = {},
$ntp = {}
) {
Exec["client-install-${host}"] ~> Ipa::Flushcache["client-${host}"]
$mkhomediropt = $mkhomedir ? {
true => '--mkhomedir',
default => ''
}
$ntpopt = $ntp ? {
true => '',
default => '--no-ntp'
}
$clientinstallcmd = shellquote('/usr/sbin/ipa-client-install',"--server=${masterfqdn}","--hostname=${host}","--domain=${domain}","--realm=${realm}","--password=${otp}","${mkhomediropt}","${ntpopt}",'--unattended')
$dc = prefix([regsubst($domain,'(\.)',',dc=','G')],'dc=')
exec { "client-install-${host}":
command => "/bin/echo | $clientinstallcmd",
unless => shellquote('/bin/bash','-c',"LDAPTLS_REQCERT=never /usr/bin/ldapsearch -LLL -x -H ldaps://${masterfqdn} -D uid=admin,cn=users,cn=accounts,${dc} -b ${dc} -w ${adminpw} fqdn=${host} | /bin/grep ^krbPrincipalName"),
timeout => '0',
tries => '60',
try_sleep => '90',
returns => ['0','1'],
logoutput => "on_failure"
}<- notify { "Running IPA client install, please wait.": }
ipa::flushcache { "client-${host}":
}
}
|