dev/provisioning/modules/puppi/manifests/configure.pp
changeset 28 b0b56e0f8c7f
equal deleted inserted replaced
27:a2342f26c9de 28:b0b56e0f8c7f
       
     1 # Define puppi::deploy
       
     2 #
       
     3 # This define creates a file with a deploy command that can be used locally.
       
     4 #
       
     5 # == Usage:
       
     6 # puppi::configure { "Retrieve files":
       
     7 #   command  => "get_file.sh",
       
     8 #   argument => "/remote/dir/file",
       
     9 #   priority => "10",
       
    10 #   user   => "root",
       
    11 #   project  => "spysite",
       
    12 # }
       
    13 #
       
    14 # :include:../README.deploy
       
    15 #
       
    16 define puppi::configure (
       
    17   $command,
       
    18   $project,
       
    19   $arguments = '',
       
    20   $priority  = '50',
       
    21   $user      = 'root',
       
    22   $enable    = true ) {
       
    23 
       
    24   require puppi
       
    25   require puppi::params
       
    26 
       
    27   $ensure = bool2ensure($enable)
       
    28 
       
    29   file { "${puppi::params::projectsdir}/${project}/configure/${priority}-${name}":
       
    30     ensure  => $ensure,
       
    31     mode    => '0750',
       
    32     owner   => $puppi::params::configfile_owner,
       
    33     group   => $puppi::params::configfile_group,
       
    34     require => Class['puppi'],
       
    35     content => "su - ${user} -c \"export project=${project} && ${puppi::params::scriptsdir}/${command} ${arguments}\"\n",
       
    36     tag     => 'puppi_deploy',
       
    37   }
       
    38 
       
    39 }
       
    40