dev/provisioning/modules/puppi/manifests/todo.pp
changeset 28 b0b56e0f8c7f
equal deleted inserted replaced
27:a2342f26c9de 28:b0b56e0f8c7f
       
     1 # Define puppi::todo
       
     2 #
       
     3 # This define creates a basic todo file that simply contains informations
       
     4 # on how to complete tasks that for time or other reasons could not be
       
     5 # entirely automated by Puppet.
       
     6 # The basic idea is to have a quick way to document and check if are completed
       
     7 # some specific operations that are required to bring a new, puppettized system
       
     8 # to full operative status.
       
     9 # This can be useful for cases hard to automate with Puppet:
       
    10 # - First setup and import of a database needed by an application (module)
       
    11 # - Installation of a legacy application that involves user interaction
       
    12 # - Run of any kind of setup/configuration/init command that can't be automated
       
    13 # It can also be used as a quick reminder on things done by hand and not
       
    14 # Puppettized for lack of time or skill.
       
    15 #
       
    16 # Use the command puppi todo to show the todo present in your node.
       
    17 # The exit status can be:
       
    18 # 0 - OK - The task to do has been accomplished because the command specified
       
    19 #    as check_command returns true (exit status 0)
       
    20 # 1- WARNING - User hasn't specified a check_command to verify if the todo as
       
    21 #    been accomplished, so it can't be notified if the todo has been done
       
    22 # 2- ERROR - The task to do has not been accomplished becuase the command
       
    23 #    specified as check_command returns an error (exit status different from 0)
       
    24 #
       
    25 # == Usage:
       
    26 # puppi::todo { "cacti_db_install":
       
    27 #   description => "Manual cacti db installation" ,
       
    28 # }
       
    29 #
       
    30 define puppi::todo (
       
    31   $description   = '',
       
    32   $notes         = '',
       
    33   $check_command = '',
       
    34   $run           = '' ) {
       
    35 
       
    36   require puppi
       
    37   require puppi::params
       
    38 
       
    39   $array_run = is_array($run) ? {
       
    40     false     => $run ? {
       
    41       ''      => [],
       
    42       default => split($run, ','),
       
    43     },
       
    44     default   => $run,
       
    45   }
       
    46 
       
    47   file { "${puppi::params::tododir}/${name}":
       
    48     ensure  => present,
       
    49     mode    => '0750',
       
    50     owner   => $puppi::params::configfile_owner,
       
    51     group   => $puppi::params::configfile_group,
       
    52     require => Class['puppi'],
       
    53     content => template('puppi/todo.erb'),
       
    54     tag     => 'puppi_todo',
       
    55   }
       
    56 
       
    57 }