Provision tasks updated

To support deployment of the latest Contrail 3.0 builds,
additional provision tasks added to plugin:
- provision contrail config
- provision contrail db
- provision contrail control refactored

Change-Id: Iae24a2d0f8f54654648d4104e87ad6ecad379225
This commit is contained in:
Oleksandr Martsyniuk 2016-02-23 17:17:17 -06:00
parent fd34c8c8af
commit c11370bea8
14 changed files with 235 additions and 52 deletions

View File

@ -15,4 +15,4 @@
notice('MODULAR: contrail/contrail-compute-provision.pp')
include contrail
class { 'contrail::compute::provision': }
class { 'contrail::provision::compute': }

View File

@ -0,0 +1,18 @@
# Copyright 2015 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
notice('MODULAR: contrail/contrail-config-provision.pp')
include contrail
class { 'contrail::provision::config': }

View File

@ -0,0 +1,18 @@
# Copyright 2015 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
notice('MODULAR: contrail/contrail-control-provision.pp')
include contrail
class { 'contrail::provision::control': }

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
notice('MODULAR: contrail/contrail-provision.pp')
notice('MODULAR: contrail/contrail-db-provision.pp')
include contrail
class { 'contrail::provision_contrail': }
class { 'contrail::provision::db': }

View File

@ -15,4 +15,4 @@
notice('MODULAR: contrail/controller-provision.pp')
include contrail
class { 'contrail::provision_controller': }
class { 'contrail::provision::controller': }

View File

@ -80,14 +80,4 @@ class contrail::control {
],
}
exec { 'prov_control_bgp':
command => "python /opt/contrail/utils/provision_control.py \
--api_server_ip ${contrail::contrail_mgmt_vip} --api_server_port 8082 \
--oper add --host_name ${::fqdn} --host_ip ${contrail::address} --router_asn ${contrail::asnum} \
--admin_user neutron --admin_tenant_name services --admin_password ${contrail::service_token} \
&& touch /opt/contrail/prov_control_bgp-DONE",
require => [Service['supervisor-control'],File['/etc/contrail/vnc_api_lib.ini']],
creates => '/opt/contrail/prov_control_bgp-DONE',
}
}

View File

