I have a Win (Server 2012 R2) agent box on which i have installed Active Directory. I am now trying to create OUs in it.
[root@myhost] cat create_organizational_unit.pp
class infra::ad::create_organizational_unit (
$ou_data = $infra::params::ou_data,
) inherits infra::params {
each($ou_data) |$ou_name, $ou_dc_path| {
windows_ad::organisationalunit { "$ou_name":
ensure => present,
path => $ou_dc_path,
ouName => $ou_name,
}
}
}
[root@myhost] cat params.pp
$ou_data = {
'Support' => 'DC=TEST,DC=COM',
'DBA' => 'DC=TEST,DC=COM',
'SFTP' => 'DC=TEST,DC=COM',
'PROD' => 'OU=SFTP,DC=TEST,DC=COM',
'Users' => 'OU=PROD,OU=SFTP,DC=TEST,DC=COM',
'Groups' => 'OU=PROD,OU=SFTP,DC=TEST,DC=COM',
},
Issue i am facing now is that when i apply the catalog by running puppet agent -t
on agent, i see either of the following behaviour:
1) Either i have to run the above command multiple times because it doesn't apply the catalog in one go.
2) Irrespective of how many times i run the above command, it just doesn't apply the full catalog.
Why is it so? This is not the first time i have seen this. Although not frequent, it does happen at times.
UPDATE: Running in debug mode also did not provide anything useful. Tried running a powershell script for creating the same OU hierarchy and it works just fine. I am using windows_ad module. I see there is no active development on this module. So thought of trying winad which is active but when tried fetching catalog, i get the following error:
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: {"message":"Server Error: Evaluation Error: Error while eval
uating a Resource Statement, Could not autoload puppet/type/winad_ou: no such file to load -- puppet/util/validator at /etc/puppetlabs/
code/environments/automation/modules/infra/manifests/ad/create_organizational_unit.pp:5:9 on node abc.temp.com","issue_kind":"RUN
TIME_ERROR"}
Warning: Not using cache on failed catalog
Puppet agent version:
C:\>puppet --version
4.5.2