-
Notifications
You must be signed in to change notification settings - Fork 2
/
down-shard.yml
42 lines (37 loc) · 1.01 KB
/
down-shard.yml
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
---
- hosts: vtnode
vars:
keyspace: test_keyspace
shard: 0
tasks:
- name: Find services
find:
paths: "{{ docker_compose_dir }}"
patterns: "vttablet-*"
file_type: directory
register: services
- name: Down all vttablet services
args:
chdir: "{{ item.path }}"
command: docker-compose down
with_items: "{{ services.files }}"
- name: Delete shard
delegate_to: "{{ groups['manage'][0] }}"
run_once: true
command: "lvtctl DeleteShard -recursive {{ keyspace }}/{{ shard }}"
- name: Initialize VSchema
delegate_to: "{{ groups['manage'][0] }}"
run_once: true
command: "lvtctl RebuildVSchemaGraph"
- name: Find data directories
find:
paths: "{{ vt_dir }}"
patterns: "vttablet-*"
file_type: directory
register: datas
- name: Delete data directories
file:
path: "{{ item.path }}"
state: absent
with_items: "{{ datas.files }}"
become: yes