546136ce52
Make files notify services to restart when changed Improve planet's cron, spit out a date/time and append instead of overwrite log Change-Id: I0c2ee96c4aff5512a891c49b8b2df5c20c9cab44
41 lines
1.1 KiB
Puppet
41 lines
1.1 KiB
Puppet
define planet::site($git_url) {
|
|
|
|
file { "/etc/nginx/sites-available/planet-${name}":
|
|
ensure => present,
|
|
content => template("planet/nginx.erb"),
|
|
replace => true,
|
|
require => Package[nginx],
|
|
notify => Service[nginx]
|
|
}
|
|
|
|
file { "/etc/nginx/sites-enabled/planet-${name}":
|
|
ensure => link,
|
|
target => "/etc/nginx/sites-available/planet-${name}",
|
|
require => Package[nginx],
|
|
}
|
|
|
|
# if we already have the mercurial repo the pull updates
|
|
|
|
exec { "update_${name}_planet":
|
|
command => "git pull --ff-only",
|
|
cwd => "/var/lib/planet/${name}",
|
|
path => "/bin:/usr/bin",
|
|
onlyif => "test -d /var/lib/planet/${name}"
|
|
}
|
|
|
|
# otherwise get a new clone of it
|
|
|
|
exec { "create_${name}_planet":
|
|
command => "git clone ${git_url} /var/lib/planet/${name}",
|
|
path => "/bin:/usr/bin",
|
|
onlyif => "test ! -d /var/lib/planet/${name}"
|
|
}
|
|
|
|
cron { "update_planet_${name}":
|
|
user => root,
|
|
minute => "*/5",
|
|
command => "date >> /var/log/planet/${name}.log && cd /var/lib/planet/${name} && planet /var/lib/planet/${name}/planet.ini >> /var/log/planet/${name}.log 2>&1"
|
|
}
|
|
|
|
}
|