Defined Type: hadoop::kinit
- Defined in:
- manifests/kinit.pp
Overview
Define hadoop::kinit
Initialize credentials. To be called before any hadoop::mkdir() and hadoop::user() resource type.
Requirements
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 |
# File 'manifests/kinit.pp', line 9
define hadoop::kinit($touchfile = $title) {
$env = [ "KRB5CCNAME=FILE:/tmp/krb5cc_nn_puppet_${touchfile}" ]
$path = '/sbin:/usr/sbin:/bin:/usr/bin'
$puppetfile = "/var/lib/hadoop-hdfs/.puppet-${touchfile}"
if $hadoop::hdfs_enable {
include ::hadoop::common::hdfs::config
}
if $hadoop::realm and $hadoop::realm != '' and $hadoop::zookeeper_deployed and $hadoop::_keytab_hdfs_admin and $hadoop::_principal_hdfs_admin {
# better to destroy the ticket (it may be owned by root),
# destroy it only when needed though
exec { "kdestroy-old-${touchfile}":
command => 'kdestroy || true',
path => $path,
environment => $env,
provider => 'shell',
creates => $puppetfile,
}
->
exec { "kinit-${touchfile}":
command => "kinit -k -t ${hadoop::_keytab_hdfs_admin} ${hadoop::_principal_hdfs_admin}",
path => $path,
environment => $env,
user => 'hdfs',
creates => $puppetfile,
require => File["${hadoop::confdir}/hdfs-site.xml"],
}
}
}
|