Update rally module

This commit is contained in:
Sergey Kulikov 2016-08-04 14:19:26 +00:00
parent 95dfdcd325
commit c47c18f5ae
4 changed files with 62 additions and 27 deletions

View File

@ -1,19 +1,17 @@
class rally::config (
$auth_url = undef,
$username = undef,
$password = undef,
$tenant_name = undef,
) {
class rally::config inherits rally {
$rally_config = '/root/existing.json'
$rally_config = "${rally::rally_home}/existing.json"
$rally_deployment = 'existing'
file { "${rally_config}":
ensure => file,
content => template('rally/existing.json.erb'),
owner => $rally::rally_user,
group => $rally::rally_group,
mode => '0644',
}
$cmd = "rally deployment create \
$cmd = "${rally::rally_venv}/bin/rally deployment create \
--file=${rally_config} \
--name ${rally_deployment}"
@ -24,10 +22,12 @@ class rally::config (
'/sbin',
'/usr/bin',
'/usr/sbin',
'/usr/local/bin',
'/usr/local/sbin',
"${rally::rally_venv}/bin",
],
user => $rally::rally_user,
cwd => $rally::rally_home,
require => File[$rally_config],
unless => "rally deployment show --deployment ${rally_deployment}",
unless => "${rally::rally_venv}/bin/rally deployment show \
--deployment ${rally_deployment}",
}
}

View File

@ -0,0 +1,23 @@
class rally (
$repository_url = $rally::params::repository_url,
$repository_tag = $rally::params::repository_tag,
$create_user = $rally::params::create_user,
$rally_user = $rally::params::rally_user,
$auth_url = $rally::params::auth_url,
$username = $rally::params::usermame,
$password = $rally::params::password,
$tenant_name = $rally::params::tenant_name,
) inherits rally::params {
$rally_group = $rally_user
$rally_home = $rally_user ? {
'root' => '/root',
default => "/home/${rally_user}",
}
$rally_venv = "${rally_home}/rally"
anchor { 'rally::begin': } ->
class { 'rally::install': } ->
class { 'rally::config': } ->
anchor { 'rally::end': }
}

View File

@ -1,16 +1,13 @@
class rally::install (
$repository_url = 'https://github.com/openstack/rally',
$repository_tag = 'master',
) {
class rally::install inherits rally {
$rally_installer = '/tmp/install_rally.sh'
$cmd = "${rally_installer} \
--yes \
--system \
--no-color \
--url ${repository_url} \
--branch ${repository_tag}"
--target ${rally::rally_venv} \
--url ${rally::repository_url} \
--branch ${rally::repository_tag}"
file { "${rally_installer}":
ensure => file,
@ -35,17 +32,22 @@ class rally::install (
}
create_resources(package, $packages, $defaults)
if $rally::create_user == true and $rally::rally_user != 'root' {
user { "${rally::rally_user}":
ensure => present,
managehome => true,
home => $rally::rally_home,
shell => '/bin/bash',
before => Exec[$rally_installer],
}
}
exec { "${rally_installer}":
command => $cmd,
path => [
'/bin',
'/sbin',
'/usr/bin',
'/usr/sbin',
'/usr/local/bin',
'/usr/local/sbin',
],
path => ['/bin', '/sbin', '/usr/bin', '/usr/sbin'],
user => $rally::rally_user,
cwd => $rally::rally_home,
timeout => 600,
unless => "rally --version",
unless => "test -x ${rally::rally_venv}/bin/rally",
}
}

View File

@ -0,0 +1,10 @@
class rally::params {
$repository_url = 'https://github.com/openstack/rally'
$repository_tag = 'master'
$create_user = true
$rally_user = 'rally'
$auth_url = undef
$username = undef
$password = undef
$tenant_name = undef
}