In this example, I am going to use Puppet to:
– Create a Windows user and add it to the RDP group.
– Add Web Server role.
– Install McAfee VSE8.8.
Before
Following things need to done:
1) Install the Puppet agent in Windows, detailed instruction can be found here.
2) Create a batch script named customize.bat, and save it to the Puppet file folder. (How to configure the Puppet file server can be found in my previous blog.)
@ECHO OFF
REM ‘Create user jchen’
ECHO Creating user jchen
NET USER jchen password /add /expires:never /passwordchg:no
REM ‘Add users to RDP group’
ECHO Adding users to RDP group
NET localgroup “Remote Desktop Users” jchen /add
REM ‘Add IIS
ECHO Adding IIS role
servermanagercmd -install Web-Server
REM ‘Install VSE’
ECHO Copying VSE installation file…
mkdir C:\VSEinstall
copy /y \\FILESHARE\share\VSEinstall\*.* “C:\VSEinstall\”
ECHO Done
ECHO Installing VSE…
cd “C:\VSEinstall\”
msiexec.exe /i vse880.msi /quiet
ECHO Done
3) Add the following scripts into the manifest file.
node “test01.sandbox.local”{
file { ‘c:\Windows\Temp\customize.bat’:
ensure => ‘file’,
mode => ‘0777’,
owner => ‘administrator’,
group => ‘users’,
source => “puppet:///files/customize.bat”,
}
exec { ‘customize’:
command => ‘C:/Windows/Temp/customize.bat > C:/Windows/Temp/customize_log.txt’,
path => $::path,
}
}
4) Run the command to test it in Windows: C:\Program Files (x86)\Puppet Labs\Puppet\bin>puppet agent –t
Info: Retrieving plugin
Info: Caching catalog for test01.sandbox.local
Info: Applying configuration version ‘1367926499’
Notice: /Stage[main]//Node[test01.sandbox.local]/Exec[customize]/returns: executed successfully
Notice: Finished catalog run in 38.79 seconds
After