Automatically deploy Puppet agent on VMWare Templates

When you deploy a VMWare template, you have the option to create a customization specification. I recommend creating a customizaiton specification to be used when deploying your virtual machines.

One of the options in your customization specification is a run once command. Or really, it is a list of run once commands. There are three commands you should add to this section:

First, you want to download the puppet agent by using this command:
powershell “new-item C:\install -type directory; (new-object System.Net.WebClient).DownloadFile(‘https://downloads.puppetlabs.com/windows/puppet-agent-x64-latest.msi’,’C:\install\puppet-agent-x64-latest.msi’)”

Next you want to silently install the puppet agent with this command (Be sure to replace mypuppetserver.mydomain.com with your actual puppet server FQDN):

msiexec /qn /i C:\install\puppet-agent-x64-latest.msi PUPPET_MASTER_SERVER=“mypuppetserver.mydomain.com”

Force a run of the puppet agent right now:

puppet agent -t