feat: change packages to Hash
- change from multiple arrays for managing packages to a hash - change to ensure_packages to prevent duplicate resource conflicts
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
# profiles::firstrun::packages
|
||||
class profiles::firstrun::packages {
|
||||
class profiles::firstrun::packages (
|
||||
Hash $manage = lookup('profiles::packages::include'),
|
||||
) {
|
||||
# include the correct package repositories, define the install_packages exec
|
||||
case $facts['os']['family'] {
|
||||
'RedHat': {
|
||||
@@ -15,8 +17,13 @@ class profiles::firstrun::packages {
|
||||
}
|
||||
}
|
||||
|
||||
# filter out packages with 'ensure' set to 'absent'
|
||||
$packages_to_install = $manage.filter |$package, $options| {
|
||||
!($options['ensure'] and $options['ensure'] == 'absent')
|
||||
}
|
||||
|
||||
# get all the packages to install, and convert into a space separated list
|
||||
$packages = hiera_array('profiles::packages::install', [])
|
||||
$packages = $packages_to_install.keys
|
||||
$package_list = $packages.join(' ')
|
||||
|
||||
# install all the packages
|
||||
|
||||
Reference in New Issue
Block a user