1 # ==Define: cinder::type
3 # Creates cinder type and assigns backends.
8 # (required) The keystone tenant:username password.
11 # (optional) Must be used with set_value. Accepts a single string be used
12 # as the key in type_set
15 # (optional) Accepts list of strings or singular string. A list of values
19 # (optional) The keystone tenant name. Defaults to 'admin'.
22 # (optional) The keystone user name. Defaults to 'admin.
25 # (optional) The keystone auth url. Defaults to 'http://127.0.0.1:5000/v2.0/'.
28 # (optional) The keystone region name. Default is unset.
30 # Author: Andrew Woodward <awoodward@mirantis.com>
36 $os_tenant_name = 'admin',
37 $os_username = 'admin',
38 $os_auth_url = 'http://127.0.0.1:5000/v2.0/',
39 $os_region_name = undef,
44 # TODO: (xarses) This should be moved to a ruby provider so that among other
45 # reasons, the credential discovery magic can occur like in neutron.
48 "OS_TENANT_NAME=${os_tenant_name}",
49 "OS_USERNAME=${os_username}",
50 "OS_PASSWORD=${os_password}",
51 "OS_AUTH_URL=${os_auth_url}",
55 $region_env = ["OS_REGION_NAME=${os_region_name}"]
61 exec {"cinder type-create ${volume_name}":
62 command => "cinder type-create ${volume_name}",
63 unless => "cinder type-list | grep -qP '\\b${volume_name}\\b'",
64 environment => concat($cinder_env, $region_env),
65 require => Package['python-cinderclient'],
66 path => ['/usr/bin', '/bin'],
69 if ($set_value and $set_key) {
70 Exec["cinder type-create ${volume_name}"] ->
71 cinder::type_set { $set_value:
74 os_password => $os_password,
75 os_tenant_name => $os_tenant_name,
76 os_username => $os_username,
77 os_auth_url => $os_auth_url,
78 os_region_name => $os_region_name,