vendredi 25 septembre 2015

pass array to the puppet resource defined

I would like to test if multiple packages exist in my environment or not, based on this test I would like to generate the final catalog.

if !defined( Package[ 'apache2' ] ) {
    package { 'apache2':
        ensure  => installed,
    }
}
if !defined( Package[ 'libapache2-svn' ] ) {
    package { 'libapache2-svn':
        ensure  => installed,
    }
}

In future I would like to control in the following way:

Package { ensure => "installed" }
$packageList = [ 'apache2', 'libapache2-svn' ]

if !defined( Package[ $packageList ] ) {
    package { $packageList: }
}




Aucun commentaire:

Enregistrer un commentaire