install.pp - HewlettPackard/puppet-ilorest-module GitHub Wiki
install.pp installs any required dependencies before anything else is done. This installs the python ilorest library through pip install as well as ensuring the examples to be run are present on the node.
if $osfamily == 'Debian' {
if $osfamily == 'RedHat' {
if $osfamily == 'windows' {
If Windows, we also need to ensure that Python is installed since Windows does not include Python out of the box.
package {'python':
ensure => installed,
source => 'https://www.python.org/ftp/python/2.7.12/python-2.7.12.msi',
provider => windows,
install_options => [{ 'ALLUSERS'=>'1' }, { 'IACCEPTSQLNCLILICENSETERMS' => 'YES' }, ],
}
We can utilize the package resource since 2.7.12 utilizes .msi and Puppet can manage it through the package resource. We specify that we want to ensure it to be installed, and provide it with a source. Provider lets Puppet know how the package should be installed. Lastly, we note the install_options so it can be run silently with need for user input.
file { '/etc/puppetlabs/code/environments/production/modules/ilorest/':
ensure => directory,
mode => '0755',
}
file { '/etc/puppetlabs/code/environments/production/modules/ilorest/files':
ensure => directory,
source => 'puppet:///modules/ilorest',
recurse => true,
require => File['/etc/puppetlabs/code/environments/production/modules/ilorest'],
}