1 # == Class: midonet::neutron_plugin
3 # Install and configure Midonet Neutron Plugin. Please note that this manifest
4 # does not install the 'python-neutron-midonet-plugin' package, it only
5 # configures Neutron to do so needed for this deployment. Check out the
6 # MidoNet module to do so.
11 # IP address of the MidoNet api service
12 # [*midonet_api_port*]
13 # IP address of the MidoNet port service. MidoNet runs in a Tomcat, so 8080
15 # [*keystone_username*]
16 # Username from which midonet api will authenticate against Keystone (neutron
17 # service is desirable and defaulted)
18 # [*keystone_password*]
19 # Password from which midonet api will authenticate against Keystone
21 # Tenant from which midonet api will authenticate against Keystone (services
22 # tenant is desirable and defaulted)
24 # Whether 'midonet-db-manage' should run to create and/or syncrhonize the database
25 # with MidoNet specific tables. Defaults to false
29 # An example call would be:
31 # class {'neutron:plugins::midonet':
32 # midonet_api_ip => '23.123.5.32',
33 # midonet_api_port => '8080',
34 # keystone_username => 'neutron',
35 # keystone_password => '32kjaxT0k3na',
36 # keystone_tenant => 'services',
40 # You can alternatively use the Hiera's yaml style:
41 # neutron::plugin::midonet::midonet_api_ip: '23.213.5.32'
42 # neutron::plugin::midonet::port: '8080'
43 # neutron::plugin::midonet::keystone_username: 'neutron'
44 # neutron::plugin::midonet::keystone_password: '32.kjaxT0k3na'
45 # neutron::plugin::midonet::keystone_tenant: 'services'
46 # neutron::plugin::midonet::sync_db: true
50 # Midonet (http://MidoNet.org)
54 # Copyright (c) 2015 Midokura SARL, All Rights Reserved.
56 # Licensed under the Apache License, Version 2.0 (the "License");
57 # you may not use this file except in compliance with the License.
58 # You may obtain a copy of the License at
60 # http://www.apache.org/licenses/LICENSE-2.0
62 # Unless required by applicable law or agreed to in writing, software
63 # distributed under the License is distributed on an "AS IS" BASIS,
64 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
65 # See the License for the specific language governing permissions and
66 # limitations under the License.
68 class neutron::plugins::midonet (
69 $midonet_api_ip = '127.0.0.1',
70 $midonet_api_port = '8080',
71 $keystone_username = 'neutron',
72 $keystone_password = undef,
73 $keystone_tenant = 'services',
77 include ::neutron::params
79 Neutron_plugin_midonet<||> ~> Service['neutron-server']
81 ensure_resource('file', '/etc/neutron/plugins/midonet', {
88 # Ensure the neutron package is installed before config is set
89 # under both RHEL and Ubuntu
90 if ($::neutron::params::server_package) {
91 Package['neutron-server'] -> Neutron_plugin_midonet<||>
93 Package['neutron'] -> Neutron_plugin_midonet<||>
96 # Although this manifest does not install midonet plugin package because it
97 # is not available in common distro repos, this statement forces you to
98 # have an orchestrator/wrapper manifest that does that job.
99 Package[$::neutron::params::midonet_server_package] -> Neutron_plugin_midonet<||>
101 neutron_plugin_midonet {
102 'MIDONET/midonet_uri': value => "http://${midonet_api_ip}:${midonet_api_port}/midonet-api";
103 'MIDONET/username': value => $keystone_username;
104 'MIDONET/password': value => $keystone_password, secret =>true;
105 'MIDONET/project_id': value => $keystone_tenant;
108 if $::osfamily == 'Debian' {
109 file_line { '/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG':
110 path => '/etc/default/neutron-server',
111 match => '^NEUTRON_PLUGIN_CONFIG=(.*)$',
112 line => "NEUTRON_PLUGIN_CONFIG=${::neutron::params::midonet_config_file}",
113 require => [ Package['neutron-server'], Package[$::neutron::params::midonet_server_package] ],
114 notify => Service['neutron-server'],
118 # In RH, this link is used to start Neutron process but in Debian, it's used only
119 # to manage database synchronization.
120 if defined(File['/etc/neutron/plugin.ini']) {
121 File <| path == '/etc/neutron/plugin.ini' |> { target => $::neutron::params::midonet_config_file }
124 file {'/etc/neutron/plugin.ini':
126 target => $::neutron::params::midonet_config_file,
127 require => Package[$::neutron::params::midonet_server_package]
133 Package<| title == $::neutron::params::midonet_server_package |> ~> Exec['midonet-db-sync']
135 exec { 'midonet-db-sync':
136 command => 'midonet-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugin.ini upgrade head',
138 before => Service['neutron-server'],
139 subscribe => Neutron_config['database/connection'],