diff --git a/Modulefile b/Modulefile index 2cccdcec..a94e5281 100644 --- a/Modulefile +++ b/Modulefile @@ -12,4 +12,4 @@ dependency 'puppetlabs/inifile', '>=1.0.0 <2.0.0' dependency 'puppetlabs/keystone', '>=4.0.0 <5.0.0' dependency 'puppetlabs/mysql', '>=0.9.0 <3.0.0' dependency 'puppetlabs/rabbitmq', '>=2.0.2 <4.0.0' -dependency 'puppetlabs/stdlib', '>=3.2.0' +dependency 'puppetlabs/stdlib', '>=4.0.0' diff --git a/manifests/type.pp b/manifests/type.pp index 75b83e98..202df4a1 100644 --- a/manifests/type.pp +++ b/manifests/type.pp @@ -24,6 +24,9 @@ # [*os_auth_url*] # (optional) The keystone auth url. Defaults to 'http://127.0.0.1:5000/v2.0/'. # +# [*os_region_name*] +# (optional) The keystone region name. Default is unset. +# # Author: Andrew Woodward define cinder::type ( @@ -33,6 +36,7 @@ $os_tenant_name = 'admin', $os_username = 'admin', $os_auth_url = 'http://127.0.0.1:5000/v2.0/', + $os_region_name = undef, ) { $volume_name = $name @@ -40,20 +44,28 @@ # TODO: (xarses) This should be moved to a ruby provider so that among other # reasons, the credential discovery magic can occur like in neutron. + $cinder_env = [ + "OS_TENANT_NAME=${os_tenant_name}", + "OS_USERNAME=${os_username}", + "OS_PASSWORD=${os_password}", + "OS_AUTH_URL=${os_auth_url}", + ] + + if $os_region_name { + $region_env = ["OS_REGION_NAME=${os_region_name}"] + } + else { + $region_env = [] + } + exec {"cinder type-create ${volume_name}": command => "cinder type-create ${volume_name}", unless => "cinder type-list | grep ${volume_name}", - environment => [ - "OS_TENANT_NAME=${os_tenant_name}", - "OS_USERNAME=${os_username}", - "OS_PASSWORD=${os_password}", - "OS_AUTH_URL=${os_auth_url}", - ], + environment => concat($cinder_env, $region_env), require => Package['python-cinderclient'] } if ($set_value and $set_key) { - Exec["cinder type-create ${volume_name}"] -> cinder::type_set { $set_value: type => $volume_name, @@ -62,6 +74,7 @@ os_tenant_name => $os_tenant_name, os_username => $os_username, os_auth_url => $os_auth_url, + os_region_name => $os_region_name, } } } diff --git a/manifests/type_set.pp b/manifests/type_set.pp index 6f7ecc78..dc798815 100644 --- a/manifests/type_set.pp +++ b/manifests/type_set.pp @@ -22,6 +22,9 @@ # [*os_auth_url*] # (optional) The keystone auth url. Defaults to 'http://127.0.0.1:5000/v2.0/'. # +# [*os_region_name*] +# (optional) The keystone region name. Default is unset. +# # Author: Andrew Woodward @@ -32,20 +35,30 @@ $os_tenant_name = 'admin', $os_username = 'admin', $os_auth_url = 'http://127.0.0.1:5000/v2.0/', + $os_region_name = undef, ) { # TODO: (xarses) This should be moved to a ruby provider so that among other # reasons, the credential discovery magic can occur like in neutron. + $cinder_env = [ + "OS_TENANT_NAME=${os_tenant_name}", + "OS_USERNAME=${os_username}", + "OS_PASSWORD=${os_password}", + "OS_AUTH_URL=${os_auth_url}", + ] + + if $os_region_name { + $region_env = ["OS_REGION_NAME=${os_region_name}"] + } + else { + $region_env = [] + } + exec {"cinder type-key ${type} set ${key}=${name}": path => '/usr/bin', command => "cinder type-key ${type} set ${key}=${name}", - environment => [ - "OS_TENANT_NAME=${os_tenant_name}", - "OS_USERNAME=${os_username}", - "OS_PASSWORD=${os_password}", - "OS_AUTH_URL=${os_auth_url}", - ], + environment => concat($cinder_env, $region_env), require => Package['python-cinderclient'] } }