Forge Home

pe_install_ps1

Creates a pe_install.ps1 script to automate puppet-agent installations in Puppet Entererprise

17,147 downloads

8,357 latest version

4.3 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Support the Puppet Community by contributing to this module

You are welcome to contribute to this module by suggesting new features, currency updates, or fixes. Every contribution is valuable to help ensure that the module remains compatible with the latest Puppet versions and continues to meet community needs. Complete the following steps:

  1. Review the module’s contribution guidelines and any licenses. Ensure that your planned contribution aligns with the author’s standards and any legal requirements.
  2. Fork the repository on GitHub, make changes on a branch of your fork, and submit a pull request. The pull request must clearly document your proposed change.

For questions about updating the module, contact the module’s author.

Version information

  • 1.0.1 (latest)
  • 1.0.0
  • 0.2.5
  • 0.2.4
  • 0.2.3
  • 0.2.2
  • 0.2.1
  • 0.2.0
  • 0.1.0
released Mar 8th 2017
This version is compatible with:
  • Puppet Enterprise >= 2015.2.1 < 2016.1.0
  • Puppet >= 4.0.0 < 5.0.0
  • , , , , ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'natemccurdy-pe_install_ps1', '1.0.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add natemccurdy-pe_install_ps1
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install natemccurdy-pe_install_ps1 --version 1.0.1

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

natemccurdy/pe_install_ps1 — version 1.0.1 Mar 8th 2017

Puppet Forge Build Status

DEPRECATION NOTICE: Puppet Enterprise 2016.3.x now has a Powershell Windows installer built-in. If using 2016.3.x or higher, don't use this module; use the built-in installer instead. More info here: https://docs.puppet.com/pe/latest/install_windows.html#installing-with-pe-package-management

Table of Contents

  1. Overview
  2. Setup - Important!
  3. Usage
  1. Reference
  2. Limitations
  3. Development

Overview

This module will create a PowerShell script, pe_install.ps1, that Windows nodes can remotely execute to emulate the frictionless puppet-agent installer that was made for Linux nodes.

Setup

Step 1: Add the Windows pe_repo platform to your Puppet Masters

This module only creates a pe_install.ps1 script. Use the pe_repo module that comes with Puppet Enterprise to stage the MSI puppet-agent installer before trying to use the pe_install.ps1 script.

In the Enterprise Console, add the pe_repo::platform::windows_x86_64 class to the PE Master node group.

Step 2: Download this module and classify your Puppet Masters with pe_install_ps1

Either download this module with puppet module install natemccurdy-pe_install_ps1 or add it to your Puppetfile and deploy r10k/code_manager.

Then, add the pe_install_ps1 class to your Puppet Masters and trigger a puppet agent run:

include ::pe_install_ps1

Usage

Windows Agent Install Process

To emulate the frictionless installer for Linux (curl -k https://puppet:8140/packages/current/install.bash | bash) and remotely run the pe_install.ps1 script, you can use PowerShell's WebClient library with server validation disabled. Below are two ways you can do that depending on how you manage your Windows nodes.

Copy and paste these one-liner commands into an administrative CMD or PowerShell window.

NOTE: By default, all output is hidden so that the script can run via WinRM if necessary. To see the installation progress, add -verbose to the end of the install-agent.ps1 command.

Administrative CMD window

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "[Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}; $webClient = New-Object System.Net.WebClient; $webClient.DownloadFile('https://puppet.company.net:8140/packages/current/pe_install.ps1', \"$env:temp\install-agent.ps1\"); & \"$env:temp\install-agent.ps1\""

Administrative PowerShell window

Use this method for WinRM as well

[Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}; $webClient = New-Object System.Net.WebClient; $webClient.DownloadFile("https://puppet.company.net:8140/packages/current/pe_install.ps1", "$env:temp\install-agent.ps1"); & "$env:temp\install-agent.ps1"

Note: You must have your execution policy set to unrestricted (or at least in bypass) for this to work (Set-ExecutionPolicy Unrestricted).

Formatted Commands

Here's what the commands look like when separated onto individual lines.

[Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
$webClient = New-Object System.Net.WebClient
$webClient.DownloadFile("https://puppet.company.net:8140/packages/current/pe_install.ps1", "$env:temp\install-agent.ps1")
& "$env:temp\install-agent.ps1" -verbose

Adjusting the Puppet agent's settings during installation

The values for server and certname, in the agent's puppet.conf can be tuned during installation by passing the server and certname parameters to the pe_install.ps1 script.

Here's the table of MSI Properties that can adjusted with arguments to the ps1 script:

MSI Property ps1 Argument
PUPPET_MASTER_SERVER server
PUPPET_AGENT_CERTNAME certname
$webClient = New-Object System.Net.WebClient
$webClient.DownloadFile("https://puppet.company.net:8140/packages/current/pe_install.ps1", "$env:temp\install-agent.ps1")
& "$env:temp\install-agent.ps1" -certname win-db001.custom.net -server alternate-puppet-master.custom.net

Turning on Debuging Mode

There are two approaches for turning on debugging for the ps1 script.

Method 1: In the script file

In the ps1 script, remove the comment marker #, changing the line

#$DebugPreference = 'Continue'

to

$DebugPreference = 'Continue'
Method 2: In the shell

Execute the following at the shell prompt:

$DebugPreference = 'Continue'

Note: This will enable debugging on all scripts run from this shell. To return to the default behavior, execute:

$DebugPreference = 'ContinueSilently'

Customizing the pe_install.ps1 script

If using load-balanced compile masters, change the server_setting parameter to that of your load-balancer or VIP's name.

class { 'pe_install_ps1':
  server_setting => '<FQDN_OF_YOUR_LOAD_BALANCER>',
}

Here's an example of changing other parameters:

class { 'pe_install_ps1':
  msi_host        => 'puppet.company.net',
  server_setting  => 'puppet.company.net',
}

Reference

Class: pe_install_ps1

server_setting

The value that will go in the server setting in the agent's puppet.conf.

Default value: $::settings::server

msi_host

The FQDN of the puppet server that is hosting the puppet-agent MSI installer.

Default value: $::settings::server

public_dir

The path to the public package share on the Puppet Master.

Default value: /opt/puppetlabs/server/data/packages/public

Limitations

So far, this only works for Puppet Enterprise 2015.2.1 or higher, and only for x86_64 puppet-agent packages.

The pe_repo module only supports staging the Windows Puppet Agent MSI since Puppet Enterprise 2015.2.1, so at least that version is required to get any use out of this module.

Development

Feel free to submit issues and PR's if there's something wrong or missing from this module.