@ -63,6 +63,9 @@ class contrail::controller {
'QUOTAS/quota_subnet': value => '-1';
'QUOTAS/quota_port': value => '-1';
} ->
file { '/etc/contrail/vnc_api_lib.ini':
content => template('contrail/vnc_api_lib.ini.erb')
} ->
file {'/etc/neutron/plugins/opencontrail/ContrailPlugin.ini':
content => template('contrail/ContrailPlugin.ini.erb'),
} ->
@ -96,7 +99,7 @@ class contrail::controller {
$ceilometer_enabled = $contrail::ceilometer_hash['enabled']
if ($ceilometer_enabled) {
# package { 'ceilometer-plugin-contrail': } ->
package { 'ceilometer-plugin-contrail': } ->
file {'/etc/ceilometer/pipeline.yaml':
ensure => file,
content => template('contrail/pipeline.yaml.erb'),

View File

@ -30,6 +30,10 @@ class contrail::database {
package { 'cassandra': } ->
package { 'contrail-openstack-database': }
# VNC API
file { '/etc/contrail/vnc_api_lib.ini':
content => template('contrail/vnc_api_lib.ini.erb')
}
# Zookeeper
file { '/etc/zookeeper/conf/myid':

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
class contrail::compute::provision {
class contrail::provision::compute {
Exec {
provider => 'shell',

View File

@ -12,24 +12,13 @@
# License for the specific language governing permissions and limitations
# under the License.
class contrail::provision_contrail {
class contrail::provision::config {
Exec {
provider => 'shell',
path => '/usr/bin:/bin:/sbin',
}
define contrail::provision::prov_ext_bgp {
exec { "prov_external_bgp_${name}":
command => "python /opt/contrail/utils/provision_mx.py \
--api_server_ip ${contrail::contrail_mgmt_vip} --api_server_port 8082 \
--oper add --router_name ${name} --router_ip ${name} \
--admin_user neutron --admin_tenant_name services --admin_password '${contrail::service_token}' \
&& touch /opt/contrail/prov_external_bgp_${name}-DONE",
creates => "/opt/contrail/prov_external_bgp_${name}-DONE",
}
}
notify {'Waiting for contrail API':} ->
exec {'wait_for_api':
@ -39,10 +28,25 @@ then exit 1; fi",
try_sleep => 10,
} ->
contrail::provision::prov_ext_bgp { $contrail::gateways:
require => Exec['wait_for_api'],
exec { 'prov_config_node':
command => "python /opt/contrail/utils/provision_config_node.py \
--api_server_ip ${contrail::contrail_mgmt_vip} --api_server_port 8082 \
--oper add --host_name ${::fqdn} --host_ip ${contrail::address} \
--admin_user neutron --admin_tenant_name services --admin_password ${contrail::service_token} \
&& touch /opt/contrail/prov_config_node-DONE",
creates => '/opt/contrail/prov_config_node-DONE',
} ->
exec { 'prov_analytics_node':
command => "python /opt/contrail/utils/provision_analytics_node.py \
--api_server_ip ${contrail::contrail_mgmt_vip} --api_server_port 8082 \
--oper add --host_name ${::fqdn} --host_ip ${contrail::address} \
--admin_user neutron --admin_tenant_name services --admin_password ${contrail::service_token} \
&& touch /opt/contrail/prov_analytics_node-DONE",
creates => '/opt/contrail/prov_analytics_node-DONE',
}
if $contrail::node_role == 'primary-contrail-config' {
exec { 'prov_metadata_services':
command => "python /opt/contrail/utils/provision_linklocal.py \
--api_server_ip ${contrail::contrail_mgmt_vip} --api_server_port 8082 \
@ -64,6 +68,6 @@ then exit 1; fi",
require => Exec['wait_for_api'],
creates => '/opt/contrail/prov_encap_type-DONE',
}
}
}

View File

@ -0,0 +1,58 @@
# Copyright 2015 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
class contrail::provision::control {
Exec {
provider => 'shell',
path => '/usr/bin:/bin:/sbin',
}
define contrail::provision::prov_ext_bgp {
exec { "prov_external_bgp_${name}":
command => "python /opt/contrail/utils/provision_mx.py \
--api_server_ip ${contrail::contrail_mgmt_vip} --api_server_port 8082 \
--oper add --router_name ${name} --router_ip ${name} \
--admin_user neutron --admin_tenant_name services --admin_password '${contrail::service_token}' \
&& touch /opt/contrail/prov_external_bgp_${name}-DONE",
creates => "/opt/contrail/prov_external_bgp_${name}-DONE",
}
}
notify {'Waiting for contrail API':} ->
exec {'wait_for_api':
command => "if [ `curl --silent --output /dev/null --write-out \"%{http_code}\" http://${contrail::contrail_mgmt_vip}:8082` -lt 401 ];\
then exit 1; fi",
tries => 10,
try_sleep => 10,
} ->
exec { 'prov_control_bgp':
command => "python /opt/contrail/utils/provision_control.py \
--api_server_ip ${contrail::contrail_mgmt_vip} --api_server_port 8082 \
--oper add --host_name ${::fqdn} --host_ip ${contrail::address} --router_asn ${contrail::asnum} \
--admin_user neutron --admin_tenant_name services --admin_password ${contrail::service_token} \
&& touch /opt/contrail/prov_control_bgp-DONE",
creates => '/opt/contrail/prov_control_bgp-DONE',
}
if $contrail::node_role == 'primary-contrail-control' {
contrail::provision::prov_ext_bgp { $contrail::gateways:
require => [Exec['wait_for_api'],Exec['prov_control_bgp']],
}
}
}

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
class contrail::provision_controller {
class contrail::provision::controller {
contrail::create_network{$contrail::private_net:
netdata => $contrail::nets[$contrail::private_net],
@ -23,11 +23,15 @@ contrail::create_network{$contrail::floating_net:
notify => Exec['prov_route_target'],
} ->
neutron_router{$contrail::default_router:
ensure => present,
internal_network => $contrail::private_net,
external_network => $contrail::floating_net,
tenant_name => $contrail::admin_tenant
neutron_router { $contrail::default_router:
ensure => 'present',
gateway_network_name => $contrail::floating_net,
name => $contrail::default_router,
tenant_name => $contrail::admin_tenant,
} ->
neutron_router_interface { "${contrail::default_router}:${contrail::private_net}__subnet":
ensure => 'present',
}
exec { 'prov_route_target':

View File

@ -0,0 +1,41 @@
# Copyright 2015 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
class contrail::provision::db {
Exec {
provider => 'shell',
path => '/usr/bin:/bin:/sbin',
}
notify {'Waiting for contrail API':} ->
exec {'wait_for_api':
command => "if [ `curl --silent --output /dev/null --write-out \"%{http_code}\" http://${contrail::contrail_mgmt_vip}:8082` -lt 401 ];\
then exit 1; fi",
tries => 10,
try_sleep => 10,
} ->
exec { 'prov_database_node':
command => "python /opt/contrail/utils/provision_database_node.py \
--api_server_ip ${contrail::contrail_mgmt_vip} --api_server_port 8082 \
--oper add --host_name ${::fqdn} --host_ip ${contrail::address} \
--admin_user neutron --admin_tenant_name services --admin_password ${contrail::service_token} \
&& touch /opt/contrail/prov_database_node-DONE",
creates => '/opt/contrail/prov_database_node-DONE',
}
}

View File

@ -128,6 +128,17 @@
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 1440
# Provision Primary Control config
- id: contrail-config-provision-primary
type: puppet
groups: [primary-contrail-config]
required_for: [deploy_end]
requires: [contrail-config-primary]
parameters:
puppet_manifest: puppet/manifests/contrail-config-provision.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 1440
# Perform same actions on other contrail-config nodes
- id: contrail-config-all
type: puppet
@ -139,6 +150,17 @@
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 1440
# Provision Control config
- id: contrail-config-provision
type: puppet
groups: [contrail-config]
required_for: [deploy_end]
requires: [contrail-config-all]
parameters:
puppet_manifest: puppet/manifests/contrail-config-provision.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 1440
# Install and configure Contrail Control Node
- id: contrail-control-primary
type: puppet
@ -150,15 +172,14 @@
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 1440
# Perform initial Contrail provisioning:
# provision BGP, encapsulation types and metadata services
- id: provision-contrail-control
# Provision Primary Contrail control
- id: contrail-control-provision-primary
type: puppet
groups: [primary-contrail-control]
required_for: [deploy_end]
requires: [contrail-control-all]
requires: [contrail-control-primary]
parameters:
puppet_manifest: puppet/manifests/contrail-provision.pp
puppet_manifest: puppet/manifests/contrail-control-provision.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 1440
@ -173,6 +194,28 @@
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 1440
# Provision Contrail control
- id: contrail-control-provision
type: puppet
groups: [contrail-control]
required_for: [deploy_end]
requires: [contrail-control-all]
parameters:
puppet_manifest: puppet/manifests/contrail-control-provision.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 1440
# Provision Control db
- id: contrail-db-provision
type: puppet
role: [primary-contrail-db,contrail-db]
required_for: [post_deployment_end]
requires: [post_deployment_start]
parameters:
puppet_manifest: puppet/manifests/contrail-db-provision.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 1440
# Configure default route on contrail nodes
- id: contrail-default-route
type: puppet
@ -267,7 +310,7 @@
type: puppet
role: [primary-controller]
required_for: [post_deployment_end]
requires: [openstack-network-networks]
requires: [openstack-controller-contrail-primary]
parameters:
puppet_manifest: puppet/manifests/controller-provision.pp
puppet_modules: puppet/modules:/etc/puppet/modules