]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/neutron/manifests/server/notifications.pp
try again, with puppetforge modules, correctly included now
[dsa-puppet.git] / 3rdparty / modules / neutron / manifests / server / notifications.pp
1 # Licensed under the Apache License, Version 2.0 (the "License"); you may
2 # not use this file except in compliance with the License. You may obtain
3 # a copy of the License at
4 #
5 #      http://www.apache.org/licenses/LICENSE-2.0
6 #
7 # Unless required by applicable law or agreed to in writing, software
8 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10 # License for the specific language governing permissions and limitations
11 # under the License.
12 #
13 # == Class: neutron::server::notifications
14 #
15 # Configure Notification System Options
16 #
17 # === Parameters
18 #
19 # [*notify_nova_on_port_status_changes*]
20 #   (optional) Send notification to nova when port status is active.
21 #   Defaults to true
22 #
23 # [*notify_nova_on_port_data_changes*]
24 #   (optional) Send notifications to nova when port data (fixed_ips/floatingips)
25 #   change so nova can update its cache.
26 #   Defaults to true
27 #
28 # [*send_events_interval*]
29 #   (optional) Number of seconds between sending events to nova if there are
30 #   any events to send.
31 #   Defaults to '2'
32 #
33 # [*nova_url*]
34 #   (optional) URL for connection to nova (Only supports one nova region
35 #   currently).
36 #   Defaults to 'http://127.0.0.1:8774/v2'
37 #
38 # [*nova_admin_auth_url*]
39 #   (optional) Authorization URL for connection to nova in admin context.
40 #   Defaults to 'http://127.0.0.1:35357/v2.0'
41 #
42 # [*nova_admin_username*]
43 #   (optional) Username for connection to nova in admin context
44 #   Defaults to 'nova'
45 #
46 # [*nova_admin_tenant_name*]
47 #   (optional) The name of the admin nova tenant
48 #   Defaults to 'services'
49 #
50 # [*nova_admin_tenant_id*]
51 #   (optional) The UUID of the admin nova tenant.  If provided this takes
52 #   precedence over nova_admin_tenant_name.
53 #
54 # [*nova_admin_password*]
55 #   (required) Password for connection to nova in admin context.
56 #
57 # [*nova_region_name*]
58 #   (optional) Name of nova region to use. Useful if keystone manages more than
59 #   one region.
60 #   Defaults to 'RegionOne'
61 #
62
63 class neutron::server::notifications (
64   $notify_nova_on_port_status_changes = true,
65   $notify_nova_on_port_data_changes   = true,
66   $send_events_interval               = '2',
67   $nova_url                           = 'http://127.0.0.1:8774/v2',
68   $nova_admin_auth_url                = 'http://127.0.0.1:35357/v2.0',
69   $nova_admin_username                = 'nova',
70   $nova_admin_tenant_name             = 'services',
71   $nova_admin_tenant_id               = undef,
72   $nova_admin_password                = false,
73   $nova_region_name                   = 'RegionOne',
74 ) {
75
76   # Depend on the specified keystone_user resource, if it exists.
77   Keystone_user <| title == 'nova' |> -> Class[neutron::server::notifications]
78
79   if ! $nova_admin_password {
80     fail('nova_admin_password must be set.')
81   }
82
83   if ! ( $nova_admin_tenant_id or $nova_admin_tenant_name ) {
84     fail('You must provide either nova_admin_tenant_name or nova_admin_tenant_id.')
85   }
86
87   neutron_config {
88     'DEFAULT/notify_nova_on_port_status_changes': value => $notify_nova_on_port_status_changes;
89     'DEFAULT/notify_nova_on_port_data_changes':   value => $notify_nova_on_port_data_changes;
90     'DEFAULT/send_events_interval':               value => $send_events_interval;
91     'DEFAULT/nova_url':                           value => $nova_url;
92     'DEFAULT/nova_admin_auth_url':                value => $nova_admin_auth_url;
93     'DEFAULT/nova_admin_username':                value => $nova_admin_username;
94     'DEFAULT/nova_admin_password':                value => $nova_admin_password, secret => true;
95     'DEFAULT/nova_region_name':                   value => $nova_region_name;
96   }
97
98   if $nova_admin_tenant_id {
99     neutron_config {
100       'DEFAULT/nova_admin_tenant_id': value => $nova_admin_tenant_id;
101     }
102   } else {
103     nova_admin_tenant_id_setter {'nova_admin_tenant_id':
104       ensure           => present,
105       tenant_name      => $nova_admin_tenant_name,
106       auth_url         => $nova_admin_auth_url,
107       auth_username    => $nova_admin_username,
108       auth_password    => $nova_admin_password,
109       auth_tenant_name => $nova_admin_tenant_name,
110     }
111   }
112 }