Puppet Manifest Generator for Windows
Disclaimer
-
This project was created out of a HackDay from the Windows team and is not a supported or actively maintained project by Puppet
-
While all care has been given, this project could destroy the known universe. Use at your own risk!
Please read the Disclaimer
Overview
A Blueprint style powershell module for Puppet - Windows Hackday 2016
The goal of the project is to show proof of concept for discovering what can be managed on a user's Windows machine. We will demonstrate the following workflow:
- User installs Powershell module
- User invokes Invoke-PuppetGenerator
- User converts returned PSObject to Puppet manifests
The plan of record is to discover and model the following types of resources:
- Groups
- Windows Features
- Environment variables
- Services
- Chocolatey Packages
- Local Group Policy
- Users
- IIS Configuration
- Message of the Day (MOTD)
Background
Windows users face a steep learning curve in understanding how to use Puppet. Using familiar Windows tools to discover the resources that can be managed and showing the user how to represent these resources with Puppet makes this on-ramp less daunting.
Assumptions
- Client machine runs Powershell v3+
- Target server machine runs Powershell v2+
- Generates both JSON and PP
Constraints
- No Puppet software needed
- Only generate Puppet manifests for which we have modules in the Forge or core Puppet types
- Single system (e.g. no modeling of Windows clustering)
- No de-duping of resources (e.g. may have two or more services with the same name)
Installation Instructions
This will execute the generator on your local computer and output the results to output\json
and output\manifest
[PS] > git clone https://github.com/puppetlabs/PuppetManifestGenerator
[PS] > cd PuppetManifestGenerator
[PS] > Import-Module ./PuppetManifestGenerator.psm1 -Force -Verbose
[PS] > Invoke-PuppetGenerator -Verbose
You can use Get-Help
for detailed information
Starting the GUI
There is a very simple GUI that can be used to import a CSV file and then run the generator
[PS] > Invoke-PuppetGeneratorGUI -Verbose
With a CSV file
[PS] > Invoke-PuppetGeneratorGUI -CSVFile 'C:\computers.csv' -Verbose
Example CSV file
computer,username,password
host-01,user1,pwd1
host-02,user2,pwd2
Invoke-PuppetGenerator Common Parameters
ComputerName
Array of computer names to query e.g.
[PS] > Invoke-PuppetGenerator -ComputerName 'host-01','host-02','host-03'-Verbose
[PS] > 'host-01','host-02','host-03' | Invoke-PuppetGenerator -Verbose
OutputPath
Folder where to output the results to. The default is the <module root>\output
[PS] > Invoke-PuppetGenerator -Output "$($ENV:UserProfile)\PMG\Output" -Verbose
Packaging Instructions
Note - Requires chocolatey (choco.exe) be in the search path
From a command prompt or Powershell console window run packaging\build.bat
This will create a chocolatey package in packaging\output