dev/provisioning/modules/puppi/manifests/init.pp
changeset 28 b0b56e0f8c7f
equal deleted inserted replaced
27:a2342f26c9de 28:b0b56e0f8c7f
       
     1 # = Class: puppi
       
     2 #
       
     3 # This is Puppi NextGen
       
     4 # Includes both first generation of Puppi and the
       
     5 # NextGen developments and modules integration
       
     6 #
       
     7 # == Parameters
       
     8 #
       
     9 # [*version*]
       
    10 #   Define the Puppi version to use:
       
    11 #   1 - First generation of Puppi, compatible with old modules
       
    12 #   2 - NextGen version. Intended to work with NextGen modules
       
    13 #   Default: 1 , for the moment
       
    14 #
       
    15 # [*install_dependencies*]
       
    16 #   Set to false if you want to manage the sofware puppi needs
       
    17 #   with your local modules.
       
    18 #
       
    19 # [*template*]
       
    20 #   Sets the path to a custom template for /etc/puppi/puppi.conf
       
    21 #
       
    22 # [*helpers_class*]
       
    23 #   Name of the class there default helpers are defined
       
    24 #   (Used on in Puppi 2)
       
    25 #
       
    26 # [*logs_retention_days*]
       
    27 #   Number of days for retenton of puppi logs. Default 30
       
    28 #   This option creates a script in /etc/cron.daily that purges
       
    29 #   all the old logs. Set to false or to 0 to remove the purge script.
       
    30 #
       
    31 # [*extra_class*]
       
    32 #   Name of the class where extra puppi resources are added
       
    33 #   Here, by default are placed general system commands for
       
    34 #   puppi info, check and log
       
    35 #
       
    36 class puppi (
       
    37   $version              = params_lookup( 'version' ),
       
    38   $install_dependencies = params_lookup( 'install_dependencies' ),
       
    39   $template             = params_lookup( 'template' ),
       
    40   $helpers_class        = params_lookup( 'helpers_class' ),
       
    41   $logs_retention_days  = params_lookup( 'logs_retention_days' ),
       
    42   $extra_class          = params_lookup( 'extra_class' )
       
    43   ) inherits puppi::params {
       
    44 
       
    45   $bool_install_dependencies=any2bool($install_dependencies)
       
    46 
       
    47   # Manage Version
       
    48   $puppi_ensure = $puppi::version ? {
       
    49     '1' => '/usr/sbin/puppi.one',
       
    50     '2' => '/usr/local/bin/puppi',
       
    51   }
       
    52 
       
    53   file { 'puppi.link':
       
    54     ensure => $puppi_ensure,
       
    55     path   => '/usr/sbin/puppi',
       
    56   }
       
    57 
       
    58   # Puppi version one is always installed
       
    59   include puppi::one
       
    60 
       
    61   # Puppi 2 gem (still experimental) is installed only when forced
       
    62   if $puppi::version == '2' {
       
    63     include puppi::two
       
    64   }
       
    65 
       
    66   # Create Puppi common dirs and scripts
       
    67   include puppi::skel
       
    68 
       
    69   # Include extra resources
       
    70   include $puppi::extra_class
       
    71 
       
    72   # Include some packages needed by Puppi
       
    73   if $bool_install_dependencies {
       
    74     include puppi::dependencies
       
    75   }
       
    76 
       
    77 }