Repository navigation
Expand file tree
/
Copy pathpgsql-remove.yml
More file actions
executable file
·59 lines (50 loc) · 2.37 KB
/
Copy pathpgsql-remove.yml
File metadata and controls
executable file
·59 lines (50 loc) · 2.37 KB
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
#!/usr/bin/env ansible-playbook
---
#==============================================================#
# File : pgsql-remove.yml
# Mtime : 2020-05-12
# Mtime : 2021-07-06
# Desc : remove pgsql from nodes
# Path : pgsql-remove.yml
# Copyright (C) 2018-2021 Ruohang Feng (rh@vonng.com)
#==============================================================#
#==============================================================#
# Playbook : Remove pgsql Cluster/Instance #
#==============================================================#
# Remove cluster `pg-test`
# pgsql-remove.yml -l pg-test
#
# Remove instance (10.10.10.13) among cluster `pg-test`
# pgsql-remove.yml -l 10.10.10.13
#
# Remove postgres data along with packages
# pgsql-remove.yml -e rm_pgdata=true -e rm_pgpkgs=true
#
# Register cluster/instance to infrastructure
# pgsql-remove.yml --tags=register # prometheus, grafana, nginx
# pgsql-remove.yml --tags=service # haproxy, vip
# pgsql-remove.yml --tags=monitor # pg_exporter, pgbouncer_exporter, node_exporter, promtail
# pgsql-remove.yml --tags=pgbouncer # pgbouncer
# pgsql-remove.yml --tags=postgres # postgres
#==============================================================#
# pgsql-remove.yml --tags=haproxy # remove haproxy
#------------------------------------------------------------------------------
# De-Register Cluster/Instance
#------------------------------------------------------------------------------
- name: Remove pgsql
become: yes
hosts: all
tags: remove
gather_facts: no
ignore_errors: yes
vars:
rm_dcs_server: true # remove dcs server? false by default
rm_pgdata: false # remove postgres data? false by default
rm_pgpkgs: false # uninstall pg_packages? false by default
# dcs_exists_action: clean # abort|skip|clean if dcs server already exists
# dcs_disable_purge: false # set to true to disable purge functionality for good (force dcs_exists_action = abort)
# pg_exists_action: clean # what to do when found running postgres instance ? (clean are JUST FOR DEMO! do not use this on production)
# pg_disable_purge: false # set to true to disable pg purge functionality for good (force pg_exists_action = abort)
roles:
- role: remove
...