From 3523bdd8af9e32bdee7697209ee7cba775f273b1 Mon Sep 17 00:00:00 2001 From: Andrew Teixeira Date: Tue, 1 Dec 2020 09:30:11 -0500 Subject: [PATCH] Restructure package installation to make use of $package_ensure --- manifests/init.pp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index ba71b92..bdac987 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -25,6 +25,8 @@ # declaration # [*package_ensure*] # The ensure parameter to pass to the package resource +# [*package_name*] +# The name of the package(s) to be installed # # === Examples # @@ -73,16 +75,13 @@ notify => Exec['ca_cert_update'], } - if $install_package == true { - if $package_ensure in ['present', 'installed', 'latest'] { - ensure_packages([$package_name]) - Package[$package_name] -> Ca_cert::Ca <| |> + if $install_package { + package { 'ca-certificates': + ensure => $package_ensure, + name => $package_name, } - else { - package { 'ca-certificates': - ensure => $package_ensure, - name => $package_name, - } + if $package_ensure != 'absent' { + Package['ca-certificates'] -> Ca_cert::Ca <| |> } }