-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathdeploy.yml
More file actions
231 lines (221 loc) · 6.76 KB
/
deploy.yml
File metadata and controls
231 lines (221 loc) · 6.76 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
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
- name: assert only one nvme drive
hosts: redpanda:client:control
tasks:
- set_fact:
nvme_device: '{{ hostvars[inventory_hostname].ansible_devices.keys() | map("regex_search", "nvme.*") | select("string") | list }}'
- assert:
that: '{{ nvme_device | length == 1 }}'
- set_fact:
nvme_device: '{{ "/dev/" + nvme_device[0] }}'
- name: mount nvme disk
hosts: redpanda:client:control
tasks:
- block:
- name: create xfs file system
filesystem:
fstype: xfs
dev: '{{ nvme_device }}'
- name: mount the device
mount:
path: /mnt/vectorized
src: '{{ nvme_device }}'
fstype: xfs
state: mounted
- name: change permissions of the mount point
file:
path: /mnt/vectorized
owner: ubuntu
group: ubuntu
- name: write nodes files
shell: |
rm -rf /mnt/vectorized/redpanda.nodes
{% for host in groups['redpanda'] %}
echo "{{ hostvars[host].private_ip }} {{ groups['redpanda'].index(host) }}" >> /mnt/vectorized/redpanda.nodes
{% endfor %}
rm -rf /mnt/vectorized/client.nodes
{% for host in groups['client'] %}
echo "{{ hostvars[host].private_ip }} {{ groups['client'].index(host) }}" >> /mnt/vectorized/client.nodes
{% endfor %}
- name: copy control scripts
hosts: redpanda:client
tasks:
- name: copy control scripts
copy:
src: control
dest: /mnt/vectorized/
mode: "preserve"
owner: ubuntu
group: ubuntu
- name: install redpanda
hosts: redpanda:client:control
vars:
deb_dir: "{{ lookup('env', 'DEB_DIR') }}"
deb_file_list: "{{ lookup('env', 'DEB_FILE_LIST') | split }}"
tasks:
- assert:
that:
- "deb_file_list | length > 0"
fail_msg: "Please set DEB_FILE_LIST env var to space delimited string of deb filenames."
- name: copy debs
copy:
src: "{{ deb_dir }}/{{ item }}"
dest: "/mnt/vectorized/{{ item }}"
loop: "{{ deb_file_list }}"
- name: install debs
become_user: root
shell: |
dpkg --force-confold -i /mnt/vectorized/{{ item }}
loop: "{{ deb_file_list }}"
- name: disable redpanda systemd service
systemd:
name: redpanda
state: stopped
enabled: no
- name: configure redpanda
hosts: redpanda
tasks:
- name: create redpanda data dir
file:
state: directory
path: /mnt/vectorized/redpanda/data
owner: ubuntu
group: ubuntu
- name: create redpanda coredump dir
file:
state: directory
path: /mnt/vectorized/redpanda/coredump
owner: ubuntu
group: ubuntu
- name: configure redpanda
shell: |
{% if hostvars[groups['redpanda'][0]].id == hostvars[inventory_hostname].id %}
rpk config bootstrap \
--id {{ groups['redpanda'].index(inventory_hostname) }} \
--self {{ hostvars[inventory_hostname].private_ip }}
{% else %}
rpk config bootstrap \
--id {{ groups['redpanda'].index(inventory_hostname) }} \
--self {{ hostvars[inventory_hostname].private_ip }} \
--ips {{ hostvars[groups['redpanda'][0]].private_ip }}
{% endif %}
rpk config set redpanda.default_topic_partitions 1
rpk config set redpanda.default_topic_replications 3
rpk config set redpanda.transaction_coordinator_replication 3
rpk config set redpanda.id_allocator_replication 3
rpk config set redpanda.enable_leader_balancer false
rpk config set redpanda.enable_auto_rebalance_on_node_add false
rpk config set redpanda.enable_idempotence true
rpk config set redpanda.enable_transactions true
rpk config set redpanda.data_directory "/mnt/vectorized/redpanda/data"
rpk config set rpk.coredump_dir "/mnt/vectorized/redpanda/coredump"
rpk redpanda mode production
rpk redpanda tune all
cp /etc/redpanda/redpanda.yaml /mnt/vectorized/redpanda.yaml
chown -R ubuntu:ubuntu /etc/redpanda
chown ubuntu:ubuntu /mnt/vectorized/redpanda.yaml
- name: upload ssh keys
hosts: control
tasks:
- name: check .ssh dir exists
file:
path: /home/ubuntu/.ssh
state: directory
owner: ubuntu
group: ubuntu
mode: 0700
- name: copy keys
copy:
src: ./id_ed25519
dest: /home/ubuntu/.ssh/id_ed25519
owner: ubuntu
group: ubuntu
mode: 0600
- name: add redpanda nodes to known hosts
shell: |
{% for host in groups['redpanda'] %}
ssh-keyscan {{ hostvars[host].private_ip }} >> /home/ubuntu/.ssh/known_hosts
{% endfor %}
- name: add client nodes to known hosts
shell: |
{% for host in groups['client'] %}
ssh-keyscan {{ hostvars[host].private_ip }} >> /home/ubuntu/.ssh/known_hosts
{% endfor %}
- name: install client dependencies
hosts: client
tasks:
- name: install dependencies
package:
name:
- python3-pip
- python3-flask
- python3-sh
- python3-confluent-kafka
- openjdk-11-jdk
- maven
state: present
update_cache: yes
- name: install control dependencies
hosts: control
tasks:
- name: install dependencies
package:
name:
- python3-pip
- python3-flask
- python3-sh
- python3-confluent-kafka
- gnuplot
state: present
update_cache: yes
- name: create experiments dir
file:
state: directory
path: /mnt/vectorized/experiments
owner: ubuntu
group: ubuntu
recurse: true
- name: create faults dir
file:
state: directory
path: /mnt/vectorized/faults
owner: ubuntu
group: ubuntu
recurse: true
- name: copy chaos harness
copy:
src: harness
dest: /mnt/vectorized/
owner: ubuntu
group: ubuntu
mode: 0600
- name: copy test suite config
copy:
src: suites
dest: /mnt/vectorized/
owner: ubuntu
group: ubuntu
mode: 0600
- name: preparing workload
hosts: client:control
tasks:
- name: copy workloads
copy:
src: workloads
dest: /mnt/vectorized/
owner: ubuntu
group: ubuntu
mode: 0600
- name: building workload
hosts: client
tasks:
- name: create workloads/logs dir
file:
state: directory
path: /mnt/vectorized/workloads/logs
owner: ubuntu
group: ubuntu
recurse: true
- name: build writing/app
shell: |
cd /mnt/vectorized/workloads/uber
mvn clean dependency:copy-dependencies package