openstack-ansible-ops/leap-upgrades/upgrade-utilities/neutron-remove-old-containers.yml
git-harry b291961361 Fix neutron agent container removal
This change fixes the removal of neutron agent containers so that it no
longer relies on the containers existing on the deploy host.

The file `leapfrog_remove_remaining_old_containers` is only created on
the deploy host, when combined with the fact that the original task
couldn't fail, it resulted in the removal of the containers silently
failing on multi-node builds.

This change gets the list of containers from the file on the deploy host
before trying to delete them on all hosts.

Change-Id: Ic95187fd7e7ff93c796ce01f296cb06a16ba72bd
2017-07-27 21:14:49 +01:00

46 lines
1.4 KiB
YAML

---
# Copyright 2017, Rackspace US, 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.
- name: Remove the remnant neutron agent containers
hosts: "hosts"
gather_facts: false
user: root
tasks:
- name: Get list of old containers
command: "cat /etc/openstack_deploy/leapfrog_remove_remaining_old_containers"
run_once: true
delegate_to: localhost
register: old_containers
- name: Destroy old containers
command: "lxc-destroy -fn {{ item }}"
with_items: old_containers.stdout_lines
ignore_errors: true
# TODO: Improve l2 convergence too.
- name: Remove the reminent neutron agent containers
hosts: "neutron_agent[0]"
gather_facts: false
user: root
tasks:
- name: Rebalance neutron agents
shell: |
. /root/openrc
/opt/neutron-ha-tool.py --l3-agent-migrate --now --insecure
/opt/neutron-ha-tool.py --replicate-dhcp --now --insecure
args:
executable: /bin/bash