Automatically deploy Puppet agent on VMWare Templates

robot

When you deploy a VMWare template, you have the option to create a customization specification.  You can add a command to this customization specification to automatically deploy the puppet agent, after the template has finished deploying.

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:

Downloading the Puppet Agent

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’)”

Installing the Puppet Agent

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 Puppet agent to run

Force a run of the puppet agent right now:

puppet agent -t

If you add the three above commands to the run once section of your customization template, your puppet agent should automatically install the first time someone logs into the server.