diff options
Diffstat (limited to 'mcp/config/states')
-rwxr-xr-x | mcp/config/states/maas | 12 | ||||
-rwxr-xr-x | mcp/config/states/neutron_compute | 4 | ||||
-rwxr-xr-x | mcp/config/states/openstack | 4 | ||||
-rwxr-xr-x | mcp/config/states/virtual_control_plane | 20 |
4 files changed, 35 insertions, 5 deletions
diff --git a/mcp/config/states/maas b/mcp/config/states/maas index eea3e0ef6..7ccf0188e 100755 --- a/mcp/config/states/maas +++ b/mcp/config/states/maas @@ -8,6 +8,7 @@ ############################################################################## CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x +ERASE_ENV=${ERASE_ENV:-0} # shellcheck disable=SC1090 source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/lib.sh" @@ -52,6 +53,17 @@ function maas_fixup() { return 0 } +# Optionally destroy MaaS machines from a previous run +if [ "${ERASE_ENV}" -gt 1 ]; then + dnodes=$(salt 'mas01*' --out yaml state.apply maas.machines.status | \ + grep -Pzo '\s+system_id: \K.+\n') + for node_system_id in ${dnodes}; do + salt -C 'mas01*' state.apply maas.machines.delete \ + pillar="{'system_id': '${node_system_id}'}" + sleep 30 + done +fi + # MaaS rack/region controller, node commissioning salt -C 'mas01*' cmd.run "add-apt-repository ppa:maas/stable" diff --git a/mcp/config/states/neutron_compute b/mcp/config/states/neutron_compute index f1285479e..c6b90e20d 100755 --- a/mcp/config/states/neutron_compute +++ b/mcp/config/states/neutron_compute @@ -9,6 +9,4 @@ CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x -salt -I 'neutron:compute' state.sls neutron || true -salt -I 'neutron:compute' file.append /etc/sudoers.d/neutron_sudoers \ - args='neutron ALL = (root) NOPASSWD: /usr/bin/neutron-rootwrap-daemon /etc/neutron/rootwrap.conf' +salt -I 'neutron:compute' state.sls neutron diff --git a/mcp/config/states/openstack b/mcp/config/states/openstack index 19cd41703..369e16504 100755 --- a/mcp/config/states/openstack +++ b/mcp/config/states/openstack @@ -26,7 +26,11 @@ salt -I 'keystone:server' state.sls keystone.client salt -I 'keystone:server' cmd.run ". /root/keystonercv3; openstack service list" salt -I 'glance:server' state.sls glance + +# apply nova state twice to complete broken db sync +salt -I 'nova:controller' state.sls nova salt -I 'nova:controller' state.sls nova + salt -I 'heat:server' state.sls heat salt -I 'cinder:controller' state.sls cinder diff --git a/mcp/config/states/virtual_control_plane b/mcp/config/states/virtual_control_plane index 43d152023..c355126f7 100755 --- a/mcp/config/states/virtual_control_plane +++ b/mcp/config/states/virtual_control_plane @@ -8,13 +8,25 @@ ############################################################################## CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x +ERASE_ENV=${ERASE_ENV:-0} # shellcheck disable=SC1090 source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/lib.sh" -# KVM, compute node prereqs (libvirt first), VCP deployment -salt -C 'kvm* or cmp*' cmd.run 'rm -f /etc/network/interfaces.d/*.cfg' +# Optionally destroy VCP VMs from a previous run +if [ "${ERASE_ENV}" -eq 1 ]; then + kvm_vms=$(salt --out yaml 'kvm*' virt.list_domains | \ + sed -e 's/- //g' -e 's/:.*$//g') + for line in ${kvm_vms}; do + if [[ "${line}" =~ ^kvm ]]; then + kvm_node=${line} + elif [ -n "${kvm_node}" ]; then + salt "${kvm_node}" virt.purge dirs=True "${line}" || true + fi + done +fi +# KVM, compute node prereqs (libvirt first), VCP deployment # patch the networking module for Debian based distros debian_ip_source=/usr/lib/python2.7/dist-packages/salt/modules/debian_ip.py salt -C 'kvm* or cmp*' file.line $debian_ip_source \ @@ -64,3 +76,7 @@ wait_for 10 "! 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} \ $(awk 'NR==1{print $2}' "$(eval echo "~${SUDO_USER}/.ssh/authorized_keys")")" + +# Disable proxy dhcp routes after installation +salt -C 'prx*' file.write /etc/dhcp/dhclient-enter-hooks.d/no-default-route \ + args='unset new_routers' |