Puppet on Windows in Chocolatey flavor
Puppet is an open source tool for configuration management. This enjoys great popularity in both Linux and Unixoid environments. What many people don’t know: Puppet can also be used with Windows.
Puppet has built-in resource types suitable for Windows use, such as User, File, Exec and Package.
To install packages such as in MSI or Exe format, use the following code:
package { 'mysql':
ensure => '5.5.16',
source => 'N:packagesmysql-5.5.16-winx64.msi',
install_options => ['INSTALLDIR=C:mysql-5.5'],
}
However, Windows takes a completely different administrative approach than Linux. The smallest difference is the different slash/backslash spelling. This becomes clearer when you look at the approach to software configuration: Under Windows, this is rarely implemented with configuration files, but mostly via the registry. The resource type File doesn’t really help here.
If a new task arises that needs to be solved with Puppet, the best place to start is to search in the Puppet Forge. Often others have already faced the same challenge and have already documented the solution there. If you search for “Windows” in the Forge you will come across the “Windows module collection” from Puppetlabs. The collection contains:
– puppetlabs/acl – Setting ALCs on the file system
– puppetlabs/dsc – administration of Windows PowerShell DSC (Desired State Configuration)
– puppetlabs/iis – administration of the IIS web server
– puppetlabs/powershell – Execute Powershell commands
– puppetlabs/reboot – Perform reboots
– puppetlabs/registry – Set or delete registry keys
– puppetlabs/wsus_client – Set the WSUS client configuration
– puppet/download_file – Download files
– puppet/windows_env – Setting environment variables
– puppet/windowsfeature – Install roles or features
– puppetlabs/chocolatey – Configure and install the Windows package manager Chocolatey
Many functions provided by Windows are divided into roles (ActiveDirectory, DHCP, DNS, Hyper-V, File and Print services, IIS, …) and features (.NET Framework, Containers, BitLocker, BranchCache, …). These can be installed via the Puppetlabs/windowsfeature module:
windowsfeature { 'Web-WebServer':
ensure => present,
installsubfeatures => true,
}
The situation is different with programs that are not integrated into Windows. If you follow the classic approach, the installation is carried out using the MSI or Exe packages provided. This can certainly present some pitfalls, for example the deployment space, the transfer of installation parameters or version conflicts.
If you now compare this approach with the package managers from the Linux environment, it turns out to be not very convenient.
The Chocolatey package manager for Windows can help here. Following the example of other package managers, packages can be installed with a one-line command:
C:> choco install mysql
Chocolatey is well integrated with most configuration management tools such as Ansible, Chef, PowerShell, Salt and Puppet:
package { 'mysql':
ensure => 'latest',
provider => 'chocolatey',
}
Four lines are enough to install the current version of MySql Server on a Windows system using Puppet and Chocolatey.
By default, packages are sourced from a central community package repository. This currently provides 5839 “community maintained packages”. Although the packages undergo QA, they are code that does not come from our own infrastructure. This is not desirable in many environments. But Chocolatey is also prepared for this: There is the option of setting up and using an internal repository.
There are currently four versions of Chocolatey: Open Source, Pro, Architect, Business.
The open source version is sufficient for most areas of application and can be used in the enterprise environment. As soon as extended functions such as the convenient creation of your own packages, auditing, support are required or the installation volume slips into the area of “excessive use”, an extension to a commercial license is unavoidable.
Conclusion:
There are currently enough Puppet modules for Windows use on the Puppet Forge and on GitHub. They cover the most important functions and are of high quality. Chocolatey impresses with its easy operation in the standard configuration and has the potential to bring even more DevOps into the Windows world. So you can definitely say that Puppet is now also a good configuration management tool for Windows that doesn’t have to hide behind other tools.
Puppet for Windows Training
The “Puppet for Windows” training focuses on the basics of Puppet syntax, working methods (code development, versioning, automation) and module development strategies.
The participants know the basics of the configuration management tool Puppet, try out how it works under Windows and learn the special features of using it under Windows.
You might also like
Rainer Bopp
Latest posts by Rainer Bopp (see all)
- Puppet on Windows in Chocolatey flavor - 6. July 2018