install.pp - HewlettPackard/puppet-ilorest-module GitHub Wiki

install.pp

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' {
The $osfamily fact is used as a conditional to determine what file structure will have to be used. This is automatically obtained by puppet.

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'],
        }
File directories are created and files copied over, then managed by the master server to ensure that each node will have the required files. Note that the folder containing ilorest must already exist. Since Puppet is installed, this folder should already exist. If not, the directory path must be adjusted or the directory created.
⚠️ **GitHub.com Fallback** ⚠️