Puppet: System Administration Automated

Support

Add some facts about Verio VPS

Hope it helps. For discussion you can join me at gadnet@aqueos.com

This adds facts and is compatible with vps v2 and v3, based on sinfo output

Adds on VPS v2

  • vpshostname
  • vpsip
  • vpsserver
  • vpstype
  • vpsaccount
  • vpsvid

Adds on VPS v3

  • vpsfamily (2,3)
#  Extention de facter (https://reductivelabs.com/projects/facter/index.html)
#  (c) AQUEOS under the GPL  http://www.aqueos.com
#  some facts to help manage VERIO VPS'es

#
#  Extention de facter par AQUEOS
#  (c) AQUEOS
#

require 'facter'
sinfopath = false

if FileTest.exists?("/usr/local/sbin/sinfo")
        sinfopath = "/usr/local/sbin/sinfo"
        Facter.add("vps") do
                setcode{ "verio" }
        end
elsif FileTest.exists?("/usr/local/bin/sinfo")
        sinfopath = "/usr/local/bin/sinfo"
        Facter.add("vps") do
                setcode{ "verio" }
        end
else
        Facter.add("vps") do
                setcode{ "non" }
        end
end

if sinfopath
        output = %x{#{sinfopath}}
        output.each {|s|
                retour = s.split(':')
                clef = retour[0]
                valeur = retour[1]
                Facter.add("vps#{clef}") do
                        confine :vps  => :verio
                        setcode { valeur.strip  }
                end
                if clef == 'type'
                        Facter.add("vpsfamily") do
                                confine :vps  => :verio
                                setcode { valeur.strip[-1,1] }
                        end
                end
        }
end

# fin