At the start of the year, I decided to give my dotfiles a clean up. In this update, I made the decision to use a configuration management tool. Out of all the offerings I chose Puppet. As a Linux user it’s not often I need to set up Windows workstations, but for some tasks I have coming up a Windows workstation was the right tool for the job. So the job began on learning how to use Puppet on Windows, and this is how it went:

This last time I set up a Windows machine was nearly two years ago. Coming straight from Linux my first thought was where’s the package manager? This is how I found Chocolatey, back then it wasn’t quite APT. Now however combined with the “puppetlabs/chocolatey” module this is quite different.

The one issue I did encounter when installing the module was an SSL problem with the below message:

1
2
3
4
Error: Could not connect via HTTPS to https://forgeapi.puppetlabs.com
Unable to verify the SSL certificate
The certificate may not be signed by a valid CA
The CA bundle included with OpenSSL may not be valid or up to date

I found a simple fix was installing curl with Chocolatey. Once the Puppet module was installed, installing packages was no problem.

1
2
3
4
5
6
7
8
9
10
11
package { [
'cmder',
'git',
'make',
'openssh',
'rsync',
'vscode',
]:
ensure => installed,
provider => chocolatey,
}

One cool feature of Puppet is the paths. You dont need to use a \ as a directory separator. This is a blessing when needing to use double quotes for strings to avoid escaping hell. This was super handy when installing extensions for vscode

1
2
3
4
5
6
7
8
define vscode_plugin {
exec { "code_install_${title}":
path => 'C:/Program Files/Microsoft VS Code/bin',
command => "code.cmd --install-extension ${title}",
}
}

vscode_plugin { [ 'vscodevim.vim' ]: }