]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/neutron/manifests/agents/metadata.pp
try again, with puppetforge modules, correctly included now
[dsa-puppet.git] / 3rdparty / modules / neutron / manifests / agents / metadata.pp
1 # == Class: neutron::agents::metadata
2 #
3 # Setup and configure Neutron metadata agent.
4 #
5 # === Parameters
6 #
7 # [*auth_password*]
8 #   (required) The password for the administrative user.
9 #
10 # [*shared_secret*]
11 #   (required) Shared secret to validate proxies Neutron metadata requests.
12 #
13 # [*package_ensure*]
14 #   Ensure state of the package. Defaults to 'present'.
15 #
16 # [*enabled*]
17 #   State of the service. Defaults to true.
18 #
19 # [*manage_service*]
20 #   (optional) Whether to start/stop the service
21 #   Defaults to true
22 #
23 # [*debug*]
24 #   Debug. Defaults to false.
25 #
26 # [*auth_tenant*]
27 #   The administrative user's tenant name. Defaults to 'services'.
28 #
29 # [*auth_user*]
30 #   The administrative user name for OpenStack Networking.
31 #   Defaults to 'neutron'.
32 #
33 # [*auth_url*]
34 #   The URL used to validate tokens. Defaults to 'http://localhost:35357/v2.0'.
35 #
36 # [*auth_insecure*]
37 #   turn off verification of the certificate for ssl (Defaults to false)
38 #
39 # [*auth_ca_cert*]
40 #   CA cert to check against with for ssl keystone. (Defaults to undef)
41 #
42 # [*auth_region*]
43 #   The authentication region. Defaults to 'RegionOne'.
44 #
45 # [*metadata_ip*]
46 #   The IP address of the metadata service. Defaults to '127.0.0.1'.
47 #
48 # [*metadata_port*]
49 #   The TCP port of the metadata service. Defaults to 8775.
50 #
51 # [*metadata_workers*]
52 #   (optional) Number of separate worker processes to spawn.
53 #   The default, count of machine's processors, runs the worker thread in the
54 #   current process.
55 #   Greater than 0 launches that number of child processes as workers.
56 #   The parent process manages them. Having more workers will help to improve performances.
57 #   Defaults to: $::processorcount
58 #
59 # [*metadata_backlog*]
60 #   (optional) Number of backlog requests to configure the metadata server socket with.
61 #   Defaults to 4096
62 #
63 # [*metadata_memory_cache_ttl*]
64 #   (optional) Specifies time in seconds a metadata cache entry is valid in
65 #   memory caching backend.
66 #   Set to 0 will cause cache entries to never expire.
67 #   Set to undef or false to disable cache.
68 #   Defaults to 5
69 #
70
71 class neutron::agents::metadata (
72   $auth_password,
73   $shared_secret,
74   $package_ensure            = 'present',
75   $enabled                   = true,
76   $manage_service            = true,
77   $debug                     = false,
78   $auth_tenant               = 'services',
79   $auth_user                 = 'neutron',
80   $auth_url                  = 'http://localhost:35357/v2.0',
81   $auth_insecure             = false,
82   $auth_ca_cert              = undef,
83   $auth_region               = 'RegionOne',
84   $metadata_ip               = '127.0.0.1',
85   $metadata_port             = '8775',
86   $metadata_workers          = $::processorcount,
87   $metadata_backlog          = '4096',
88   $metadata_memory_cache_ttl = 5,
89   ) {
90
91   include neutron::params
92
93   Package['neutron'] -> Neutron_metadata_agent_config<||>
94   Neutron_config<||> ~> Service['neutron-metadata']
95   Neutron_metadata_agent_config<||> ~> Service['neutron-metadata']
96
97   neutron_metadata_agent_config {
98     'DEFAULT/debug':                          value => $debug;
99     'DEFAULT/auth_url':                       value => $auth_url;
100     'DEFAULT/auth_insecure':                  value => $auth_insecure;
101     'DEFAULT/auth_region':                    value => $auth_region;
102     'DEFAULT/admin_tenant_name':              value => $auth_tenant;
103     'DEFAULT/admin_user':                     value => $auth_user;
104     'DEFAULT/admin_password':                 value => $auth_password, secret => true;
105     'DEFAULT/nova_metadata_ip':               value => $metadata_ip;
106     'DEFAULT/nova_metadata_port':             value => $metadata_port;
107     'DEFAULT/metadata_proxy_shared_secret':   value => $shared_secret;
108     'DEFAULT/metadata_workers':               value => $metadata_workers;
109     'DEFAULT/metadata_backlog':               value => $metadata_backlog;
110   }
111
112   if $metadata_memory_cache_ttl {
113     neutron_metadata_agent_config {
114       'DEFAULT/cache_url':                    value => "memory://?default_ttl=${metadata_memory_cache_ttl}";
115     }
116   } else {
117     neutron_metadata_agent_config {
118       'DEFAULT/cache_url':                   ensure => absent;
119     }
120   }
121
122   if $auth_ca_cert {
123     neutron_metadata_agent_config {
124       'DEFAULT/auth_ca_cert':                 value => $auth_ca_cert;
125     }
126   } else {
127     neutron_metadata_agent_config {
128       'DEFAULT/auth_ca_cert':                 ensure => absent;
129     }
130   }
131
132   if $::neutron::params::metadata_agent_package {
133     Package['neutron-metadata'] -> Neutron_metadata_agent_config<||>
134     Package['neutron-metadata'] -> Service['neutron-metadata']
135     package { 'neutron-metadata':
136       ensure  => $package_ensure,
137       name    => $::neutron::params::metadata_agent_package,
138       require => Package['neutron'],
139     }
140   }
141
142   if $manage_service {
143     if $enabled {
144       $service_ensure = 'running'
145     } else {
146       $service_ensure = 'stopped'
147     }
148   }
149
150   service { 'neutron-metadata':
151     ensure  => $service_ensure,
152     name    => $::neutron::params::metadata_agent_service,
153     enable  => $enabled,
154     require => Class['neutron'],
155   }
156 }