forked from vitabaks/autobase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
remove_cluster.yml
65 lines (62 loc) · 1.58 KB
/
remove_cluster.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
- hosts: postgres_cluster
vars:
remove_postgres: false # or 'true' to remove the database
remove_consul: false # or 'true' to remove the consul data
become: true
vars_files:
- vars/main.yml
- vars/{{ ansible_os_family }}.yml
tasks:
- name: Stop Patroni service
service:
name: patroni
state: stopped
enabled: false
ignore_errors: true
when: remove_postgres|bool
- name: Delete PostgreSQL database content
file:
path: "{{ postgresql_data_dir }}"
state: absent
when: remove_postgres|bool
- name: Delete PgBackRest repository
file:
# path: pgbackrest_conf global repo1-path
path: /var/lib/pgbackrest
state: absent
when: pgbackrest_install|bool
- name: Delete PgBackRest cron
file:
path: /etc/cron.d/pgbackrest
state: absent
when: pgbackrest_install|bool
- name: Stop Consul service
service:
name: consul
state: stopped
enabled: false
when: remove_consul|bool
- name: Delete Consul content
file:
path: "{{ consul_data_path }}"
state: absent
when: remove_consul|bool
- hosts: etcd_cluster
vars:
remove_etcd: false # or 'true' to remove the database
become: true
vars_files:
- vars/main.yml
tasks:
- name: Stop Etcd service
service:
name: etcd
state: stopped
enabled: false
- name: Delete Etcd content
file:
path: "{{ etcd_data_dir }}/member"
state: absent
when: remove_etcd|bool
...