Skip to content

Commit

Permalink
Restructure package installation to make use of $package_ensure (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
coreone authored Dec 1, 2020
1 parent 8f3fb6e commit ed572ac
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down Expand Up @@ -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 <| |>
}
}

Expand Down

0 comments on commit ed572ac

Please sign in to comment.