From 5d9eaa15bab07f85078afa82b3cbc731c24954cd Mon Sep 17 00:00:00 2001 From: Nigel Gibbs Date: Tue, 13 Feb 2018 10:54:04 +0000 Subject: [PATCH] Allow override of packages to be installed - add `packages` parameter to allow the override of packages to be installed. For example, some packages in the list may need to be omitted if they are installed via another module in the catalog. - the default package list is set to ensure existing behaviour is preserved. --- README.md | 6 ++++++ manifests/init.pp | 7 ++++--- manifests/mount.pp | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index aecf43d..859df31 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,12 @@ actually attach & mount a volume you have to use the defined type * Type: `String` * Default: `'/etc/systemd/system'` +##### `packages` + +* list of packages to install +* Type: `Array` +* Default: `[ 'curl', 'gawk', 'util-linux', 'awscli', 'xfsprogs' ]` + #### Examples ##### Declaring the base class diff --git a/manifests/init.pp b/manifests/init.pp index b57106f..28efc1b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -13,8 +13,9 @@ # @param bin_dir path to the binary directory for helper scripts # @param systemd_dir path to the directory where systemd units should be placed class aws_ebs( - String $systemd_dir = '/etc/systemd/system', - String $bin_dir = '/opt/bin', + String $systemd_dir = '/etc/systemd/system', + String $bin_dir = '/opt/bin', + Array[String] $packages = ['curl', 'gawk', 'util-linux', 'awscli', 'xfsprogs'], ){ $path = defined('$::path') ? { @@ -27,7 +28,7 @@ mode => '0755', }) - ensure_resource('package', ['curl', 'gawk', 'util-linux', 'awscli', 'xfsprogs'],{ + ensure_resource('package', $packages,{ ensure => present }) diff --git a/manifests/mount.pp b/manifests/mount.pp index eb1cf6c..3f082d4 100644 --- a/manifests/mount.pp +++ b/manifests/mount.pp @@ -63,6 +63,7 @@ notify => Exec[$systemd_reload], } ~> service { $mount_service_name: ensure => running, + enable => true, require => Exec[$systemd_reload], } }