Add generic zuul manifests

Copy the zuul scheduler/merger manifests used in:
https://git.openstack.org/cgit/openstack-infra/system-config/tree/modules/openstack_project

Add some refactoring in order to make them more generic:
- Pass $git_name and $git_email as parameters and keep default values.
- Add a known_hosts_content parameter to setup known_hosts.
- Remove the openstack_project/server call. This call stays in system-config.

Needed-By: I98ab36cca49f8784fc93c46db69bc2a777a61938
Change-Id: I48e49c760d5304bd7dd5b0bbbdaa27329b2d8a5f
This commit is contained in:
Fabien Boucher 2015-04-21 16:16:14 +00:00
parent 0550f0fe47
commit 21783c7571
3 changed files with 172 additions and 1 deletions

65
manifests/zuul_merger.pp Normal file
View File

@ -0,0 +1,65 @@
# Copyright (c) 2012-2015 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2015 Red Hat, Inc.
#
# 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
# == Class: openstackci::zuul_merger
#
class openstackci::zuul_merger(
$vhost_name = $::fqdn,
$gearman_server = '127.0.0.1',
$gerrit_server = '',
$gerrit_user = '',
$known_hosts_content = '',
$zuul_ssh_private_key = '',
$zuul_url = "http://${::fqdn}/p",
$git_email = 'zuul@domain.example',
$git_name = 'Zuul',
$manage_common_zuul = true,
) {
if $manage_common_zuul {
class { '::zuul':
vhost_name => $vhost_name,
gearman_server => $gearman_server,
gerrit_server => $gerrit_server,
gerrit_user => $gerrit_user,
zuul_ssh_private_key => $zuul_ssh_private_key,
zuul_url => $zuul_url,
git_email => $git_email,
git_name => $git_name,
}
}
class { '::zuul::merger': }
if $known_hosts_content != '' {
file { '/home/zuul/.ssh':
ensure => directory,
owner => 'zuul',
group => 'zuul',
mode => '0700',
require => Class['::zuul'],
}
file { '/home/zuul/.ssh/known_hosts':
ensure => present,
owner => 'zuul',
group => 'zuul',
mode => '0600',
content => $known_hosts_content,
replace => true,
require => File['/home/zuul/.ssh'],
}
}
}

104
manifests/zuul_scheduler.pp Normal file
View File

@ -0,0 +1,104 @@
# Copyright (c) 2012-2015 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2015 Red Hat, Inc.
#
# 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
# == Class: openstackci::zuul_scheduler
#
class openstackci::zuul_scheduler(
$vhost_name = $::fqdn,
$gearman_server = '127.0.0.1',
$gerrit_server = '',
$gerrit_user = '',
$known_hosts_content = '',
$zuul_ssh_private_key = '',
$url_pattern = '',
$zuul_url = '',
$job_name_in_report = true,
$status_url = 'http://status.domain.example/zuul/',
$swift_authurl = '',
$swift_auth_version = '',
$swift_user = '',
$swift_key = '',
$swift_tenant_name = '',
$swift_region_name = '',
$swift_default_container = '',
$swift_default_logserver_prefix = '',
$swift_default_expiry = 7200,
$proxy_ssl_cert_file_contents = '',
$proxy_ssl_key_file_contents = '',
$proxy_ssl_chain_file_contents = '',
$statsd_host = '',
$project_config_repo = '',
$project_config_base = '',
$git_email = 'zuul@domain.example',
$git_name = 'Zuul',
) {
class { 'project_config':
url => $project_config_repo,
base => $project_config_base,
}
class { '::zuul':
vhost_name => $vhost_name,
gearman_server => $gearman_server,
gerrit_server => $gerrit_server,
gerrit_user => $gerrit_user,
zuul_ssh_private_key => $zuul_ssh_private_key,
url_pattern => $url_pattern,
zuul_url => $zuul_url,
job_name_in_report => $job_name_in_report,
status_url => $status_url,
statsd_host => $statsd_host,
git_email => $git_email,
git_name => $git_name,
swift_authurl => $swift_authurl,
swift_auth_version => $swift_auth_version,
swift_user => $swift_user,
swift_key => $swift_key,
swift_tenant_name => $swift_tenant_name,
swift_region_name => $swift_region_name,
swift_default_container => $swift_default_container,
swift_default_logserver_prefix => $swift_default_logserver_prefix,
swift_default_expiry => $swift_default_expiry,
proxy_ssl_cert_file_contents => $proxy_ssl_cert_file_contents,
proxy_ssl_key_file_contents => $proxy_ssl_key_file_contents,
proxy_ssl_chain_file_contents => $proxy_ssl_chain_file_contents,
}
class { '::zuul::server':
layout_dir => $::project_config::zuul_layout_dir,
require => $::project_config::config_dir,
}
if $known_hosts_content != '' {
file { '/home/zuul/.ssh':
ensure => directory,
owner => 'zuul',
group => 'zuul',
mode => '0700',
require => Class['::zuul'],
}
file { '/home/zuul/.ssh/known_hosts':
ensure => present,
owner => 'zuul',
group => 'zuul',
mode => '0600',
content => $known_hosts_content,
replace => true,
require => File['/home/zuul/.ssh'],
}
}
}

View File

@ -10,6 +10,8 @@
"dependencies": [
{ "name": "puppetlabs/apache" },
{ "name": "openstackinfra/vcsrepo" },
{ "name": "openstackinfra/jenkins" }
{ "name": "openstackinfra/jenkins" },
{ "name": "openstackinfra/zuul" },
{ "name": "openstackinfra/project_config" }
]
}