diff --git a/REFERENCE.md b/REFERENCE.md
index 2bb45339..31ce3f2b 100644
--- a/REFERENCE.md
+++ b/REFERENCE.md
@@ -61,6 +61,7 @@ The following parameters are available in the `letsencrypt` class:
* [`environment`](#environment)
* [`package_name`](#package_name)
* [`package_ensure`](#package_ensure)
+* [`dnfmodule_version`](#dnfmodule_version)
* [`package_command`](#package_command)
* [`config_file`](#config_file)
* [`config`](#config)
@@ -116,6 +117,14 @@ The value passed to `ensure` when installing the client with the `package` metho
Default value: `'installed'`
+##### `dnfmodule_version`
+
+Data type: `String`
+
+The yum module stream version to enable on EL8 and greater variants using the `package` method with the `dnfmodule` provider.
+
+Default value: `'python36'`
+
##### `package_command`
Data type: `String`
@@ -302,6 +311,7 @@ The following parameters are available in the `letsencrypt::install` class:
* [`configure_epel`](#configure_epel)
* [`package_ensure`](#package_ensure)
* [`package_name`](#package_name)
+* [`dnfmodule_version`](#dnfmodule_version)
##### `configure_epel`
@@ -327,6 +337,14 @@ Name of package to use when installing the client with the `package` method.
Default value: `$letsencrypt::package_name`
+##### `dnfmodule_version`
+
+Data type: `String`
+
+The yum module stream version to enable on EL8 and greater variants using the `package` method with the `dnfmodule` provider.
+
+Default value: `$letsencrypt::dnfmodule_version`
+
### `letsencrypt::plugin::dns_rfc2136`
This class installs and configures the Let's Encrypt dns-rfc2136 plugin.
diff --git a/manifests/init.pp b/manifests/init.pp
index 261e8f7f..29d6ea7c 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -16,6 +16,7 @@
# @param environment An optional array of environment variables
# @param package_name Name of package and command to use when installing the client with the `package` method.
# @param package_ensure The value passed to `ensure` when installing the client with the `package` method.
+# @param dnfmodule_version The yum module stream version to enable on EL8 and greater variants using the `package` method with the `dnfmodule` provider.
# @param package_command Path or name for letsencrypt executable when installing the client with the `package` method.
# @param config_file The path to the configuration file for the letsencrypt cli.
# @param config A hash representation of the letsencrypt configuration file.
@@ -57,6 +58,7 @@
Array $environment = [],
String $package_name = 'certbot',
$package_ensure = 'installed',
+ String $dnfmodule_version = 'python36',
String $package_command = 'certbot',
Stdlib::Unixpath $config_dir = '/etc/letsencrypt',
String $config_file = "${config_dir}/cli.ini",
diff --git a/manifests/install.pp b/manifests/install.pp
index c46f33c8..1ea843d0 100644
--- a/manifests/install.pp
+++ b/manifests/install.pp
@@ -3,12 +3,22 @@
# @param configure_epel A feature flag to include the 'epel' class and depend on it for package installation.
# @param package_ensure The value passed to `ensure` when installing the client with the `package` method.
# @param package_name Name of package to use when installing the client with the `package` method.
+# @param dnfmodule_version The yum module stream version to enable on EL8 and greater variants using the `package` method with the `dnfmodule` provider.
#
class letsencrypt::install (
Boolean $configure_epel = $letsencrypt::configure_epel,
String $package_name = $letsencrypt::package_name,
String $package_ensure = $letsencrypt::package_ensure,
+ String $dnfmodule_version = $letsencrypt::dnfmodule_version,
) {
+ if ($facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] >= '8') {
+ package { 'enable python module stream':
+ name => $dnfmodule_version,
+ enable_only => true,
+ provider => 'dnfmodule',
+ }
+ }
+
package { 'letsencrypt':
ensure => $package_ensure,
name => $package_name,
diff --git a/spec/classes/letsencrypt_install_spec.rb b/spec/classes/letsencrypt_install_spec.rb
index 75105856..0e89e421 100644
--- a/spec/classes/letsencrypt_install_spec.rb
+++ b/spec/classes/letsencrypt_install_spec.rb
@@ -7,7 +7,8 @@
{
configure_epel: false,
package_ensure: 'installed',
- package_name: 'letsencrypt'
+ package_name: 'letsencrypt',
+ dnfmodule_version: 'python36'
}
end
let(:additional_params) { {} }
@@ -42,6 +43,13 @@
is_expected.to contain_package('letsencrypt').that_requires('Class[epel]')
end
end
+
+ case facts[:operatingsystemmajrelease]
+ when '7'
+ it { is_expected.not_to contain_package('enable python module stream').with_name('python36') }
+ when '8'
+ it { is_expected.to contain_package('enable python module stream').with_name('python36').with_enable_only('true').with_provider('dnfmodule') }
+ end
end
end
end