4 changes: 2 additions & 2 deletions .github/workflows/task_acceptance_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
name: On ${{ matrix.os }}
strategy:
matrix:
os: [ 'centos-7', 'ubuntu-18.04' ]
os: [ 'centos-7', 'ubuntu-18.04', 'rocky-8' ]

env:
ruby_version: 2.5
ruby_version: 2.5.9
GEM_BOLT: true
BEAKER_debug: true
BEAKER_set: docker/${{ matrix.os }}
Expand Down
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,34 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [4.9.0] - 2021-09-09

### Summary
Add Debian 11 support. Add Rocky Linux support for the `install` task. Allow `present` and `latest` as `package_version`. Other fixes and improvements.

### Features

- ([MODULES-11085](https://tickets.puppetlabs.com/browse/MODULES-11085)) Add Fedora 34 support to module ([#564](https://github.com/puppetlabs/puppetlabs-puppet_agent/pull/564))
- Update GPG-KEY-puppet ([#579](https://github.com/puppetlabs/puppetlabs-puppet_agent/pull/579))
- Allow stdlib 8.0.0 ([#576](https://github.com/puppetlabs/puppetlabs-puppet_agent/pull/576))
- ([MODULES-11060](https://tickets.puppetlabs.com/browse/MODULES-11060)) Add Debian 11 to puppet_agent module ([#575](https://github.com/puppetlabs/puppetlabs-puppet_agent/pull/575))
- ([MODULES-11148](https://tickets.puppetlabs.com/browse/MODULES-11148)) Document Windows long paths support ([#573](https://github.com/puppetlabs/puppetlabs-puppet_agent/pull/573))
- Update readme for clarification on Windows agent updates ([#502](https://github.com/puppetlabs/puppetlabs-puppet_agent/pull/502))
- ([MODULES-11113](https://tickets.puppetlabs.com/browse/MODULES-11113)) Allow present and latest as package version ([#565](https://github.com/puppetlabs/puppetlabs-puppet_agent/pull/565))
- ([MODULES-11135](https://tickets.puppetlabs.com/browse/MODULES-11135)) Add Rocky as EL platform in task install_shell.sh ([#571](https://github.com/puppetlabs/puppetlabs-puppet_agent/pull/571))
- ([MODULES-11078](https://tickets.puppetlabs.com/browse/MODULES-11078)) Bump Bolt to 3.x ([#566](https://github.com/puppetlabs/puppetlabs-puppet_agent/pull/566))
- ([MODULES-11112](https://tickets.puppetlabs.com/browse/MODULES-11112)) Add parameter puppet_agent::proxy ([#567](https://github.com/puppetlabs/puppetlabs-puppet_agent/pull/567))


### Bug fixes

- ([MODULES-11123](https://tickets.puppetlabs.com/browse/MODULES-11123)) Avoid loading puppet facts in `install/windows.pp` ([#577](https://github.com/puppetlabs/puppetlabs-puppet_agent/pull/577))
- ([MODULES-11077](https://tickets.puppetlabs.com/browse/MODULES-11077)) Allow all settings to be managed ([#569](https://github.com/puppetlabs/puppetlabs-puppet_agent/pull/569))

### Acknowledgements

Thanks to [smortex](https://github.com/smortex), [murdok5](https://github.com/murdok5), [relearnshuffle](https://github.com/relearnshuffle), [Guillaume001](https://github.com/Guillaume001) and [chrekh](https://github.com/chrekh) who have contributed to this release 🎉!

## [4.8.0] - 2021-06-22

### Summary
Expand Down
8 changes: 4 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ group :development do
gem "rake", '~> 12', require: false
gem "parallel_tests", '>= 2.14.1', '< 2.14.3', require: false
gem "metadata-json-lint", '>= 2.0.2', '< 3.0.0', require: false
gem "rspec-puppet-facts", '~> 1.10.0', require: false
gem "rspec-puppet-facts", '~> 2.0.1', require: false
gem "rspec_junit_formatter", '~> 0.2', require: false
gem "rubocop", '~> 0.49.0', require: false
gem "rubocop-rspec", '~> 1.16.0', require: false
gem "rubocop-i18n", '~> 1.2.0', require: false
gem "puppetlabs_spec_helper", '>= 2.9.0', '< 3.0.0', require: false
gem "puppet-module-posix-default-r#{minor_version}", require: false, platforms: "ruby"
gem "puppet-module-win-default-r#{minor_version}", require: false, platforms: ["mswin", "mingw", "x64_mingw"]
gem "rspec-puppet", require: true, git: "https://github.com/rodjek/rspec-puppet", tag: "v2.7.9"
gem "rspec-puppet", require: true
gem 'rspec-expectations', '~> 3.9.0', require: false
gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0')
Expand All @@ -71,8 +71,8 @@ group :system_tests do
gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 0.1')
# Bundler fails on 2.1.9 even though this group is excluded
if ENV['GEM_BOLT']
gem 'bolt', '~> 1.15', require: false
gem 'beaker-task_helper', '~> 1.5.2', require: false
gem 'bolt', '~> 3.0', require: false
gem 'beaker-task_helper', '~> 1.9', require: false
end
end

Expand Down
40 changes: 35 additions & 5 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
- [`use_alternate_sources`](#use_alternate_sources)
- [`alternate_pe_source`](#alternate_pe_source)
- [`install_dir`](#install_dir)
- [`disable_proxy`](#disable_proxy)
- [`proxy`](#proxy)
- [`install_options`](#install_options)
- [`msi_move_locked_files`](#msi_move_locked_files)
- [`wait_for_pxp_agent_exit`](#wait_for_pxp_agent_exit)
Expand Down Expand Up @@ -70,7 +72,7 @@ Previous releases of this module, now unsupported, upgraded agents from later ve

The puppet_agent module installs the appropriate official Puppet package repository (on systems that support repositories); migrates configuration required by Puppet to new locations used by puppet-agent; and installs the puppet-agent package, removing the previous Puppet installation.

If a package_version parameter is provided, it will ensure that puppet-agent version is installed. The package_version parameter is required to perform upgrades starting from a puppet-agent package, also this parameter can be set to "auto", ensuring that agent version matches the version on the master without having to manually update package_version after upgrading the master(s).
If a package_version parameter is provided, it will ensure that puppet-agent version is installed. The package_version parameter is required to perform upgrades starting from a puppet-agent package, also this parameter can be set to "auto", ensuring that agent version matches the version on the master without having to manually update package_version after upgrading the master(s). On platforms that install packages through repos (EL, Fedora, Debian, Ubuntu, SLES), the parameter can be set to "latest" in order to install the latest available package. To only ensure the presence of the package, the parameter can be set to "present".

If a config parameter is provided, it will manage the defined agent configuration settings.

Expand Down Expand Up @@ -189,6 +191,14 @@ or
``` puppet
package_version => 'auto'
```
or
``` puppet
package_version => 'latest'
```
or
``` puppet
package_version => 'present'
```

##### `service_names`

Expand Down Expand Up @@ -287,13 +297,32 @@ The directory the puppet agent should be installed to. This is only applicable f
install_dir => 'D:\Program Files\Puppet Labs'
```

##### `disable_proxy`

This setting controls whether or not the Puppet repositories are configured with proxies. Currently this is only supported on RedHat-based OSes.
``` puppet
disable_proxy => true
```

##### `proxy`

This setting specifies the proxy with which to configure the Puppet repos. Currently this is only supported on RedHat-based OSes.
``` puppet
proxy => 'http://myrepo-proxy.example.com'
```

##### `install_options`

An array of additional options to pass when installing puppet-agent. Each option in the array can be either a string or a hash. Each option is automatically quoted when passed to the install command.

With Windows packages, note that file paths in `install_options` must use backslashes. (Since install options are passed directly to the installation command, forward slashes aren't automatically converted like they are in `file` resources.) Backslashes in double-quoted strings _must_ be escaped, while backslashes in single-quoted strings _can_ be escaped. The default value for Windows packages is `REINSTALLMODE="amus"`.

The full list of supported MSI properties can be found [here](https://puppet.com/docs/puppet/latest/install_agents.html#msi_properties).

The Puppet installer can disable the [Windows path length limit](https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation) (260 character `MAX_PATH` limitation, requires Windows 10 1607 or later). This behavior is opt-in and can be controlled by the presence of the `ENABLE_LONG_PATHS` install option (the value does not matter). (*requires Puppet >= 6.25.0/7.10.0*)

``` puppet
install_options => ['PUPPET_AGENT_ACCOUNT_DOMAIN=ExampleCorp','PUPPET_AGENT_ACCOUNT_USER=bob','PUPPET_AGENT_ACCOUNT_PASSWORD=password']
install_options => ['PUPPET_AGENT_ACCOUNT_DOMAIN=ExampleCorp', 'PUPPET_AGENT_ACCOUNT_USER=bob', 'PUPPET_AGENT_ACCOUNT_PASSWORD=password', 'ENABLE_LONG_PATHS=true']
```

##### `msi_move_locked_files`
Expand Down Expand Up @@ -380,7 +409,8 @@ The `puppet_agent::version` task returns a Result on success specifying the vers

#### `puppet_agent::install`

Installs the puppet-agent package. This task should not be used for upgrading agents particularly windows agents which have requirements other than just installing the puppet-agent msi.
Installs the puppet-agent package. This task should not be used for upgrading agents particularly Windows agents which have requirements other than just installing the puppet-agent msi.
For upgrading Windows agents please use the `puppet_agent` class through your standard Puppet deployment or via [Bolt with Puppet apply](https://puppet.com/docs/bolt/latest/applying_manifest_blocks.html).

> **Note:** The `puppet_agent::install_shell` task requires the `facts::bash` implementation from the [facts](https://forge.puppet.com/puppetlabs/facts) module. Both the `puppet_agent` and `facts` modules are packaged with Bolt. For use outside of Bolt make sure the `facts` module is installed to the same `modules` directory as `puppet_agent`.
Expand All @@ -391,11 +421,11 @@ The task returns the output of the installation script.

#### `puppet_agent::facts_diff`

Executes `puppet facts diff` action to check if there are differences between Facter 3 and Facter 4 outputs.(*requires Puppet >= 6.21.0*)
Executes `puppet facts diff` action to check if there are differences between Facter 3 and Facter 4 outputs. (*requires Puppet >= 6.21.0*)

**Parameters**

- `exclude`: Regex used to exclude specific facts from diff.(*requires Puppet >= 6.22.0*)
- `exclude`: Regex used to exclude specific facts from diff. (*requires Puppet >= 6.22.0*)

**Return value**

Expand Down
8 changes: 7 additions & 1 deletion acceptance/tests/test_upgrade_puppet5_to_puppet6.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@
step "Create new site.pp with upgrade manifest" do
manifest = <<-PP
node default {
if $::osfamily =~ /^(?i:windows|solaris|aix|darwin)$/ {
$_package_version = '#{latest_version}'
} else {
$_package_version = 'latest'
}
class { puppet_agent:
package_version => '#{latest_version}',
package_version => $_package_version,
apt_source => 'http://nightlies.puppet.com/apt',
yum_source => 'http://nightlies.puppet.com/yum',
windows_source => 'http://nightlies.puppet.com/downloads',
Expand Down
8 changes: 7 additions & 1 deletion acceptance/tests/test_upgrade_puppet6_to_puppet7.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@
step "Create new site.pp with upgrade manifest" do
manifest = <<-PP
node default {
if $::osfamily =~ /^(?i:windows|solaris|aix|darwin)$/ {
$_package_version = '#{latest_version}'
} else {
$_package_version = 'latest'
}
class { puppet_agent:
package_version => '#{latest_version}',
package_version => $_package_version,
apt_source => 'http://nightlies.puppet.com/apt',
yum_source => 'http://nightlies.puppet.com/yum',
windows_source => 'http://nightlies.puppet.com/downloads',
Expand Down
1 change: 1 addition & 0 deletions docker/bin/upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# supports comma-separated lists. Available:
# - `ubuntu`
# - `centos`
# - `rocky`
# Default: `ubuntu`
# - BEFORE: The puppet-agent package version that is installed prior to upgrade.
# Default: 1.10.14
Expand Down
3 changes: 2 additions & 1 deletion docker/bin/versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
# - PLATFORM: The platform on which the upgrade should occur. Available:
# - `ubuntu`
# - `centos`
# - `rocky`
# Default: `ubuntu`
set -e

platform=${1:-ubuntu}

case "${platform}" in
ubuntu|centos)
ubuntu|centos|rocky)
;;
*) echo "Invalid platform: '${platform}'. Must be 'ubuntu' or 'centos'"
exit 1
Expand Down
103 changes: 103 additions & 0 deletions docker/rocky/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# This Dockerfile enables an iterative development workflow where you can make
# a change and test it out quickly. The majority of commands in this file will
# be cached, making the feedback loop typically quite short. The workflow is
# as follows:
# 1. Set up pre-conditions for the system in puppet code using `deploy.pp`.
# 2. Make a change to the module.
# 3. Run `docker build -f docker/Dockerfile .` or
# `./docker/bin/upgrade.sh rocky` from the project directory. If you would
# like to test specific version upgrades, you can add run this like so:
# `docker build -f docker/rocky/Dockerfile . \
# -t pa-dev:rocky --build-arg before=1.10.14`
# 4. Upgrade the container by running the image:
# `docker run -it pa-dev:rocky`
# Specify your upgrade TO version as an argument to the `docker run`
# command.
# 5. Review the output. Repeat steps 2-5 as needed.
#
# At the end of execution, you will see a line like:
#
# Notice: /Stage[main]/Puppet_agent::Install/Package[puppet-agent]/ensure: ensure changed '1.10.14-1.el8' to '6.2.0'
#
# This specifies the versions that were used for upgrade.
#
# Arguments:
# - before: The version to do upgrade FROM. Default: "1.10.14"

FROM rockylinux/rockylinux:8

# Use this to force a cache reset (e.g. for output purposes)
#COPY $0 /tmp/Dockerfile

# Install some other dependencies for ease of life.
RUN dnf update -y \
&& dnf install -y wget git \
&& dnf clean all

ARG before=1.10.14
LABEL before=${before}

# Install proper FROM repo: puppet 6 or puppet 7.
RUN if [[ ${before} == 6.* ]]; then \
echo Installing puppet6 repo; \
wget -O puppet6.rpm http://yum.puppet.com/puppet6-release-el-8.noarch.rpm && \
rpm -i puppet6.rpm; \
elif [[ ${before} == 7.* ]]; then \
echo Installing puppet7 repo; \
wget -O puppet7.rpm http://yum.puppet.com/puppet7-release-el-8.noarch.rpm && \
rpm -i puppet7.rpm; \
else echo no; \
fi

# Print out which versions of the puppet-agent package are available (for reference).
#RUN dnf list puppet-agent --showduplicates

# Install FROM version of puppet-agent.
RUN dnf -y update && \
dnf install -y puppet-agent-${before}-1.el8

# This is also duplicated in the docker/bin/helpers/run-upgrade.sh.
ENV module_path=/tmp/modules
WORKDIR "${module_path}/puppet_agent"
COPY metadata.json ./

# Dependency installation: Forge or source? The former is what the user will
# have downloaded, but the latter allows testing of version bumps.
# Install module dependencies from the Forge using Puppet Module Tool (PMT).
RUN /opt/puppetlabs/puppet/bin/puppet module install --modulepath $module_path --target-dir .. puppetlabs-stdlib
RUN /opt/puppetlabs/puppet/bin/puppet module install --modulepath $module_path --target-dir .. puppetlabs-inifile
RUN /opt/puppetlabs/puppet/bin/puppet module install --modulepath $module_path --target-dir .. puppetlabs-apt

# Installing dependencies from source. These versions should be within the range
# of `dependencies` in metadata.json. `translate` is a dependency for inifile.
#RUN git clone https://github.com/puppetlabs/puppetlabs-stdlib ../stdlib --branch 5.2.0
#RUN git clone https://github.com/puppetlabs/puppetlabs-inifile ../inifile --branch 2.5.0
#RUN git clone https://github.com/puppetlabs/puppetlabs-translate ../translate --branch 1.2.0
#RUN git clone https://github.com/puppetlabs/puppetlabs-apt ../apt --branch 6.3.0

# Check that all dependencies are installed.
RUN /opt/puppetlabs/puppet/bin/puppet module --modulepath $module_path list --tree
COPY docker/deploy.pp /tmp/deploy.pp
RUN ["sh", "-c", "/opt/puppetlabs/puppet/bin/puppet apply --modulepath $module_path /tmp/deploy.pp"]

# Now move the project directory's files into the image. That way, if these
# files change, caching will skip everything before this.
COPY docker/bin/helpers/run-upgrade.sh /tmp/bin/run-upgrade.sh
COPY files/ ./files/
COPY locales/ ./locales/
COPY spec/ ./spec/
COPY task_spec/ ./task_spec/
COPY tasks/ ./tasks/
COPY templates/ ./templates
COPY types/ ./types/
COPY Gemfile Gemfile.lock Rakefile ./
COPY lib/ ./lib/
COPY manifests/ ./manifests/

COPY docker/upgrade.pp /tmp/upgrade.pp

# Print out which versions of the puppet-agent package are available (for reference).
#RUN yum list puppet-agent --showduplicates

# Perform the upgrade.
ENTRYPOINT ["/tmp/bin/run-upgrade.sh"]
16 changes: 16 additions & 0 deletions docker/rocky/Dockerfile.versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM rockylinux/rockylinux:8

# Install some other dependencies for ease of life.
RUN dnf update -y \
&& dnf install -y wget git \
&& dnf clean all

# Install several repos: puppet 6, and puppet7.
RUN wget -O puppet6.rpm http://yum.puppet.com/puppet6-release-el-8.noarch.rpm && \
rpm -i puppet6.rpm --force --replacefiles --nodeps && \
wget -O puppet7.rpm http://yum.puppet.com/puppet7-release-el-8.noarch.rpm && \
rpm -i puppet7.rpm --force --replacefiles --nodeps

# Print out available package versions for puppet-agent. If a specific version
# is desired, pass that in with e.g. `--build-arg before=1.1.1`
ENTRYPOINT ["dnf", "list", "puppet-agent", "--showduplicates"]
Loading