blob: 86b10e85f3cf4536d89bc93b45ba0e6210b2beea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
---
- name: Get list of all containers
become: true
kolla_container_facts:
action: get_containers_names
container_engine: "{{ current_engine }}"
register: containers
- import_tasks: ovs-cleanup.yml
when:
- "'openvswitch_vswitchd' in containers.container_names"
- neutron_plugin_agent == 'openvswitch'
- name: Stop all containers
become: true
kolla_container:
action: "stop_container"
name: "{{ item }}"
container_engine: "{{ current_engine }}"
with_items: "{{ containers.container_names }}"
- name: Create directory for target container engine volumes
become: true
file:
path: "{{ engine_data[target_engine].volumes_dir }}"
state: directory
mode: "{{ engine_data[target_engine].volumes_mode }}"
- name: Find current container engine volumes
become: true
find:
paths: "{{ engine_data[current_engine].volumes_dir }}"
file_type: directory
register: container_volumes
# NOTE(r-krcek): The following block is workaround for problem where podman
# changes directory permissions after starting a container from any UID:GID
# to root after migration.
- block:
- name: Pre-create volumes in target engine
become: true
kolla_container:
action: "create_volume"
name: "{{ item.path | basename }}"
common_options: "{{ docker_common_options }}"
with_items: "{{ container_volumes.files }}"
- name: Move volumes to target_engine volume directory
vars:
target_path: "{{ engine_data[target_engine].volumes_dir }}/{{ item.path | basename }}"
source_path: "{{ item.path }}/_data"
become: true
command: "mv -f {{ source_path }} {{ target_path }}"
with_items: "{{ container_volumes.files }}"
- name: Cleanup volumes
file:
path: "{{ item.path }}"
state: absent
with_items: "{{ container_volumes.files }}"
when: container_volumes.matched > 0
# NOTE(mhiner): this prevents RabbitMQ failing to establish connection
# to other instances in multinode deployment
- name: Remove old Mnesia tables
become: true
file:
path: "{{ engine_data[target_engine].volumes_dir }}/rabbitmq/_data/mnesia"
state: absent
|