diff options
Diffstat (limited to 'mcp/config/states')
-rwxr-xr-x | mcp/config/states/baremetal_init | 8 | ||||
-rwxr-xr-x | mcp/config/states/networking_gw | 12 | ||||
-rwxr-xr-x | mcp/config/states/networks | 27 | ||||
-rwxr-xr-x | mcp/config/states/openstack_ha | 18 | ||||
-rwxr-xr-x | mcp/config/states/openstack_noha | 17 | ||||
-rwxr-xr-x | mcp/config/states/virtual_control_plane | 3 |
6 files changed, 63 insertions, 22 deletions
diff --git a/mcp/config/states/baremetal_init b/mcp/config/states/baremetal_init index ef2f78b70..c14772837 100755 --- a/mcp/config/states/baremetal_init +++ b/mcp/config/states/baremetal_init @@ -23,11 +23,15 @@ salt -C 'kvm* or cmp*' file.replace $debian_ip_source \ repl="\n if not __salt__['pkg.version']('vlan'):\n __salt__['pkg.install']('vlan')" salt -C 'kvm*' pkg.install bridge-utils -salt -C 'kvm*' state.apply linux.network +salt -C 'kvm*' state.apply linux.network,linux.system.kernel salt -C 'kvm* or cmp*' state.apply salt.minion -salt -C 'kvm* or cmp*' service.force_reload salt-minion salt -C 'cmp*' state.apply linux.system salt -C 'cmp*' state.apply linux.network || true + +# disable dhcp offered routes on compute nodes +salt -C 'cmp*' file.write /etc/dhcp/dhclient-enter-hooks.d/no-default-route \ + args='unset new_routers' + salt -C 'kvm* or cmp*' system.reboot wait_for 90.0 "salt -C 'kvm* or cmp*' test.ping" diff --git a/mcp/config/states/networking_gw b/mcp/config/states/networking_gw new file mode 100755 index 000000000..ea7c87b01 --- /dev/null +++ b/mcp/config/states/networking_gw @@ -0,0 +1,12 @@ +#!/bin/bash -e +############################################################################## +# Copyright (c) 2018 Mirantis Inc., Enea AB and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x + +salt -I 'neutron:gateway' cmd.run 'ifup --force --ignore-errors br-ex' diff --git a/mcp/config/states/networks b/mcp/config/states/networks index 5beabdb6a..222a0726d 100755 --- a/mcp/config/states/networks +++ b/mcp/config/states/networks @@ -9,17 +9,20 @@ CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x -# Determine public network based on external IPs from compute node -# NOTE: mask currently hardcoded to /24 -PUBLIC_NET=$(salt --out yaml -C 'I@nova:compute and *01*' pillar.get _param:external_address | \ - awk --re-interval '/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/{print $2; exit}') +source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/lib.sh" -[ -n "${PUBLIC_NET}" ] || PUBLIC_NET=$(salt --out yaml -C 'I@nova:compute and *01*' \ - pillar.get _param:openstack_compute_node01_external_address | \ - awk --re-interval '/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/{print $2; exit}') +PUBLIC_NET=$(get_nova_compute_pillar_data 'opnfv_net_public') +PUBLIC_NET_GATEWAY=$(get_nova_compute_pillar_data 'opnfv_net_public_gw') +POOL_START_IP=$(get_nova_compute_pillar_data 'opnfv_net_public_pool_start') +POOL_END_IP=$(get_nova_compute_pillar_data 'opnfv_net_public_pool_end') -[ -n "${PUBLIC_NET}" ] && PUBLIC_NET="${PUBLIC_NET%.*}.0/24" || PUBLIC_NET="10.16.0.0/24" +# Default values +PUBLIC_NET="${PUBLIC_NET:-10.16.0.0/24}" +PUBLIC_NET_GATEWAY="${PUBLIC_NET_GATEWAY:-10.16.0.1}" +POOL_START_IP="${POOL_START_IP:-10.16.0.130}" +POOL_END_IP="${POOL_END_IP:-10.16.0.254}" +# Print openstack status and setup network salt -C 'I@nova:controller and *01*' cmd.run ". /root/keystonercv3; \ openstack compute service list; \ openstack network agent list; \ @@ -27,8 +30,8 @@ salt -C 'I@nova:controller and *01*' cmd.run ". /root/keystonercv3; \ openstack volume service list" salt -C 'I@nova:controller and *01*' cmd.run ". /root/keystonercv3; \ openstack network create --external --default --provider-network-type flat \ - --provider-physical-network physnet1 floating_net" + --provider-physical-network physnet1 floating_net" salt -C 'I@nova:controller and *01*' cmd.run ". /root/keystonercv3; \ - openstack subnet create --gateway ${PUBLIC_NET%.*}.1 --no-dhcp \ - --allocation-pool start=${PUBLIC_NET%.*}.130,end=${PUBLIC_NET%.*}.254 \ - --network floating_net --subnet-range ${PUBLIC_NET} floating_subnet" + openstack subnet create --gateway ${PUBLIC_NET_GATEWAY} --no-dhcp \ + --allocation-pool start=${POOL_START_IP},end=${POOL_END_IP} \ + --network floating_net --subnet-range ${PUBLIC_NET} floating_subnet" diff --git a/mcp/config/states/openstack_ha b/mcp/config/states/openstack_ha index 62a965401..0bbf7cde5 100755 --- a/mcp/config/states/openstack_ha +++ b/mcp/config/states/openstack_ha @@ -46,17 +46,17 @@ salt -I 'nova:controller' state.sls nova -b 1 salt -I 'heat:server' state.sls heat -b 1 wait_for 5 "salt -I 'cinder:controller' state.sls cinder -b 1" -salt -I 'cinder:volume' state.sls cinder +wait_for 3 "salt -I 'cinder:volume' state.sls cinder" salt -I 'neutron:server' state.sls neutron -b 1 salt -I 'neutron:gateway' state.sls neutron.gateway salt -I 'nova:compute' state.sls nova -salt -I 'mongodb:server' state.sls mongodb || true -wait_for 90 "salt -C 'I@mongodb:server and *01*' cmd.run 'mongo localhost:27017/admin'" +salt -C 'I@mongodb:server and *01*' state.sls mongodb || true +wait_for 10 "salt -C 'I@mongodb:server and *01*' cmd.run 'mongo localhost:27017/admin'" salt -C 'I@mongodb:server and *01*' cmd.run 'mongo localhost:27017/admin --eval "rs.initiate()"' -salt -C 'I@mongodb:server and *01*' state.sls mongodb +salt -I 'mongodb:server' state.sls mongodb salt -I 'aodh:server' state.sls aodh -b 1 salt -I 'ceilometer:server' state.sls ceilometer @@ -65,6 +65,16 @@ salt -I 'ceilometer:agent' state.sls ceilometer salt -I 'horizon:server' state.sls horizon salt -I 'nginx:server' state.sls nginx,sphinx +# workaround for the pike horizon is missing css, FUEL-324 +salt -I 'horizon:server' file.symlink \ + /var/lib/openstack-dashboard/static \ + /usr/share/openstack-dashboard/static +salt -I 'horizon:server' cmd.run "/usr/share/openstack-dashboard/manage.py collectstatic --noinput" +salt -I 'horizon:server' cmd.run "/usr/share/openstack-dashboard/manage.py compress --force" +salt -I 'horizon:server' file.append /etc/openstack-dashboard/local_settings.py \ + "AVAILABLE_THEMES = [ ('default', 'Default', 'themes/default'),]" +salt -I 'horizon:server' service.reload apache2 + clstr_vip_addr=$(salt -C 'I@nginx:server and *01*' --out=yaml \ pillar.get _param:cluster_vip_address | awk '{print $2; exit}') salt -C 'I@nginx:server and *01*' cp.push \ diff --git a/mcp/config/states/openstack_noha b/mcp/config/states/openstack_noha index 0a278760d..9fc30bbf1 100755 --- a/mcp/config/states/openstack_noha +++ b/mcp/config/states/openstack_noha @@ -9,6 +9,9 @@ CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x +# shellcheck disable=SC1090 +source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/lib.sh" + salt -I 'nfs:server' file.mkdir /srv/nova/instances salt -I 'nfs:server' state.sls nfs salt -I 'nfs:client' state.sls nfs @@ -36,15 +39,25 @@ salt -I 'nova:controller' state.sls nova salt -I 'heat:server' state.sls heat salt -I 'cinder:controller' state.sls cinder -salt -I 'cinder:volume' state.sls cinder +wait_for 3 "salt -I 'cinder:volume' state.sls cinder" salt -I 'neutron:server' state.sls neutron salt -I 'nova:compute' state.sls nova -salt -I 'mongodb:server' state.sls mongodb || salt -I 'mongodb:server' state.sls mongodb +wait_for 3 "salt -I 'mongodb:server' state.sls mongodb" salt -I 'aodh:server' state.sls aodh salt -I 'ceilometer:server' state.sls ceilometer salt -I 'ceilometer:agent' state.sls ceilometer salt -I 'horizon:server' state.sls horizon + +# workaround for the pike horizon is missing css, FUEL-324 +salt -I 'horizon:server' file.symlink \ + /var/lib/openstack-dashboard/static \ + /usr/share/openstack-dashboard/static +salt -I 'horizon:server' cmd.run "/usr/share/openstack-dashboard/manage.py collectstatic --noinput" +salt -I 'horizon:server' cmd.run "/usr/share/openstack-dashboard/manage.py compress --force" +salt -I 'horizon:server' file.append /etc/openstack-dashboard/local_settings.py \ + "AVAILABLE_THEMES = [ ('default', 'Default', 'themes/default'),]" +salt -I 'horizon:server' service.reload apache2 diff --git a/mcp/config/states/virtual_control_plane b/mcp/config/states/virtual_control_plane index 0607b318b..338c4470f 100755 --- a/mcp/config/states/virtual_control_plane +++ b/mcp/config/states/virtual_control_plane @@ -59,10 +59,9 @@ salt -C 'E@^(?!cfg01|mas01|kvm|cmp00).*' cp.get_file \ "salt://maas/files/$(basename "${APT_CONF_D_CURTIN}")" "${APT_CONF_D_CURTIN}" wait_for 10 "salt -C 'E@^(?!cfg01|mas01|kvm|cmp00).*' state.apply salt" -wait_for 10 "salt -C 'E@^(?!cfg01|mas01|kvm|cmp00).*' service.force_reload salt-minion" wait_for 10.0 "salt -C 'E@^(?!cfg01|mas01|kvm|cmp00).*' state.apply linux,ntp" -wait_for 10 "salt -C 'E@^(?!cfg01|mas01|kvm|cmp00).*' ssh.set_auth_key ${SUDO_USER} \ +wait_for 10.0 "salt -C 'E@^(?!cfg01|mas01|kvm|cmp00).*' ssh.set_auth_key ${SUDO_USER} \ $(awk 'NR==1{print $2}' "$(eval echo "~${SUDO_USER}/.ssh/authorized_keys")")" # Disable proxy dhcp routes after installation |