21 September 2015

A puppet manifest with some challenging requirements to do the proper modification in hundreds of servers in one shot!

I needed to install SolarWinds Log and Event Manager in hundreds of Linux servers for my client.

But there were some obstacles to over come as it was not a normal software installation

I needed to adept my puppet manifest to declare all my specific requirements and of course make sure to run installation unattended. 

Requirements


So...the sweet requirements:

1. if the old LEM is installed, uninstall it

2. before uninstall the old version, stop the service

3. if directory couldn't delete, force delete it

4. download the installer file from the designed server and path

5. since it's unattended installation, download a defined response file as well

6. since the setup file is not able to take the response file with absolute path, execute the installer in a directory where response file has been downloaded

7. for some unknown reasons, installer was starting to execute before response file get downloaded, so I needed to make sure response file is a requirement for installer 

8. and finally, do all of these steps for all the servers except one!

Manifest

Based on all the 8 points above, I came up with the following puppet manifest: 


node default {
if $hostname != 'yumrepo01.example.com' {


exec { "stop_old_lem":
        command => "/etc/init.d/swlem-agent stop",
}

file { "/usr/local/contego/ContegoSPOP":
        ensure => "absent",
        force => "true",
        require => Exec['stop_old_lem'],
}

file {'/tmp/installer.properties':
ensure => present,
mode => '0644',
owner => 'root',
group => 'root',
source => 'puppet:///modules/download/installer.properties',
}

file {'/tmp/setup_soalrwinds_lem_64bit.bin':
ensure => present,
mode => '0755',
owner => 'root',
group => 'root',
source => 'puppet:///modules/download/setup_soalrwinds_lem_64bit.bin',
}

exec { "install_lem":
        cwd     => '/tmp',
        command => "/tmp/setup_soalrwinds_lem_64bit.bin -i silent",
        require => File['/tmp/installer.properties'],
}

}

}





No comments:

Post a Comment