Project

General

Profile

« Previous | Next » 

Revision 37540211

Added by Eric Helms over 10 years ago

Updates to become a parameterized class and reduce the dependencies
this module has to only the certs module.

Previously, this module for deploying Candlepin was tightly coupled
to a few different modules including the Katello module. This work
attempts to invert the relationship by parameterizing the Candlepin
class. This will allow a module like the Katello module to set certain
parameters that it would like Candlepin to use during configuration.
The only module left as a dependence is the certs module that creates
and sets up a keystore for tomcat via https.

View differences:

manifests/config.pp
# Configuration for Candlepin
class candlepin::config {
include certs
user { 'tomcat':
ensure => present,
groups => ['katello'],
before => Service["${katello::params::tomcat}"]
groups => $candlepin::user_groups,
before => Service[$candlepin::tomcat]
}
postgres::createuser { $candlepin::params::db_user:
passwd => $candlepin::params::db_pass,
logfile => "${katello::params::configure_log_base}/create-postgresql-candlepin-user.log",
require => [ File["${katello::params::configure_log_base}"] ],
file { "/usr/share/${candlepin::tomcat}/conf/keystore":
ensure => link,
target => $certs::keystore,
require => File[$certs::keystore],
before => Service[$candlepin::tomcat],
}
file { "/etc/candlepin/candlepin.conf":
content => template("candlepin/etc/candlepin/candlepin.conf.erb"),
mode => '600',
owner => 'tomcat',
notify => Service["${katello::params::tomcat}"];
"/etc/${katello::params::tomcat}/server.xml":
content => template("candlepin/etc/${katello::params::tomcat}/server.xml.erb"),
mode => '644',
owner => 'root',
group => 'root',
notify => Service["${katello::params::tomcat}"];
# various tomcat versions had some permission bugs - fix them all
"/etc/${katello::params::tomcat}":
mode => '775';
"/var/log/${katello::params::tomcat}":
mode => '775',
owner => 'root',
group => 'tomcat';
"/var/lib/${katello::params::tomcat}":
mode => '775',
owner => 'tomcat',
group => 'tomcat';
"/var/cache/${katello::params::tomcat}":
owner => 'tomcat',
group => 'tomcat';
file {
'/etc/candlepin/candlepin.conf':
ensure => file,
content => template('candlepin/etc/candlepin/candlepin.conf.erb'),
mode => '0600',
owner => 'tomcat',
notify => Service[$candlepin::tomcat];
"/etc/${candlepin::tomcat}/server.xml":
ensure => file,
content => template("candlepin/etc/${candlepin::tomcat}/server.xml.erb"),
mode => '0644',
owner => 'root',
group => 'root',
notify => Service[$candlepin::tomcat];
# various tomcat versions had some permission bugs - fix them all
"/etc/${candlepin::tomcat}":
mode => '0775';
"/var/log/${candlepin::tomcat}":
ensure => directory,
mode => '0775',
owner => 'root',
group => 'tomcat';
'/var/log/candlepin':
ensure => directory,
mode => '0775',
owner => 'tomcat',
group => 'tomcat';
"/var/lib/${candlepin::tomcat}":
ensure => directory,
mode => '0775',
owner => 'tomcat',
group => 'tomcat';
"/var/cache/${candlepin::tomcat}":
ensure => directory,
mode => '0775',
owner => 'tomcat',
group => 'tomcat';
}
if $candlepin::params::reset_data == 'YES' {
exec {"reset_candlepin_db":
command => "rm -f /var/lib/katello/cpdb_done; rm -f /var/lib/katello/cpinit_done; service ${katello::params::tomcat} stop; test 1 -eq 1",
path => "/sbin:/bin:/usr/bin",
before => Exec["cpdb"],
notify => Postgres::Dropdb["$candlepin::params::db_name"],
exec { 'reset_candlepin_db':
command => "rm -f ${candlepin::log_dir}/cpdb_done; rm -f ${candlepin::log_dir}/cpinit_done; service ${candlepin::tomcat} stop; test 1 -eq 1",
path => '/sbin:/bin:/usr/bin',
before => Exec['cpdb'],
notify => Postgresql::Dropdb[$candlepin::db_name],
}
postgres::dropdb {$candlepin::params::db_name:
logfile => "${katello::params::configure_log_base}/drop-postgresql-candlepin-database.log",
require => [ Postgres::Createuser[$candlepin::params::db_user], File["${katello::params::configure_log_base}"] ],
before => Exec["cpdb"],
postgresql::dropdb {$candlepin::db_name:
logfile => "${candlepin::log_dir}/drop-postgresql-candlepin-database.log",
require => [ Postgresql::Createuser[$candlepin::db_user], File[$candlepin::log_dir] ],
before => Exec['cpdb'],
refreshonly => true,
notify => [
Exec["cpdb"],
Exec["cpinit"],
notify => [
Exec['cpdb'],
Exec['cpinit'],
],
}
}
exec { "cpdb":
path => "/bin:/usr/bin",
command => "/usr/share/candlepin/cpdb --create -u '${candlepin::params::db_user}' -d '${candlepin::params::db_name}' -p '${candlepin::params::db_pass}' >> ${candlepin::params::cpdb_log} 2>&1 && touch /var/lib/katello/cpdb_done",
require => [
File["${katello::params::configure_log_base}"],
Postgres::Createuser[$candlepin::params::db_user],
File["/etc/candlepin/candlepin.conf"]
],
creates => "/var/lib/katello/cpdb_done",
before => Class["apache2::service"],
}
}

Also available in: Unified diff