]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/neutron/manifests/keystone/auth.pp
try again, with puppetforge modules, correctly included now
[dsa-puppet.git] / 3rdparty / modules / neutron / manifests / keystone / auth.pp
1 # == Class: neutron::keystone::auth
2 #
3 # Configures Neutron user, service and endpoint in Keystone.
4 #
5 # === Parameters
6 #
7 # [*password*]
8 #   (required) Password for Neutron user.
9 #
10 # [*auth_name*]
11 #   Username for Neutron service. Defaults to 'neutron'.
12 #
13 # [*email*]
14 #   Email for Neutron user. Defaults to 'neutron@localhost'.
15 #
16 # [*tenant*]
17 #   Tenant for Neutron user. Defaults to 'services'.
18 #
19 # [*configure_endpoint*]
20 #   Should Neutron endpoint be configured? Defaults to 'true'.
21 #
22 # [*configure_user*]
23 #   Should the Neutron service user be configured? Defaults to 'true'.
24 #
25 # [*configure_user_role*]
26 #   Should the admin role be configured for the service user?
27 #   Defaults to 'true'.
28 #
29 # [*service_name*]
30 #   Name of the service. Defaults to the value of auth_name.
31 #
32 # [*service_type*]
33 #   Type of service. Defaults to 'network'.
34 #
35 # [*public_protocol*]
36 #   Protocol for public endpoint. Defaults to 'http'.
37 #
38 # [*public_address*]
39 #   Public address for endpoint. Defaults to '127.0.0.1'.
40 #
41 # [*admin_protocol*]
42 #   Protocol for admin endpoint. Defaults to 'http'.
43 #
44 # [*admin_address*]
45 #   Admin address for endpoint. Defaults to '127.0.0.1'.
46 #
47 # [*internal_protocol*]
48 #   Protocol for internal endpoint. Defaults to 'http'.
49 #
50 # [*internal_address*]
51 #   Internal address for endpoint. Defaults to '127.0.0.1'.
52 #
53 # [*port*]
54 #   Port for endpoint. Defaults to '9696'.
55 #
56 # [*public_port*]
57 #   Port for public endpoint. Defaults to $port.
58 #
59 # [*region*]
60 #   Region for endpoint. Defaults to 'RegionOne'.
61 #
62 class neutron::keystone::auth (
63   $password,
64   $auth_name           = 'neutron',
65   $email               = 'neutron@localhost',
66   $tenant              = 'services',
67   $configure_endpoint  = true,
68   $configure_user      = true,
69   $configure_user_role = true,
70   $service_name        = undef,
71   $service_type        = 'network',
72   $public_protocol     = 'http',
73   $public_address      = '127.0.0.1',
74   $admin_protocol      = 'http',
75   $admin_address       = '127.0.0.1',
76   $internal_protocol   = 'http',
77   $internal_address    = '127.0.0.1',
78   $port                = '9696',
79   $public_port         = undef,
80   $region              = 'RegionOne'
81 ) {
82
83   if $service_name == undef {
84     $real_service_name = $auth_name
85   } else {
86     $real_service_name = $service_name
87   }
88
89   if ! $public_port {
90     $real_public_port = $port
91   } else {
92     $real_public_port = $public_port
93   }
94
95   Keystone_endpoint["${region}/${real_service_name}"]  ~> Service <| name == 'neutron-server' |>
96
97   if $configure_user {
98     keystone_user { $auth_name:
99       ensure   => present,
100       password => $password,
101       email    => $email,
102       tenant   => $tenant,
103     }
104   }
105
106   if $configure_user_role {
107     Keystone_user_role["${auth_name}@${tenant}"] ~> Service <| name == 'neutron-server' |>
108
109     keystone_user_role { "${auth_name}@${tenant}":
110       ensure => present,
111       roles  => 'admin',
112     }
113   }
114
115   keystone_service { $real_service_name:
116     ensure      => present,
117     type        => $service_type,
118     description => 'Neutron Networking Service',
119   }
120
121   if $configure_endpoint {
122     keystone_endpoint { "${region}/${real_service_name}":
123       ensure       => present,
124       public_url   => "${public_protocol}://${public_address}:${real_public_port}/",
125       internal_url => "${internal_protocol}://${internal_address}:${port}/",
126       admin_url    => "${admin_protocol}://${admin_address}:${port}/",
127     }
128
129   }
130 }