diff --git a/deployment_scripts/puppet/manifests/configure_default_route.pp b/deployment_scripts/puppet/manifests/configure_default_route.pp new file mode 100644 index 0000000..45c15e7 --- /dev/null +++ b/deployment_scripts/puppet/manifests/configure_default_route.pp @@ -0,0 +1,51 @@ +# 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('fuel-plugin-influxdb-grafana: configure_default_route.pp') + +$fuel_version = 0 + hiera('fuel_version') + +if $fuel_version < 9.0 { + # The code below is a copy-paste from configure_default_route.pp in + # fuel-library (branch stable/8.0) + # Unfortunately we have no way to do otherwise since we need to support both + # MOS 8 and MOS 9 + $network_scheme = hiera_hash('network_scheme', {}) + $management_vrouter_vip = hiera('management_vrouter_vip') + $management_role = 'management' + $fw_admin_role = 'fw-admin' + + if ( $::l23_os =~ /(?i:centos6)/ and $::kernelmajversion == '3.10' ) { + $ovs_datapath_package_name = 'kmod-openvswitch-lt' + } + + $use_ovs_dkms_datapath_module = $::l23_os ? { + /(?i:redhat7|centos7)/ => false, + default => true + } + class { 'l23network' : + use_ovs => hiera('use_ovs', false), + use_ovs_dkms_datapath_module => $use_ovs_dkms_datapath_module, + ovs_datapath_package_name => $ovs_datapath_package_name, + } + + $new_network_scheme = configure_default_route($network_scheme, $management_vrouter_vip, $fw_admin_role, $management_role ) + notice ($new_network_scheme) + + if !empty($new_network_scheme) { + prepare_network_config($new_network_scheme) + $sdn = generate_network_config() + notify {'SDN': message => $sdn } + } +} diff --git a/deployment_scripts/puppet/manifests/hiera.pp b/deployment_scripts/puppet/manifests/hiera.pp index 7b0ef20..c8de42d 100644 --- a/deployment_scripts/puppet/manifests/hiera.pp +++ b/deployment_scripts/puppet/manifests/hiera.pp @@ -14,6 +14,8 @@ notice('fuel-plugin-lma-infrastructure-alerting: hiera.pp') +$fuel_version = 0 + hiera('fuel_version') + # Initialize network-related variables $network_scheme = hiera_hash('network_scheme') $network_metadata = hiera_hash('network_metadata') @@ -151,3 +153,7 @@ file { $hiera_file: ensure => file, content => $calculated_content, } + +if $fuel_version >= 9.0 { + class { '::osnailyfacter::netconfig::hiera_default_route' :} +} diff --git a/deployment_tasks.yaml b/deployment_tasks.yaml index b5d6a69..a59ad7d 100644 --- a/deployment_tasks.yaml +++ b/deployment_tasks.yaml @@ -10,7 +10,7 @@ - globals - tools - logging - - netconfig + - lma-alerting-netconfig - hosts - lma-alerting-hiera - lma-alerting-validate-certificate @@ -34,7 +34,7 @@ - globals - tools - logging - - netconfig + - lma-alerting-netconfig - hosts - lma-alerting-hiera - lma-alerting-firewall @@ -58,6 +58,23 @@ puppet_modules: puppet/modules:/etc/puppet/modules timeout: 120 +# We cannot use the legacy 'netconfig' task because it won't create the proper +# dependency on the virtual management router task. +- id: lma-alerting-netconfig + type: puppet + version: 2.0.0 + requires: [lma-alerting-hiera, virtual_ips] + required_for: [deploy_end, hosts] + cross-depends: + - name: virtual_ips + role: [primary-controller, controller] + parameters: + puppet_manifest: "/etc/puppet/modules/osnailyfacter/modular/netconfig/netconfig.pp" + puppet_modules: /etc/puppet/modules + timeout: 600 + reexecute_on: + - deploy_changes + - id: lma-alerting-validate-certificate type: puppet version: 2.0.0 @@ -74,7 +91,7 @@ - id: lma-alerting-firewall type: puppet version: 2.0.0 - requires: [netconfig, lma-alerting-hiera] + requires: [lma-alerting-netconfig, lma-alerting-hiera] required_for: [deploy_end] parameters: puppet_manifest: "puppet/manifests/firewall.pp" @@ -105,6 +122,20 @@ # Tasks definitions for post-deployment +# Configure the default gateway (required for MOS 8 only) +- id: lma-alerting-configure-default-route + type: puppet + version: 2.0.0 + role: [primary-infrastructure_alerting, infrastructure_alerting] + requires: [post_deployment_start] + required_for: [post_deployment_end] + parameters: + puppet_manifest: "puppet/manifests/configure_default_route.pp" + puppet_modules: /etc/puppet/modules + timeout: 120 + reexecute_on: + - deploy_changes + # This task needs to be reexecuted to reconfigure the no-quorum-policy every # time the cluster is scaled up or down - id: lma-alerting-enable-quorum