Setting up configuration parameters for Rally

This commit is contained in:
Volodymyr Stoiko 2016-08-15 13:11:24 +03:00
parent 0fac7c369d
commit decf1faac4
3 changed files with 44 additions and 5 deletions

View File

@ -1,7 +1,8 @@
class rally::config inherits rally {
$rally_config = '/etc/rally/deployment/existing.json'
$rally_config = '/etc/rally/rally.conf'
$rally_deployment = 'existing'
$rally_deployment_config = '/etc/rally/deployment/existing.json'
$rally_hostname = hiera('rally::public_hostname')
$rally_vip = hiera('rally::public_vip')
@ -13,11 +14,47 @@ class rally::config inherits rally {
ip => $rally_vip,
}
define rally_deployment_configuration($rally_config, $key, $value) {
augeas { "${rally_config}_${key}":
lens => "Puppet.lns",
incl => "${rally_config}",
context => "/files/${rally_config}/DEFAULT/",
onlyif => "get $key != '$value'",
changes => [
"ins $key after #comment[. =~ regexp('$key = .*')]",
"set $key $value",
],
}
}
$rally_deployment_config_values = {
verbose => {
key => 'verbose',
value => 'true',
},
log_dir => {
key => 'log_dir',
value => '/var/log/rally/' },
}
$defaults = {
rally_config => $rally_config,
before => Exec['register_deployment'],
}
create_resources(rally_deployment_configuration, $rally_deployment_config_values, $defaults)
file { "$rally_deployment_config_values['log_dir']['key']":
ensure => directory,
path => $rally_deployment_config_values['log_dir']['value'],
}
file {'deployment':
ensure => directory,
path => '/etc/rally/deployment'
} ->
file { "${rally_config}":
file { "${rally_deployment_config}":
ensure => file,
content => template('rally/existing.json.erb'),
owner => $rally::rally_user,
@ -26,7 +63,7 @@ class rally::config inherits rally {
}
$cmd = "/usr/local/bin/rally deployment create \
--file=${rally_config} \
--file=${rally_deployment_config} \
--name ${rally_deployment}"
exec { 'dependencies_upgrade':
@ -48,7 +85,7 @@ class rally::config inherits rally {
],
user => $rally::rally_user,
cwd => $rally::rally_home,
require => File[$rally_config],
require => File[$rally_deployment_config],
unless => "/usr/local/bin/rally deployment show \
--deployment ${rally_deployment}",
}

View File

@ -25,6 +25,7 @@ class rally::install inherits rally {
'libpq-dev' => {},
'git' => {},
'python-pip' => {},
'augeas-tools' => {},
}
$defaults = {
ensure => installed,

View File

@ -63,7 +63,8 @@ download deb http://mirrors.kernel.org/ubuntu/pool/main/libe/liberror-perl/liber
http://mirrors.kernel.org/ubuntu/pool/universe/d/distlib/python-distlib_0.1.8-1ubuntu1_all.deb \
http://mirrors.kernel.org/ubuntu/pool/universe/d/distlib/python-distlib-whl_0.1.8-1ubuntu1_all.deb \
http://mirrors.kernel.org/ubuntu/pool/universe/p/python-pip/python-pip_1.5.4-1ubuntu4_all.deb \
http://mirrors.kernel.org/ubuntu/pool/universe/p/python-pip/python-pip-whl_1.5.4-1ubuntu4_all.deb
http://mirrors.kernel.org/ubuntu/pool/universe/p/python-pip/python-pip-whl_1.5.4-1ubuntu4_all.deb \
http://mirrors.kernel.org/ubuntu/pool/main/a/augeas/augeas-tools_1.2.0-0ubuntu1_amd64.deb
# Obtain Rally installer
mkdir -p "${RALLY_INSTALLER_DIR}"