I have a powershell script that I need to re-use several times in puppet.  
Essentially it is a single line script that creates a new AD site.  But, I 
have three sites to create.  From my understanding I need to use a 
resource, but am having trouble getting it working.  Here is my setup:

 

 

-          Modules/win_ad_sites

*INIT.PP*

class win_ad_sites (

)

 

{

 

    anchor { 'win_ad_sites::begin': }->

        class  { 'win_ad_sites::install':}->

        anchor { 'win_ad_sites::end':}

 

}

*RESOURCE.PP*

define win_ad_sites::resource (

$adsitevar = $title

 

) {

 

 

exec { $title:

 

command    =>"Import-Module ActiveDirectory; New-AdReplicationSite 
${title}",

#unless      =>"Import-Module ActiveDirectory; $SiteName = 
get-adreplicationsite -identity $adsite; if (!$SiteName) {exit 1}",

provider       => powershell,

logoutput    => true,

    

        }

        }

-          Essentially, I need to configure it so I can pass the variable 
$adsite to this command have it execute

 

*install.pp*

 

class win_ad_sites::install {

 

 realize (Win_ad_sites::Resource['SanFrancisco'])

 

 

 }

 

 

But I cannot get this to work, I keep getting this error:

 

 

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: 
Faile

d to realize virtual resources Win_ad_sites::Resource[SanFrancisco] on node 
phdc

 

Any help would be appreciated.  

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/0bbec4e7-ce98-47f7-b615-5f36c367e86d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to