Hi,
I wants to create a class file that will do below steps
1. Purge directory "pki"
2. copy certificate ca.pem and $::hostname.localdomain.pem from location "certs" to same directory "pki"
3. rename the .pem certificates to .crt present in the same directory "pki" .
4. copy key file $::hostname.localdomain.pem from location "private_keys" to same "pki"
5. rename the .pem key file to .crt present in directory "pki" .
But when i am executing the below code i am getting error
===>
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate declaration: File[C:/Program Files (x86)/ICINGA2/etc/icinga2/pki] is already declared in file /etc/puppet/environments/production/modules/win_nms/manifests/config.pp:15; cannot redeclare at /etc/puppet/environments/production/modules/w
in_nms/manifests/config.pp:27 on node r8systsnode03.localdomain Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
<===
MY CONFIG CLASS CODE IS
=============================
class win_nms::config {
include win_nms::params
if $osfamily == 'windows' {
file { "purge_dir":
name => "$::win_nms::params::nms_pki_pub_dir",
ensure => directory,
recurse => true,
purge => true,
}
file { 'pki_cert':
path => "$::win_nms::params::nms_pki_pub_dir",
ensure => directory,
source_permissions => ignore,
recurse => true,
source => "C:/ProgramData/PuppetLabs/puppet/etc/ssl/certs",
}
exec { "Rename_crt":
command => "cmd.exe /c ren *.pem *.crt",
path => "C:/Windows/System32",
cwd => "$::win_nms::params::nms_pki_pub_dir",
}
file { "pki_key":
name => "$::win_nms::params::nms_pki_pri_dir",
ensure => 'directory',
source_permissions => ignore,
source => "C:/ProgramData/PuppetLabs/puppet/etc/ssl/private_keys",
}
MY PARAMS CLASS CODE IS
==========================
class win_nms::params {
case $::osfamily {
windows: {
$nms_package_name = 'Icinga2-v2.3.10'
$nms_pki_pub_dir = 'C:/Program Files (x86)/ICINGA2/etc/icinga2/pki/'
$nms_pki_pri_dir = 'C:/Program Files (x86)/ICINGA2/etc/icinga2/pki/'
$nms_service_name = 'icinga2'
}
default: {
fail("Module icinga does not support osfamily: ${::osfamily}")
}
}
}
↧