feat: add/remove capabilities for packages
- add deepmerge lookup_options - add packages to remove and packages to add to profiles::packages::base class
This commit is contained in:
parent
a0d1623286
commit
8f04de2b52
@ -1,4 +1,12 @@
|
||||
---
|
||||
lookup_options:
|
||||
profiles::packages::base::add:
|
||||
merge:
|
||||
strategy: deep
|
||||
profiles::packages::base::remove:
|
||||
merge:
|
||||
strategy: deep
|
||||
|
||||
profiles::ntp::client::ntp_role: 'roles::infra::ntp::server'
|
||||
profiles::ntp::client::peers:
|
||||
- 0.pool.ntp.org
|
||||
@ -12,23 +20,54 @@ profiles::base::puppet_servers:
|
||||
profiles::dns::master::basedir: '/var/named/sources'
|
||||
profiles::dns::base::ns_role: 'roles::infra::dns::resolver'
|
||||
|
||||
profiles::packages::base:
|
||||
profiles::packages::base::add:
|
||||
- bash-completion
|
||||
- bzip2
|
||||
- ccze
|
||||
- curl
|
||||
- dstat
|
||||
- gzip
|
||||
- htop
|
||||
- inotify-tools
|
||||
- iotop
|
||||
- jq
|
||||
- lz4
|
||||
- lzo
|
||||
- mtr
|
||||
- ncdu
|
||||
- neovim
|
||||
- p7zip
|
||||
- pbzip2
|
||||
- pigz
|
||||
- pv
|
||||
- rsync
|
||||
- screen
|
||||
- strace
|
||||
- sysstat
|
||||
- tmux
|
||||
- traceroute
|
||||
- vim
|
||||
- vnstat
|
||||
- wget
|
||||
- xz
|
||||
- zsh
|
||||
- zstd
|
||||
|
||||
profiles::packages::base::remove:
|
||||
- iwl100-firmware
|
||||
- iwl1000-firmware
|
||||
- iwl105-firmware
|
||||
- iwl135-firmware
|
||||
- iwl2000-firmware
|
||||
- iwl2030-firmware
|
||||
- iwl3160-firmware
|
||||
- iwl5000-firmware
|
||||
- iwl5150-firmware
|
||||
- iwl6000-firmware
|
||||
- iwl6000g2a-firmware
|
||||
- iwl6050-firmware
|
||||
- iwl7260-firmware
|
||||
- puppet7-release
|
||||
|
||||
profiles::base::scripts::scripts:
|
||||
puppet: puppetwrapper.py
|
||||
|
||||
@ -1,21 +1,21 @@
|
||||
# This class manages the installation of packages for the base profile
|
||||
#
|
||||
# Parameters:
|
||||
# - $packages: An array of package names to be installed (optional)
|
||||
# - $ensure: Enum of present, absent, latest or installed (optional)
|
||||
#
|
||||
# Example usage:
|
||||
# class { 'profiles::base::packages':
|
||||
# packages => ['package1', 'package2', 'package3'],
|
||||
# - $add: An array of package names to be installed
|
||||
# - $remove: An array of package names to be removed
|
||||
#
|
||||
class profiles::packages::base (
|
||||
Array $packages = lookup('profiles::packages::base', Array, 'first', []),
|
||||
Enum[
|
||||
'present',
|
||||
'absent',
|
||||
'latest',
|
||||
'installed'
|
||||
] $ensure = 'installed',
|
||||
){
|
||||
ensure_packages($packages, {'ensure' => $ensure})
|
||||
Array $add = [],
|
||||
Array $remove = [],
|
||||
) {
|
||||
|
||||
# Ensure packages to add are installed
|
||||
ensure_packages($add, {'ensure' => 'present'})
|
||||
|
||||
# Ensure packages to remove are absent
|
||||
$remove.each |String $package| {
|
||||
package { $package:
|
||||
ensure => 'absent',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user