From ed572ac0cce489145805bd1785fb5aadc3d9ffd4 Mon Sep 17 00:00:00 2001 From: coreone Date: Tue, 1 Dec 2020 15:30:10 -0500 Subject: [PATCH] Restructure package installation to make use of $package_ensure (#63) --- 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 <| |> } }