system-config/modules/reviewday/manifests/site.pp
Elizabeth Krumbach 80a3b3a1f7 Add gerrit url to reviewday .ssh/known_hosts file
Change-Id: I01a753ecdbd0fcb22cd26ac173f1a37eff35def1
Reviewed-on: https://review.openstack.org/25567
Reviewed-by: Dan Prince <dprince@redhat.com>
Reviewed-by: James E. Blair <corvus@inaugust.com>
Reviewed-by: Khai Do <zaro0508@gmail.com>
Approved: Jeremy Stanley <fungi@yuggoth.org>
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Tested-by: Jenkins
2013-03-28 16:50:51 +00:00

109 lines
2.8 KiB
Puppet

# 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(
$gerrit_url = '',
$gerrit_port = '',
$gerrit_user = '',
$reviewday_rsa_key_contents = '',
$reviewday_rsa_pubkey_contents = '',
$reviewday_gerrit_ssh_key = '',
$git_url = '',
$httproot = '',
$serveradmin = ''
) {
file { '/var/lib/reviewday/.ssh/':
ensure => directory,
owner => 'reviewday',
group => 'reviewday',
mode => '0700',
require => User['reviewday'],
}
if $reviewday_rsa_key_contents != '' {
file { '/var/lib/reviewday/.ssh/id_rsa':
owner => 'reviewday',
group => 'reviewday',
mode => '0600',
content => $reviewday_rsa_key_contents,
replace => true,
require => File['/var/lib/reviewday/.ssh/']
}
}
if $reviewday_rsa_pubkey_contents != '' {
file { '/var/lib/reviewday/.ssh/id_rsa.pub':
owner => 'reviewday',
group => 'reviewday',
mode => '0600',
content => $reviewday_rsa_pubkey_contents,
replace => true,
require => File['/var/lib/reviewday/.ssh/']
}
}
if $reviewday_gerrit_ssh_key != '' {
file { '/var/lib/reviewday/.ssh/known_hosts':
owner => 'reviewday',
group => 'reviewday',
mode => '0600',
content => "${gerrit_url} ${reviewday_gerrit_ssh_key}",
replace => true,
require => File['/var/lib/reviewday/.ssh/']
}
}
file {'/var/lib/reviewday/reviewday':
ensure => directory,
owner => 'reviewday',
group => 'reviewday',
mode => '0755',
require => File['/var/lib/reviewday/'],
}
vcsrepo { '/var/lib/reviewday/reviewday':
ensure => latest,
provider => git,
source => $git_url,
revision => 'master',
}
file { $httproot:
ensure => directory,
owner => 'reviewday',
group => 'reviewday',
mode => '0755',
}
file { '/var/lib/reviewday/.ssh/config':
ensure => present,
content => template('reviewday/ssh_config.erb'),
owner => 'reviewday',
group => 'reviewday',
mode => '0644',
}
cron { 'update reviewday':
command => "cd /var/lib/reviewday/reviewday && PYTHONPATH=\$PWD python bin/reviewday -o ${httproot}",
minute => '*/15',
user => 'reviewday',
}
}
# vim:sw=2:ts=2:expandtab:textwidth=79