Archive for the ‘Puppet’ Category

Puppet: Could not retrieve catalog from remote server

February 23rd, 2013 No comments

If running puppet agent you get the following error

[cce]err: Could not retrieve catalog from remote server: wrong status line: "<html>"[/cce]

Clean the certificate from the puppetmaster server

[cce]puppetca clean servername.domain[/cce]

and clear the following directory in the puppet client

[cce]rm -R /var/lib/puppet/ssl[/cce]

Running puppet agent agent will create again the certificate request to the puppet master.


Enjoy big_grin

Categories: Puppet Tags:

Puppet: conditional statements examples on templates

August 13th, 2012 No comments

Some conditional statements that you can use on puppet templates:

[cce]<% if @hostname == ("kvm01") then -%>
... ... ...
<% end -%>
<% if @hostname != ("kvm01") then -%>
... ... ...
<% end -%>[/cce]
[cce]<% if @hostname == ("goldrake01" or "goldrake02") then -%>
... ... ... 
<% end -%>[/cce]
Categories: Puppet Tags:

Puppet: package installation based on OS version

August 13th, 2012 No comments

If you want to handle a package installation based on the operating system version, you can use versioncmp function.

$result = versioncmp(a, b)

This functions returns a number:
* > 0 if version a is greater than version b
* == 0 if both version are equals
* < 0 if version a is less than version b


[cce_bash]  'Debian'     :  {       $ver = versioncmp($operatingsystemrelease,0)
            if $ver < 6.0 {
      package { 'nsca': ensure => present }
            } else {
      package { 'nsca': ensure => '2.7.2+nmu2' }