Skip to content

Commit eb28045

Browse files
committed
update opendistro migration tool to export to host directory
1 parent 1731bed commit eb28045

File tree

2 files changed

+44
-21
lines changed

2 files changed

+44
-21
lines changed

ansible/adhoc/migrate-opendistro.yml

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,16 @@
22
#
33
# Usage:
44
#
5-
# ansible-playbook ansible/adhoc/migrate-opendistro.yml
65
# git pull # and merge etc as required, including changing groups file to define opensearch not opendistro
7-
# ansible-playbook ansible/adhoc/generate-passwords.yml
6+
# ansible-playbook ansible/adhoc/migrate-opendistro.yml
87
# ansible-playbook ansible/monitoring.yml
98
#
109

11-
- hosts: opendistro
10+
- hosts: opensearch
1211
become: no
1312
gather_facts: no
1413
tasks:
15-
- name: Stop opendistro
16-
ansible.builtin.systemd:
17-
name: opendistro.service
18-
state: stopped
19-
enabled: false
20-
become: yes
21-
22-
- name: Make opensearch volume
23-
containers.podman.podman_volume:
14+
- name: Export opendistro volume
15+
import_role:
2416
name: opensearch
25-
become: yes
26-
become_user: "{{ opendistro_podman_user }}"
27-
28-
- name: Copy opendistro data
29-
shell:
30-
cmd: "podman volume export opendistro | podman volume import opensearch -"
31-
creates: "{{ appliances_local_users_podman_home }}.local/share/containers/storage/volumes/opensearch"
32-
become: yes
33-
become_user: "{{ opendistro_podman_user }}"
17+
tasks_from: migrate-opendistro.yml
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This relies on:
2+
# - open{distro,search}_podman_user being the same
3+
# - opendistro and opensearch hosts being the same
4+
5+
# NB: This deliberately does not remove the opendistro podman volume - do that manually once happy.
6+
7+
- name: Stop opendistro
8+
ansible.builtin.systemd:
9+
name: opendistro.service
10+
state: stopped
11+
enabled: false
12+
become: yes
13+
14+
- name: Export opendistro volume
15+
ansible.builtin.shell:
16+
cmd: podman volume export opendistro --output /tmp/opendistro_volume.tar
17+
creates: /tmp/opendistro_volume.tar
18+
become: yes
19+
become_user: "{{ opensearch_podman_user }}"
20+
21+
- name: Make opensearch data directory
22+
file:
23+
path: "{{ opensearch_data_path }}"
24+
state: directory
25+
owner: "{{ opensearch_podman_user }}"
26+
group: "{{ opensearch_podman_user }}"
27+
become: yes
28+
become_user: "{{ opensearch_podman_user }}"
29+
30+
- name: Unpack opendistro volume
31+
ansible.builtin.unarchive:
32+
remote_src: yes
33+
src: /tmp/opendistro_volume.tar
34+
dest: "{{ opensearch_data_path }}"
35+
owner: "{{ opensearch_podman_user }}"
36+
group: "{{ opensearch_podman_user }}"
37+
list_files: yes
38+
become: yes
39+
become_user: "{{ opensearch_podman_user }}"

0 commit comments

Comments
 (0)