One-shot shell script that can be used to install puppet-agent on a supported POSIX platform.
This repository contains a Ruby script (install.rb), which when executed will
generate an install.sh file to be used for installing puppet-agent on
supported FOSS POSIX platforms.
The script leverages Bolt tasks from the puppet_agent and facts modules, and attempts to change as few things as possible in order to create a working shell script which can be used with little to no external dependencies
- A non-Windows platform for which Puppet provides official packages (see the full list here)
- One of wget/curl/fetch/perl-LWP-Simple in order to download packages
bash(probably at least version 3)- Ability to run the script as
root
curl -sSL https://raw.githubusercontent.com/puppetlabs/install-puppet/main/install.sh | bashwget -qO - https://raw.githubusercontent.com/puppetlabs/install-puppet/main/install.sh | bashPiping to bash is a controversial practice, so you are encouraged to inspect
the contents of the
script
before executing it.
To pass flags via the curl-pipe pattern:
curl -sSL https://raw.githubusercontent.com/puppetlabs/install-puppet/main/install.sh | bash -s -- -v 6.24.0Below is the full list of configurable options:
-v/--version- install a specific puppet-agent version-c/--collection- install a specific puppet-agent collection (e.g. puppet7)-u/--username- username for Puppet Core package downloads, paired with --password; defaults toforge-key-p/--password- Forge API key or PE License ID, paired with --username-n/--noop- do a dry run, do not change any files--cleanup- remove the puppetlabs repository after installation finishes
Puppet 8.11.0 and later are distributed as Puppet Core, under puppetcore*
collections (e.g. puppetcore9), and require a Forge API key. The
puppet/puppet7/puppet8 collections are still free, but are frozen at
their last pre-Core release (puppet8 stopped at 8.10) - any 8.11+ release
only ships via puppetcore8.
To get a Forge API key:
- Log in at forge.puppet.com.
- Accept the Puppet Core EULA: profile menu → Puppet → Puppet Core EULA.
- Enable MFA: profile → Settings → "Use Multifactor Authentication" (required before you can create a key).
- Profile → API Keys → Create a new key, and copy it immediately - Forge only displays it once.
./install.sh -v 9.0.0 -c puppetcore9 -u forge-key -p <FORGE_KEY>Using PE License ID: You must use
forge-keyto download Puppet Core packages fromyum-puppetcore.puppet.comorapt-puppetcore.puppet.com. However, eitherforge-keyorlicense-id(associated with Puppet Enterprise) can be used to download artifacts fromartifacts-puppetcore.puppet.comand Ruby gems fromrubygems-puppetcore.puppet.com../install.sh -v 9.0.0 -c puppetcore9 -u license-id -p "$LICENSE_ID"
The Ruby script uses parts of the bash.sh task from the
facts module, and the
install_shell.sh task from the
puppet_agent module
to generate the install.sh file. The modules are vendored as git submodules;
in order to initialize them, run git submodule update --init after cloning
this repository.
After making your changes, run the following command to regenerate the shell script:
ruby install.rbYou can also run shellcheck on the resulting script, it will skip the vendored task parts and only warn on code specific to this repository.
shellcheck install.shThis project is licensed under the Apache 2.0 License - see the LICENSE file for details