]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/neutron/manifests/plugins/cisco.pp
try again, with puppetforge modules, correctly included now
[dsa-puppet.git] / 3rdparty / modules / neutron / manifests / plugins / cisco.pp
1
2 #
3 # Configure the cisco neutron plugin
4 # More info available here:
5 # https://wiki.openstack.org/wiki/Cisco-neutron
6 #
7 # === Parameters
8 #
9 # [*database_pass*]
10 # The password that will be used to connect to the db
11 #
12 # [*keystone_password*]
13 # The password for the supplied username
14 #
15 # [*database_name*]
16 # The name of the db table to use
17 # Defaults to neutron
18 #
19 # [*database_user*]
20 # The user that will be used to connect to the db
21 # Defaults to neutron
22 #
23 # [*database_host*]
24 # The address or hostname of the database
25 # Defaults to 127.0.0.1
26 #
27 # [*keystone_username*]
28 # The admin username for the plugin to use
29 # Defaults to neutron
30 #
31 # [*keystone_auth_url*]
32 # The url against which to authenticate
33 # Defaults to http://127.0.0.1:35357/v2.0/
34 #
35 # [*keystone_tenant*]
36 # The tenant the supplied user has admin privs in
37 # Defaults to services
38 #
39 # [*vswitch_plugin*]
40 # (optional) The openvswitch plugin to use
41 # Defaults to ovs_neutron_plugin.OVSNeutronPluginV2
42 #
43 # [*nexus_plugin*]
44 # (optional) The nexus plugin to use
45 # Defaults to undef. This will not set a nexus plugin to use
46 # Can be set to neutron.plugins.cisco.nexus.cisco_nexus_plugin_v2.NexusPlugin
47 #
48 # Other parameters are currently not used by the plugin and
49 # can be left unchanged, but in grizzly the plugin will fail
50 # to launch if they are not there. The config for Havana will
51 # move to a single config file and this will be simplified.
52
53 class neutron::plugins::cisco(
54   $keystone_password,
55   $database_pass,
56
57   # Database connection
58   $database_name     = 'neutron',
59   $database_user     = 'neutron',
60   $database_host     = '127.0.0.1',
61
62   # Keystone connection
63   $keystone_username = 'neutron',
64   $keystone_tenant   = 'services',
65   $keystone_auth_url = 'http://127.0.0.1:35357/v2.0/',
66
67   $vswitch_plugin = 'neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2',
68   $nexus_plugin   = undef,
69
70   # Plugin minimum configuration
71   $vlan_start        = '100',
72   $vlan_end          = '3000',
73   $vlan_name_prefix  = 'q-',
74   $model_class       = 'neutron.plugins.cisco.models.virt_phy_sw_v2.VirtualPhysicalSwitchModelV2',
75   $max_ports         = '100',
76   $max_port_profiles = '65568',
77   $manager_class     = 'neutron.plugins.cisco.segmentation.l2network_vlan_mgr_v2.L2NetworkVLANMgr',
78   $max_networks      = '65568',
79   $package_ensure    = 'present'
80 )
81 {
82   Neutron_plugin_cisco<||> ~> Service['neutron-server']
83   Neutron_plugin_cisco_db_conn<||> ~> Service['neutron-server']
84   Neutron_plugin_cisco_l2network<||> ~> Service['neutron-server']
85
86   ensure_resource('file', '/etc/neutron/plugins', {
87     ensure => directory,
88     owner  => 'root',
89     group  => 'neutron',
90     mode   => '0640'}
91   )
92
93   ensure_resource('file', '/etc/neutron/plugins/cisco', {
94     ensure => directory,
95     owner  => 'root',
96     group  => 'neutron',
97     mode   => '0640'}
98   )
99
100   # Ensure the neutron package is installed before config is set
101   # under both RHEL and Ubuntu
102   if ($::neutron::params::server_package) {
103     Package['neutron-server'] -> Neutron_plugin_cisco<||>
104     Package['neutron-server'] -> Neutron_plugin_cisco_db_conn<||>
105     Package['neutron-server'] -> Neutron_plugin_cisco_l2network<||>
106   } else {
107     Package['neutron'] -> Neutron_plugin_cisco<||>
108     Package['neutron'] -> Neutron_plugin_cisco_db_conn<||>
109     Package['neutron'] -> Neutron_plugin_cisco_l2network<||>
110   }
111
112   if $::operatingsystem == 'Ubuntu' {
113     file_line { '/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG':
114       path    => '/etc/default/neutron-server',
115       match   => '^NEUTRON_PLUGIN_CONFIG=(.*)$',
116       line    => "NEUTRON_PLUGIN_CONFIG=${::neutron::params::cisco_config_file}",
117       require => [ Package['neutron-server'], Package['neutron-plugin-cisco'] ],
118       notify  => Service['neutron-server'],
119     }
120   }
121
122   package { 'neutron-plugin-cisco':
123     ensure => $package_ensure,
124     name   => $::neutron::params::cisco_server_package,
125   }
126
127
128   if $nexus_plugin {
129     neutron_plugin_cisco {
130       'PLUGINS/nexus_plugin' : value => $nexus_plugin;
131     }
132   }
133
134   if $vswitch_plugin {
135     neutron_plugin_cisco {
136       'PLUGINS/vswitch_plugin' : value => $vswitch_plugin;
137     }
138   }
139
140   # neutron-server will crash if the inventory section is empty.
141   # this is usually used for specifying which physical nexus
142   # devices are to be used.
143   neutron_plugin_cisco {
144     'INVENTORY/dummy' : value => 'dummy';
145   }
146
147   neutron_plugin_cisco_db_conn {
148     'DATABASE/name': value => $database_name;
149     'DATABASE/user': value => $database_user;
150     'DATABASE/pass': value => $database_pass;
151     'DATABASE/host': value => $database_host;
152   }
153
154   neutron_plugin_cisco_l2network {
155     'VLANS/vlan_start':               value => $vlan_start;
156     'VLANS/vlan_end':                 value => $vlan_end;
157     'VLANS/vlan_name_prefix':         value => $vlan_name_prefix;
158     'MODEL/model_class':              value => $model_class;
159     'PORTS/max_ports':                value => $max_ports;
160     'PORTPROFILES/max_port_profiles': value => $max_port_profiles;
161     'NETWORKS/max_networks':          value => $max_networks;
162     'SEGMENTATION/manager_class':     value => $manager_class;
163   }
164
165   neutron_plugin_cisco_credentials {
166     'keystone/username': value => $keystone_username;
167     'keystone/password': value => $keystone_password, secret => true;
168     'keystone/auth_url': value => $keystone_auth_url;
169     'keystone/tenant'  : value => $keystone_tenant;
170   }
171
172   # In RH, this link is used to start Neutron process but in Debian, it's used only
173   # to manage database synchronization.
174   if defined(File['/etc/neutron/plugin.ini']) {
175     File <| path == '/etc/neutron/plugin.ini' |> { target => '/etc/neutron/plugins/cisco/cisco_plugins.ini' }
176   }
177   else {
178     file {'/etc/neutron/plugin.ini':
179       ensure  => link,
180       target  => '/etc/neutron/plugins/cisco/cisco_plugins.ini',
181       require => Package['neutron-plugin-cisco'],
182     }
183   }
184 }