]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/glance/manifests/keystone/auth.pp
8caf194b61144f11c8b7b6367aea520603b4d3fe
[dsa-puppet.git] / 3rdparty / modules / glance / manifests / keystone / auth.pp
1 #
2 # Sets up glance users, service and endpoint
3 #
4 # == Parameters:
5 #
6 #  $auth_name :: identifier used for all keystone objects related to glance.
7 #    Optional. Defaults to glance.
8 #  $password :: password for glance user. Optional. Defaults to glance_password.
9 #  $configure_user :: Whether to configure a service user. Optional. Defaults to true.
10 #  $configure_user_role :: Whether to configure the admin role for the service user.
11 #    Optional. Defaults to true.
12 #  $service_name :: name of the service. Optional. Defaults to value of auth_name.
13 #  $service_type :: type of service to create. Optional. Defaults to image.
14 #  $public_address :: Public address for endpoint. Optional. Defaults to 127.0.0.1.
15 #  $admin_address :: Admin address for endpoint. Optional. Defaults to 127.0.0.1.
16 #  $inernal_address :: Internal address for endpoint. Optional. Defaults to 127.0.0.1.
17 #  $port :: Port for endpoint. Needs to match glance api service port. Optional.
18 #    Defaults to 9292.
19 #  $region :: Region where endpoint is set.
20 #  $public_protocol :: Protocol for public endpoint. Optional. Defaults to http.
21 #  $admin_protocol :: Protocol for admin endpoint. Optional. Defaults to http.
22 #  $internal_protocol :: Protocol for internal endpoint. Optional. Defaults to http.
23 #
24 class glance::keystone::auth(
25   $password,
26   $email               = 'glance@localhost',
27   $auth_name           = 'glance',
28   $configure_endpoint  = true,
29   $configure_user      = true,
30   $configure_user_role = true,
31   $service_name        = undef,
32   $service_type        = 'image',
33   $public_address      = '127.0.0.1',
34   $admin_address       = '127.0.0.1',
35   $internal_address    = '127.0.0.1',
36   $port                = '9292',
37   $region              = 'RegionOne',
38   $tenant              = 'services',
39   $public_protocol     = 'http',
40   $admin_protocol      = 'http',
41   $internal_protocol   = 'http'
42 ) {
43
44   if $service_name == undef {
45     $real_service_name = $auth_name
46   } else {
47     $real_service_name = $service_name
48   }
49
50   if $configure_endpoint {
51     Keystone_endpoint["${region}/${real_service_name}"]  ~> Service <| name == 'glance-api' |>
52   }
53
54   if $configure_user {
55     keystone_user { $auth_name:
56       ensure   => present,
57       password => $password,
58       email    => $email,
59       tenant   => $tenant,
60     }
61   }
62
63   if $configure_user_role {
64     Keystone_user_role["${auth_name}@${tenant}"] ~> Service <| name == 'glance-registry' |>
65     Keystone_user_role["${auth_name}@${tenant}"] ~> Service <| name == 'glance-api' |>
66
67     keystone_user_role { "${auth_name}@${tenant}":
68       ensure => present,
69       roles  => 'admin',
70     }
71   }
72
73   keystone_service { $real_service_name:
74     ensure      => present,
75     type        => $service_type,
76     description => 'Openstack Image Service',
77   }
78
79   if $configure_endpoint {
80     keystone_endpoint { "${region}/${real_service_name}":
81       ensure       => present,
82       public_url   => "${public_protocol}://${public_address}:${port}",
83       admin_url    => "${admin_protocol}://${admin_address}:${port}",
84       internal_url => "${internal_protocol}://${internal_address}:${port}",
85     }
86   }
87 }