Add puppet files for reviewday

Initial add of puppet files so reviewday can be deployed on the
static webserver.

Fixes: bug #1082785
Change-Id: Ie5516e82bfc9dfea95b53285c46aa881d5c05f32
Reviewed-on: https://review.openstack.org/21158
Reviewed-by: James E. Blair <corvus@inaugust.com>
Approved: Jeremy Stanley <fungi@yuggoth.org>
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Tested-by: Jenkins
This commit is contained in:
Elizabeth Krumbach 2013-02-04 14:25:02 -08:00 committed by Jenkins
commit 398173dd29
4 changed files with 166 additions and 0 deletions

90
manifests/init.pp Normal file
View File

@ -0,0 +1,90 @@
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Define: reviewday
#
define reviewday::init(
$gerrit_url = '',
$gerrit_port = '',
$gerrit_user = '',
$reviewday_rsa_key_contents = '',
$reviewday_rsa_pubkey_contents = '',
$reviewday_gerrit_ssh_key = ''
) {
if ! defined(Package['python-launchpadlib']) {
package { 'python-launchpadlib':
ensure => present,
}
}
package { 'python-cheetah':
ensure => present,
}
group { 'reviewday':
ensure => present,
}
user { 'reviewday':
ensure => present,
home => "/var/lib/${name}",
shell => '/bin/bash',
gid => 'reviewday',
managehome => true,
require => Group['reviewday'],
}
file { "/var/lib/${name}/.ssh/":
ensure => directory,
owner => 'reviewday',
group => 'reviewday',
mode => '0700',
require => User['reviewday'],
}
if $reviewday_rsa_key_contents != '' {
file { "/var/lib/${name}/.ssh/id_rsa":
owner => 'reviewday',
group => 'reviewday',
mode => '0600',
content => $reviewday_rsa_key_contents,
replace => true,
require => File["/var/lib/${name}/.ssh/"]
}
}
if $reviewday_rsa_pubkey_contents != '' {
file { "/var/lib/${name}/.ssh/id_rsa.pub":
owner => 'reviewday',
group => 'reviewday',
mode => '0600',
content => $reviewday_rsa_pubkey_contents,
replace => true,
require => File["/var/lib/${name}/.ssh/"]
}
}
if $reviewday_gerrit_ssh_key != '' {
file { "/var/lib/${name}/.ssh/known_hosts":
owner => 'reviewday',
group => 'reviewday',
mode => '0600',
content => $reviewday_gerrit_ssh_key,
replace => true,
require => File["/var/lib/${name}/.ssh/"]
}
}
}
# vim:sw=2:ts=2:expandtab:textwidth=79

60
manifests/site.pp Normal file
View File

@ -0,0 +1,60 @@
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# == Define: reviewday
#
define reviewday::site(
$git_url = '',
$httproot = '',
$serveradmin = '',
) {
include apache
vcsrepo { "/var/lib/${name}/reviewday":
ensure => present,
provider => git,
source => $git_url,
}
apache::vhost { $name:
docroot => $httproot,
port => 80,
priority => '50',
require => File[$httproot],
template => 'reviewday.vhost.erb',
}
file { $httproot:
ensure => directory,
owner => 'reviewday',
group => 'reviewday',
mode => '0644',
}
file { "/var/lib/${name}/.ssh/config":
ensure => present,
content => template('ssh_config.erb'),
owner => reviewday,
group => reviewday,
mode => '0644',
}
cron { "update ${name} reviewday":
command => "cd /var/lib/${name}/reviewday && PYTHONPATH=\$PWD python bin/reviewday -o /${httproot}",
minute => '*/15',
user => 'reviewday',
}
}
# vim:sw=2:ts=2:expandtab:textwidth=79

View File

@ -0,0 +1,10 @@
<VirtualHost <%= name %>:80>
ServerAdmin <%= serveradmin %>
DocumentRoot <%= httproot %>
ErrorLog ${APACHE_LOG_DIR}/<%= name %>-error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/<%= name %>-access.log combined
</VirtualHost>

6
templates/ssh_config.erb Normal file
View File

@ -0,0 +1,6 @@
Host review
Hostname <%= gerrit_url %>
Port <%= gerrit_port %>
User <%= gerrit_user %>
IdentityFile /var/lib/<%= name %>/.ssh/id_rsa
UserKnownHostsFile /var/lib/<%= name %>/.ssh/known_hosts