-
Notifications
You must be signed in to change notification settings - Fork 264
/
install.yml
executable file
·138 lines (116 loc) · 4.06 KB
/
install.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!/usr/bin/env ansible-playbook
---
#==============================================================#
# File : install.yml
# Desc : install everything on all nodes
# Ctime : 2021-01-19
# Mtime : 2023-02-20
# Path : install.yml
# Author : Ruohang Feng (rh@vonng.com)
# License : AGPLv3
#==============================================================#
#==============================================================#
# install.yml will interleave infra.yml & node.yml in following
# orders to set up everything in one pass
# - id : generate node & pgsql identity
# - ca : create self-signed CA on localhost
# - repo : create local yum repo on infra nodes
# - node-init : init node, haproxy & docker
# - infra : init nginx, dns, prometheus, grafana
# - node-monitor : init node-exporter promtail
# - etcd : init etcd (required for pgsql HA)
# - minio : init minio (optional)
# - pgsql : init pgsql
#
# Which is equivalent to the following 4 playbooks altogether:
# - infra.yml -l infra deploy infrastructure on group 'infra'
# - node.yml -l all init all nodes
# - etcd.yml -l etcd init etcd on group 'etcd' for pg ha
# - minio.yml -l minio init minio on group 'minio' for pg backup
# - pgsql.yml -l all init pgsql database clusters on all nodes
#==============================================================#
#---------------------------------------------------------------
# setup node & pgsql identity
#---------------------------------------------------------------
- name: IDENTITY
hosts: all
gather_facts: no
tags: id
roles:
- { role: node_id ,tags: node-id }
- { role: pg_id ,tags: pg-id ,when: pg_cluster is defined }
#---------------------------------------------------------------
# Setup local CA
#---------------------------------------------------------------
- name: CA
become: yes
hosts: localhost
gather_facts: no
tags: ca
roles: [ { role: ca } ]
#---------------------------------------------------------------
# bootstrap a local yum repo
#---------------------------------------------------------------
- name: REPO
become: yes
hosts: infra
gather_facts: no
tags: repo
roles: [ { role: repo } ]
#---------------------------------------------------------------
# init node , ca, docker
#---------------------------------------------------------------
- name: NODE INIT
become: yes
hosts: all
gather_facts: no
tags: node-init
roles:
- { role: node ,tags: node } # prepare node for pigsty
- { role: haproxy ,tags: haproxy } # init haproxy if enabled
#---------------------------------------------------------------
# init dns, nginx, prometheus, grafana
#---------------------------------------------------------------
- name: INFRA INIT
become: yes
hosts: infra
gather_facts: no
tags: infra
roles: [ { role: infra } ]
#---------------------------------------------------------------
# Node Monitor
#---------------------------------------------------------------
- name: NODE MONITOR
become: yes
hosts: all
gather_facts: no
tags: node-monitor
roles: [ { role: node_monitor } ]
#---------------------------------------------------------------
# ETCD INIT
#---------------------------------------------------------------
- name: ETCD INIT
become: yes
hosts: etcd
gather_facts: no
tags: etcd
roles: [ { role: etcd } ] # init etcd on fixed group 'etcd'
#---------------------------------------------------------------
# MINIO INIT
#---------------------------------------------------------------
- name: MINIO INIT
become: yes
hosts: minio
gather_facts: no
tags: minio
roles: [ { role: minio } ] # init minio on fixed group 'minio'
#---------------------------------------------------------------
# INIT PGSQL
#---------------------------------------------------------------
- name: PGSQL INIT # init pgsql on all nodes
become: yes # with pg_cluster defined
hosts: all
gather_facts: no
tags: pgsql
roles: [ { role: pgsql ,when: pg_cluster is defined } ]
...