puppet- on windows common issues – 2

By W.ZH Sept 2013

About Web Platform Installer

WebPI is a very powerful tool to install many MS product, normal way you have know already. here I am going to talk about the command line way.

you need this as in puppet install the MS product, at most time, you do not want the GUI comes out and need user interactive for the EULA or others.

You need a silent install and control to agent windows system.

Here is the link to learn WPI:

http://www.iis.net/learn/install/web-platform-installer/web-platform-installer-v4-command-line-webpicmdexe-rtw-release

under your PC,

C:\Program Files\Microsoft\Web Platform Installer

and then you can use WPI exe to do many things:

WebPICMD.exe /List /ListOption:Avaliable
WebPICMD.exe /Install /Products:OfficeToolsForVS2012RTW

You can use follow package to auto install the WPI on agent system:
  package { ‘Microsoft Web Platform Installer 4.6’:
ensure => installed,
source => “C:\\TEMP\\WebPlatformInstaller_amd64_en-US.msi”,
}

With WPI ready, many MS product you can use either online or offline model to install them on silent model.

Here I just give you one small example for install the Web Deploy 2.1.


exec { ‘Web Deployment Tool 2.1’ :
command => “\”C:\\Program Files\\Microsoft\\Web Platform Installer\\WebPICMD.exe\” /install /Products:WDeploy_2_1  /AcceptEULA”,
provider => windows,
timeout => 500,
}
WDeploy_2_1 is hte name you get by API list feature.

Advertisements

puppet – how to start to learn it

By W.ZH Sept 2013

Puppet is a system manage tool for cloud or multiple servers. You can start to learn it in this way.

1. Download the Learning Puppet VM, and start this VM follow the instruction by VMware or VirtualBox

2. Follow the Learning Puppet Doc
Learning Puppet,  to do it step by step.. around 4-5 hours you know how it works.
3. After test in the linux VM, next step is to install the Puppet Enterprise 3.0, into a client, such as your windows PC, i suggest to create another VM to install it as agent, set the hosts file to point to the Learning VM to use it as the master.

4. Then go to master to approve the agent request for cert.

5. The agent can link to master and use the command console to run the agent test “puppet agent –test”

6. Read some tutorial and try basic script and grammar for the code.

Totally two to three days you can start to write some script to fit your request. it has strong feature for Unix, but not very strong in windows.

puppet- on windows common issues – 3

By W.ZH Sept 2013

C:\Windows\System32 access issue for puppet

This is a very trick issue and I must alert you here. As puppet is writen by ruby 32 bit. so when you try to run some test and program access to the C:\Windows\System32 folder to your agent system, you will get some strange error. Such as for my case, I want to enable the telnet client on windows, after is is enabled, telnet.exe file will show up under the C:\Windows\System32\telnet.exe. So I want to use “creates” to find it to avoid the dup install. But it always failed to find it. the reason is because on my 64 bit windows, ruby goes to the C:\Windows\SysWOW64 to look for it.


exec { ‘enable_telnetclient’:
command => “C:\\Windows\\System32\\pkgmgr.exe /iu:TelnetClient /quiet /norestart”,
provider => windows,
creates => “C:\\Windows\\
System32\\telnet.exe”,
returns => [0,194],
}

 

So what is the proper way we can let a 32 bit program to access system32 folder under the 64 bit windows?  use SysNative,

proper code should be:

  exec { ‘enable_telnetclient’:
command => “C:\\Windows\\SysNative\\pkgmgr.exe /iu:TelnetClient /quiet /norestart”,
provider => windows,
creates => “C:\\Windows\\SysNative\\telnet.exe”,
returns => [0,194],
}

Why? please read this links. I do not need to copy paste to here.

http://www.ghisler.ch/wiki/index.php/On_64-bit_Windows_versions,_some_files_and_folders_shown_by_Windows_Explorer_are_not_shown_by_Total_Commander!#Affected_files_and_folders

https://groups.google.com/forum/#!topic/puppet-users/A_9i2Wx1yFI

puppet- on windows common issues – 1

By W.ZH Sept 2013

Puppet has strong feature for Linux/Unix, but not very strong in windows. You should read the doc for windows when you plan to use to control the windows client.

Puppet on Windows
http://docs.puppetlabs.com/windows/index.html

Here I summarize some valuable common experience on windows I met.

About windows MSI and exe installer

puppet can control the msi program by wmic for you, this means, you just need to use the package to control a program is installed or not.

class dotnet_4_5 {
package { ‘Microsoft .NET Framework 4.5’:
ensure => installed,
source => “E:\\MYLocationFor4.5.netframwork installer\\\dotnetfx45_full_x86_x64.exe”,
install_options => [ ‘/quiet’ ,’/norestart’],
}
}

Here the package name must be same with the name in the MSI system. Source is point to the MSI installer for the program. By this case, puppet will go to your system detect by MSI to see whether
Microsoft .NET Framework 4.5 is installed or not, is installed, it will do nothing, if not, it will use source to install it.

 

But you know that there are many install can not be done by MSI, such as you want to install the SOAPUI. it use other installer to install. so exec will be very common to use for windows to do some install or script job for you.
class soapui {
$installerfile = ‘C:/TEMP/soapUI-x64-4.5.2.exe’
$targetInstalledEXEfile = ‘C:/Program Files/SmartBear/soapUI-4.5.2/bin/soapUI-4.5.2.exe’

################################################################################
# 2. to detect that SOAPUI is installed or not in target windows, by check some files existing or not
#     the reason is because the puppet can not auto find the soapui installed or not,
#   it will try to auto install every time
# 3. if there is not installed, then we can make a silent install for soap UI.
#     use default location and default config, this version should be a free version

# Run installer command unless target file exists
exec { ‘install_the_soapui_4_5_2’:
command => “$installerfile -q -splash title”,
creates => $targetInstalledEXEfile,
provider => windows,

timeout =>60,
# as we use “creates”, so we do not need onlyif anymore,
# onlyif => “if exist \”$targetInstalledEXEfile\” exit 1 else exit 0″
}
}

How to list the MSI installed products in your windows,

wmic product

Yes, that is all. It runs for a while and then spits out very detailed information on what is installed on the local system. If you need the information in a file for later processing, use the following variation of above command to have wmic create a CSV file:

wmic product get /format:csv > C:\TEMP\Software_MyPC.csv

about the MSI, exe refer to here:
http://www.symantec.com/connect/articles/understanding-difference-between-exe-and-msi

http://www.sepago.de/d/helge/2010/01/14/how-to-list-all-installed-applications-from-the-command-line