Puppet and PowerCLI

Puppet (http://www.puppet.com) is a popular configuration management platform used to ensure that managed nodes are configured to the desired state. PowerCLI (https://www.vmware.com/support/developer/PowerCLI/) is a Windows based tool for interacting with VMware vSphere.

This post will cover installing VMware PowerCLI on a Windows Server 2012 machine utilizing Puppet.

# init.pp

class powercli {

  File['Deploy PowerCLI'] ~>
  Exec['Stop Internet Explorer'] ->
  Pakcage['VMware vSphere PowerCLI']

# Deploy the PowerCLI executable from the Puppet Master
  file { 'Deploy PowerCLI':
    ensure => present,
    path   => 'C:\Temp\PowerCLI.exe',
    source => 'puppet:///modules/powercli/PowerCLI.exe',

# Ensure that any instance of Internet Explorer is stopped
  exec { 'Stop Internet Explorer':
    command     => 'stop-process -name iexplore',
    refreshonly => true,
    provider    => powershell,

# Install PowerCLI
  package { 'VMware vSphere PowerCLI':
    ensure          => installed,
    source          => 'C:\Temp\PowerCLI.exe',
    install_options => ['/S','/V" /qn /L*v C:\PowerCLI.log REBOOT=ReallySuppress"'],

The module is composed of the main init.pp manifest which handles the installation and configuration as well as the actual PowerCLI executable in the files directory.

    ├── files
    │   └── PowerCLI.exe
    └── manifests
        └── init.pp
Subscribe to