]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/keystone/manifests/roles/admin.pp
Add the posibility to tell openstack to use --os_cacert for keystone_tenant
[dsa-puppet.git] / 3rdparty / modules / keystone / manifests / roles / admin.pp
1 #
2 # This class implements some reasonable admin defaults for keystone.
3 #
4 # It creates the following keystone objects:
5 #   * service tenant (tenant used by all service users)
6 #   * "admin" tenant (defaults to "openstack")
7 #   * admin user (that defaults to the "admin" tenant)
8 #   * admin role
9 #   * adds admin role to admin user on the "admin" tenant
10 #
11 # [*Parameters*]
12 #
13 # [email] The email address for the admin. Required.
14 # [password] The admin password. Required.
15 # [admin_roles] The list of the roles with admin privileges. Optional. Defaults to ['admin'].
16 # [admin_tenant] The name of the tenant to be used for admin privileges. Optional. Defaults to openstack.
17 # [admin] Admin user. Optional. Defaults to admin.
18 # [ignore_default_tenant] Ignore setting the default tenant value when the user is created. Optional. Defaults to false.
19 # [admin_tenant_desc] Optional. Description for admin tenant, defaults to 'admin tenant'
20 # [service_tenant_desc] Optional. Description for admin tenant, defaults to 'Tenant for the openstack services'
21 # [configure_user] Optional. Should the admin user be created? Defaults to 'true'.
22 # [configure_user_role] Optional. Should the admin role be configured for the admin user? Defaulst to 'true'.
23 #
24 # == Dependencies
25 # == Examples
26 # == Authors
27 #
28 #   Dan Bode dan@puppetlabs.com
29 #
30 # == Copyright
31 #
32 # Copyright 2012 Puppetlabs Inc, unless otherwise noted.
33 #
34 class keystone::roles::admin(
35   $email,
36   $password,
37   $admin                  = 'admin',
38   $admin_tenant           = 'openstack',
39   $admin_roles            = ['admin'],
40   $service_tenant         = 'services',
41   $ignore_default_tenant  = false,
42   $admin_tenant_desc      = 'admin tenant',
43   $service_tenant_desc    = 'Tenant for the openstack services',
44   $configure_user         = true,
45   $configure_user_role    = true,
46   $validate_cacert        = undef,
47 ) {
48
49   keystone_tenant { $service_tenant:
50     ensure      => present,
51     enabled     => true,
52     description => $service_tenant_desc,
53     os_cacert   => $validate_cacert,
54   }
55   keystone_tenant { $admin_tenant:
56     ensure      => present,
57     enabled     => true,
58     description => $admin_tenant_desc,
59     os_cacert   => $validate_cacert,
60   }
61   keystone_role { 'admin':
62     ensure => present,
63   }
64
65   if $configure_user {
66     keystone_user { $admin:
67       ensure                => present,
68       enabled               => true,
69       tenant                => $admin_tenant,
70       email                 => $email,
71       password              => $password,
72       ignore_default_tenant => $ignore_default_tenant,
73     }
74   }
75
76   if $configure_user_role {
77     keystone_user_role { "${admin}@${admin_tenant}":
78       ensure => present,
79       roles  => $admin_roles,
80     }
81   }
82
83 }