From 702c99c96c5268de0606fb75f6f7d99eae070419 Mon Sep 17 00:00:00 2001 From: Vitalii Kovalchuk Date: Fri, 19 Feb 2016 11:58:31 +0200 Subject: [PATCH] Split deployment on compute role Change-Id: I6a9b881016a51444a114a56dbb4d9edd3062b59e --- ...config.pp => contrail-compute-firewall.pp} | 16 ++----- .../manifests/contrail-compute-network.pp | 18 ++++++++ .../puppet/manifests/contrail-compute-nova.pp | 18 ++++++++ .../manifests/contrail-compute-provision.pp | 18 ++++++++ ...mpute-repo.pp => contrail-compute-repo.pp} | 4 +- .../manifests/contrail-compute-vrouter.pp | 18 ++++++++ .../contrail/manifests/compute/firewall.pp | 43 +++++++++++++++++++ .../manifests/{ => compute}/network.pp | 18 ++++---- .../manifests/{compute.pp => compute/nova.pp} | 30 +------------ .../provision.pp} | 8 ++-- .../manifests/{ => compute}/vrouter.pp | 4 +- deployment_tasks.yaml | 40 ++++++++++++++++- tasks.yaml | 4 +- 13 files changed, 178 insertions(+), 61 deletions(-) rename deployment_scripts/puppet/manifests/{compute-config.pp => contrail-compute-firewall.pp} (60%) create mode 100644 deployment_scripts/puppet/manifests/contrail-compute-network.pp create mode 100644 deployment_scripts/puppet/manifests/contrail-compute-nova.pp create mode 100644 deployment_scripts/puppet/manifests/contrail-compute-provision.pp rename deployment_scripts/puppet/manifests/{compute-repo.pp => contrail-compute-repo.pp} (93%) create mode 100644 deployment_scripts/puppet/manifests/contrail-compute-vrouter.pp create mode 100644 deployment_scripts/puppet/modules/contrail/manifests/compute/firewall.pp rename deployment_scripts/puppet/modules/contrail/manifests/{ => compute}/network.pp (83%) rename deployment_scripts/puppet/modules/contrail/manifests/{compute.pp => compute/nova.pp} (66%) rename deployment_scripts/puppet/modules/contrail/manifests/{provision_compute.pp => compute/provision.pp} (89%) rename deployment_scripts/puppet/modules/contrail/manifests/{ => compute}/vrouter.pp (96%) diff --git a/deployment_scripts/puppet/manifests/compute-config.pp b/deployment_scripts/puppet/manifests/contrail-compute-firewall.pp similarity index 60% rename from deployment_scripts/puppet/manifests/compute-config.pp rename to deployment_scripts/puppet/manifests/contrail-compute-firewall.pp index 1626da40d..d473a944c 100644 --- a/deployment_scripts/puppet/manifests/compute-config.pp +++ b/deployment_scripts/puppet/manifests/contrail-compute-firewall.pp @@ -1,4 +1,4 @@ -# Copyright 2015 Mirantis, Inc. +# Copyright 2016 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 @@ -12,17 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -notice('MODULAR: contrail/compute-config.pp') +notice('MODULAR: contrail/contrail-compute-firewall.pp') -$node_role = 'compute' include contrail - -class { 'contrail::provision_compute': } -> -class { 'contrail::network': - node_role => $node_role, - address => $contrail::address, - ifname => $contrail::phys_dev, - netmask => $contrail::netmask_short, -} -> -class { 'contrail::compute': } -> -class { 'contrail::vrouter': } +class { 'contrail::compute::firewall': } diff --git a/deployment_scripts/puppet/manifests/contrail-compute-network.pp b/deployment_scripts/puppet/manifests/contrail-compute-network.pp new file mode 100644 index 000000000..b9adb6811 --- /dev/null +++ b/deployment_scripts/puppet/manifests/contrail-compute-network.pp @@ -0,0 +1,18 @@ +# Copyright 2016 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-compute-network.pp') + +include contrail +class { 'contrail::compute::network': } diff --git a/deployment_scripts/puppet/manifests/contrail-compute-nova.pp b/deployment_scripts/puppet/manifests/contrail-compute-nova.pp new file mode 100644 index 000000000..766c11049 --- /dev/null +++ b/deployment_scripts/puppet/manifests/contrail-compute-nova.pp @@ -0,0 +1,18 @@ +# Copyright 2016 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-compute-nova.pp') + +include contrail +class { 'contrail::compute::nova': } diff --git a/deployment_scripts/puppet/manifests/contrail-compute-provision.pp b/deployment_scripts/puppet/manifests/contrail-compute-provision.pp new file mode 100644 index 000000000..eb1e9233e --- /dev/null +++ b/deployment_scripts/puppet/manifests/contrail-compute-provision.pp @@ -0,0 +1,18 @@ +# Copyright 2016 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-compute-provision.pp') + +include contrail +class { 'contrail::compute::provision': } diff --git a/deployment_scripts/puppet/manifests/compute-repo.pp b/deployment_scripts/puppet/manifests/contrail-compute-repo.pp similarity index 93% rename from deployment_scripts/puppet/manifests/compute-repo.pp rename to deployment_scripts/puppet/manifests/contrail-compute-repo.pp index a9b4884d4..e7a5b8f85 100644 --- a/deployment_scripts/puppet/manifests/compute-repo.pp +++ b/deployment_scripts/puppet/manifests/contrail-compute-repo.pp @@ -1,4 +1,4 @@ -# Copyright 2015 Mirantis, Inc. +# Copyright 2016 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 @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -notice('MODULAR: contrail/compute-repo.pp') +notice('MODULAR: contrail/contrail-compute-repo.pp') file { '/etc/apt/preferences.d/contrail-pin-110': ensure => file, diff --git a/deployment_scripts/puppet/manifests/contrail-compute-vrouter.pp b/deployment_scripts/puppet/manifests/contrail-compute-vrouter.pp new file mode 100644 index 000000000..22945f1a1 --- /dev/null +++ b/deployment_scripts/puppet/manifests/contrail-compute-vrouter.pp @@ -0,0 +1,18 @@ +# Copyright 2016 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-compute-vrouter.pp') + +include contrail +class { 'contrail::compute::vrouter': } diff --git a/deployment_scripts/puppet/modules/contrail/manifests/compute/firewall.pp b/deployment_scripts/puppet/modules/contrail/manifests/compute/firewall.pp new file mode 100644 index 000000000..d1fb52996 --- /dev/null +++ b/deployment_scripts/puppet/modules/contrail/manifests/compute/firewall.pp @@ -0,0 +1,43 @@ +# 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::compute::firewall { + + $ipv4_file = $::operatingsystem ? { + 'Ubuntu' => '/etc/iptables/rules.v4', + 'CentOS' => '/etc/sysconfig/iptables', + } + + exec {'flush_nat': + command => '/sbin/iptables -t nat -F' + } -> + + firewall {'0000 metadata service': + source => '169.254.0.0/16', + iniface => 'vhost0', + action => 'accept' + } -> + + firewall {'0001 juniper contrail rules': + proto => 'tcp', + dport => ['2049','8085','9090','8102','33617','39704','44177','55970','60663'], + action => 'accept' + } -> + + exec { 'persist-firewall': + command => "/sbin/iptables-save > ${ipv4_file}", + user => 'root', + } + +} diff --git a/deployment_scripts/puppet/modules/contrail/manifests/network.pp b/deployment_scripts/puppet/modules/contrail/manifests/compute/network.pp similarity index 83% rename from deployment_scripts/puppet/modules/contrail/manifests/network.pp rename to deployment_scripts/puppet/modules/contrail/manifests/compute/network.pp index c7a1a4a5d..13494f365 100644 --- a/deployment_scripts/puppet/modules/contrail/manifests/network.pp +++ b/deployment_scripts/puppet/modules/contrail/manifests/compute/network.pp @@ -1,4 +1,4 @@ -# Copyright 2015 Mirantis, Inc. +# Copyright 2016 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 @@ -12,16 +12,16 @@ # License for the specific language governing permissions and limitations # under the License. -class contrail::network ( - $node_role, - $address, - $ifname = undef, - $netmask, +class contrail::compute::network { + $node_role = 'compute' + $address = $contrail::address + $ifname = $contrail::phys_dev + $netmask = $contrail::netmask_short $default_gw = undef - ) { + $br_file = $::operatingsystem ? { - 'Ubuntu' => '/etc/network/interfaces.d/ifcfg-br-mesh', - 'CentOS' => '/etc/sysconfig/network-scripts/ifcfg-br-mesh', + 'Ubuntu' => '/etc/network/interfaces.d/ifcfg-br-mesh', + 'CentOS' => '/etc/sysconfig/network-scripts/ifcfg-br-mesh', } Exec { diff --git a/deployment_scripts/puppet/modules/contrail/manifests/compute.pp b/deployment_scripts/puppet/modules/contrail/manifests/compute/nova.pp similarity index 66% rename from deployment_scripts/puppet/modules/contrail/manifests/compute.pp rename to deployment_scripts/puppet/modules/contrail/manifests/compute/nova.pp index 9f4882923..c0859cd09 100644 --- a/deployment_scripts/puppet/modules/contrail/manifests/compute.pp +++ b/deployment_scripts/puppet/modules/contrail/manifests/compute/nova.pp @@ -1,4 +1,4 @@ -# Copyright 2015 Mirantis, Inc. +# Copyright 2016 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 @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -class contrail::compute { +class contrail::compute::nova { nova_config { 'DEFAULT/neutron_url': value => "http://${contrail::mos_mgmt_vip}:9696"; @@ -31,30 +31,4 @@ class contrail::compute { enable => true, } - $ipv4_file = $::operatingsystem ? { - 'Ubuntu' => '/etc/iptables/rules.v4', - 'CentOS' => '/etc/sysconfig/iptables', - } - - exec {'flush_nat': - command => '/sbin/iptables -t nat -F' - } -> - - firewall {'0000 metadata service': - source => '169.254.0.0/16', - iniface => 'vhost0', - action => 'accept' - } -> - - firewall {'0001 juniper contrail rules': - proto => 'tcp', - dport => ['2049','8085','9090','8102','33617','39704','44177','55970','60663'], - action => 'accept' - } -> - - exec { 'persist-firewall': - command => "/sbin/iptables-save > ${ipv4_file}", - user => 'root', - } - } diff --git a/deployment_scripts/puppet/modules/contrail/manifests/provision_compute.pp b/deployment_scripts/puppet/modules/contrail/manifests/compute/provision.pp similarity index 89% rename from deployment_scripts/puppet/modules/contrail/manifests/provision_compute.pp rename to deployment_scripts/puppet/modules/contrail/manifests/compute/provision.pp index 6e294d6ff..35e169526 100644 --- a/deployment_scripts/puppet/modules/contrail/manifests/provision_compute.pp +++ b/deployment_scripts/puppet/modules/contrail/manifests/compute/provision.pp @@ -1,4 +1,4 @@ -# Copyright 2015 Mirantis, Inc. +# Copyright 2016 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 @@ -12,16 +12,18 @@ # License for the specific language governing permissions and limitations # under the License. -class contrail::provision_compute { +class contrail::compute::provision { Exec { provider => 'shell', path => '/bin:/sbin:/usr/bin:/usr/sbin', } - package { 'contrail-utils': ensure => present, } -> + file { '/opt/contrail': + ensure => 'directory', + } -> exec { 'provision-vrouter': command => "contrail-provision-vrouter \ --api_server_ip ${contrail::contrail_mgmt_vip} --api_server_port 8082 --openstack_ip ${contrail::mos_mgmt_vip} \ diff --git a/deployment_scripts/puppet/modules/contrail/manifests/vrouter.pp b/deployment_scripts/puppet/modules/contrail/manifests/compute/vrouter.pp similarity index 96% rename from deployment_scripts/puppet/modules/contrail/manifests/vrouter.pp rename to deployment_scripts/puppet/modules/contrail/manifests/compute/vrouter.pp index 6eabb4e82..005f0d017 100644 --- a/deployment_scripts/puppet/modules/contrail/manifests/vrouter.pp +++ b/deployment_scripts/puppet/modules/contrail/manifests/compute/vrouter.pp @@ -1,4 +1,4 @@ -# Copyright 2015 Mirantis, Inc. +# Copyright 2016 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 @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -class contrail::vrouter { +class contrail::compute::vrouter { class { 'contrail::package': install => ['contrail-openstack-vrouter','contrail-vrouter-dkms','iproute2','haproxy','libatm1'], diff --git a/deployment_tasks.yaml b/deployment_tasks.yaml index 4549eb1c1..467d39a96 100644 --- a/deployment_tasks.yaml +++ b/deployment_tasks.yaml @@ -254,12 +254,48 @@ puppet_modules: puppet/modules:/etc/puppet/modules timeout: 720 # Remove Open vSwitch packages, install and configure Contrail vRouter dkms kernel module -- id: compute-config +- id: contrail-compute-provision + type: puppet + role: [compute] + required_for: [post_deployment_end, contrail-compute-network] + requires: [post_deployment_start] + parameters: + puppet_manifest: puppet/manifests/contrail-compute-provision.pp + puppet_modules: puppet/modules:/etc/puppet/modules + timeout: 720 +- id: contrail-compute-network + type: puppet + role: [compute] + required_for: [post_deployment_end, contrail-compute-nova] + requires: [post_deployment_start] + parameters: + puppet_manifest: puppet/manifests/contrail-compute-network.pp + puppet_modules: puppet/modules:/etc/puppet/modules + timeout: 720 +- id: contrail-compute-nova + type: puppet + role: [compute] + required_for: [post_deployment_end, contrail-compute-firewall] + requires: [post_deployment_start] + parameters: + puppet_manifest: puppet/manifests/contrail-compute-nova.pp + puppet_modules: puppet/modules:/etc/puppet/modules + timeout: 720 +- id: contrail-compute-firewall + type: puppet + role: [compute] + required_for: [post_deployment_end, contrail-compute-vrouter] + requires: [post_deployment_start] + parameters: + puppet_manifest: puppet/manifests/contrail-compute-firewall.pp + puppet_modules: puppet/modules:/etc/puppet/modules + timeout: 720 +- id: contrail-compute-vrouter type: puppet role: [compute] required_for: [post_deployment_end] requires: [post_deployment_start] parameters: - puppet_manifest: puppet/manifests/compute-config.pp + puppet_manifest: puppet/manifests/contrail-compute-vrouter.pp puppet_modules: puppet/modules:/etc/puppet/modules timeout: 720 diff --git a/tasks.yaml b/tasks.yaml index 292bf9e30..11ab4e614 100644 --- a/tasks.yaml +++ b/tasks.yaml @@ -11,6 +11,6 @@ type: puppet stage: pre_deployment parameters: - puppet_manifest: puppet/manifests/compute-repo.pp + puppet_manifest: puppet/manifests/contrail-compute-repo.pp puppet_modules: puppet/modules:/etc/puppet/modules - timeout: 720 \ No newline at end of file + timeout: 720