/
install-ozone.yaml
193 lines (167 loc) · 5.37 KB
/
install-ozone.yaml
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
---
- hosts: 127.0.0.1
connection: local
tasks:
- name: Generate ozone-site.xml from ozone-site.yaml
tags:
- generate
make_hadoop_xml:
source_yaml: conf/settings.yaml
dest_xml: conf/auto_generated/ozone-site.xml
site_name: ozone_site
om_hosts: "{{ groups['om'] }}"
scm_hosts: "{{ groups['scm'] }}"
#------- Initialization common to all hosts ---------------------------------
- hosts: all
remote_user: root
vars_files:
- conf/settings.yaml
tasks:
- name: Ensure the hadoop group exists
group:
name: hadoop
state: present
- name: Ensure the hdfs user exists. The password below is insecure (hdfs).
user:
name: "hdfs"
password: '$6$OD.Syt41QaobNrf6$dAD.HWuFIbLEFqmRBBYm7uF2dbSo/i9MJ7.jMT9Z6aRAOo5PbaDnU7Qv3nOG2AAnUkqXwacznruzq/T8Ywa7g/'
groups: hadoop # Empty by default.
state: present
shell: /bin/bash # Defaults to /bin/bash
system: no # Defaults to no
createhome: yes # Defaults to yes
home: /home/hdfs # Defaults to /home/<username>
- name: Ensure the Ozone install directory exists and is owned by the hdfs user.
file:
path: "{{ install_base }}"
state: directory
owner: hdfs
group: hadoop
mode: 0755
- name: Extract the Ozone tarball.
unarchive:
src: "{{ ozone_tarball }}"
remote_src: no
dest: "{{ install_base }}"
force: yes
owner: hdfs
group: hadoop
- name: Copy ozone-site.xml
copy:
src: conf/auto_generated/ozone-site.xml
dest: "{{ ozone_home }}/etc/hadoop/"
force: yes
owner: hdfs
group: hadoop
- name: Update JAVA_HOME in hadoop-env.sh
lineinfile:
path: "{{ ozone_home }}/etc/hadoop/hadoop-env.sh"
regexp: "^# export JAVA_HOME="
line: "export JAVA_HOME={{ java_home }}"
- name: Remove old Ozone shell profile, if present
file:
path: /etc/profile.d/ozone.sh
state: absent
- name: Create an Ozone profile. This adds Ozone shell commands to the path for all users.
lineinfile:
path: /etc/profile.d/ozone.sh
line: 'export PATH="$PATH:{{ ozone_home }}/bin"'
state: present
create: yes
#----------- Initialize and start the SCM ------------------------------------
- hosts: scm
remote_user: root
vars_files:
- conf/settings.yaml
tasks:
- name: Ensure directory for SCM DB exists
file:
path: "{{ ozone_site['ozone.scm.db.dirs'] }}"
state: directory
owner: hdfs
group: hadoop
mode: 0700
- name: Initialize (format) the SCM. This is a no-op if already initialized.
command: bin/ozone scm --init
become: yes
become_user: hdfs
args:
chdir: "{{ ozone_home }}"
- name: Start the SCM
command: bin/ozone --debug --daemon start scm
become: yes
become_user: hdfs
async: 60 # Prevent SCM process from getting SIGHUP too soon.
poll: 1
args:
chdir: "{{ ozone_home }}"
#----------- Initialize and start the OM -------------------------------------
- hosts: om
remote_user: root
vars_files:
- conf/settings.yaml
tasks:
- name: Ensure directories for OM DB, OM Ratis log, and OM Ratis snapshots exist.
file:
path: "{{ item }}"
state: directory
owner: hdfs
group: hadoop
mode: 0700
loop:
- "{{ ozone_site['ozone.om.db.dirs'] }}"
- "{{ ozone_site['ozone.om.ratis.storage.dir'] }}"
- "{{ ozone_site['ozone.om.ratis.snapshot.dir'] }}"
- name: Initialize (format) the OM. This is a no-op if already initialized.
command: bin/ozone om --init
become: yes
become_user: hdfs
args:
chdir: "{{ ozone_home }}"
- name: Start the OM
command: bin/ozone --daemon start om
become: yes
become_user: hdfs
async: 60 # Prevent OM process from getting SIGHUP too soon.
poll: 1
args:
chdir: "{{ ozone_home }}"
#----------- Initialize and start the DataNodes ------------------------------
- hosts: datanodes
remote_user: root
vars_files:
- conf/settings.yaml
tasks:
- name: Ensure datanode.id dir, storage dirs, and Ratis log dir all exist.
file:
path: "{{ item }}"
state: directory
owner: hdfs
group: hadoop
mode: 0700
loop:
- "{{ ozone_site['ozone.scm.datanode.id.dir'] }}"
- "{{ ozone_site['dfs.datanode.data.dir'] }}"
- "{{ ozone_site['dfs.container.ratis.datanode.storage.dir'] }}"
- name: Start the datanodes
command: bin/ozone --daemon start datanode
become: yes
become_user: hdfs
async: 60 # Prevent DataNode process from getting SIGUP too soon.
poll: 1
args:
chdir: "{{ ozone_home }}"
#----------- Start the S3 Gateways ------------------------------
- hosts: s3gateways
remote_user: root
vars_files:
- conf/settings.yaml
tasks:
- name: Start the S3 Gateway processes
command: bin/ozone --daemon start s3g
become: yes
become_user: hdfs
async: 60 # Prevent the process from getting SIGUP too soon.
poll: 1
args:
chdir: "{{ ozone_home }}"