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