-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathjava_home.yml
175 lines (149 loc) · 5.72 KB
/
java_home.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
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
---
- name: global_var | Initialize
set_fact:
scale_hdfs_nodes_list: []
scale_hdfs_namenodes_list: []
scale_hdfs_datanodes_list: []
- name: global_var | Collect all HDFS NameNodes
set_fact:
scale_hdfs_namenodes_list: "{{ item.namenodes | unique }}"
delegate_to: localhost
run_once: true
- name: global_var | Collect all HDFS DataNodes
set_fact:
scale_hdfs_datanodes_list: "{{ item.datanodes | unique }}"
delegate_to: localhost
run_once: true
- name: global_var | Get HDFS nodes
set_fact:
scale_hdfs_nodes_list: "{{ scale_hdfs_namenodes_list + scale_hdfs_datanodes_list }}"
- name: global_var | make unique HDFS nodes
set_fact:
scale_hdfs_nodes_list: "{{ scale_hdfs_nodes_list | unique }}"
- name: check | Check if atleast one hdfs node is configured
assert:
that:
- scale_hdfs_nodes_list|length > 0
fail_msg: "No hdfs nodes configured"
- name: global_var | Initialize
set_fact:
scale_hdfs_nodes_list: []
scale_hdfs_namenodes_list: []
scale_hdfs_datanodes_list: []
- name: global_var | Collect all HDFS NameNodes
set_fact:
scale_hdfs_namenodes_list: "{{ item.namenodes | unique }}"
delegate_to: localhost
run_once: true
- name: global_var | Collect all HDFS DataNodes
set_fact:
scale_hdfs_datanodes_list: "{{ item.datanodes | unique }}"
delegate_to: localhost
run_once: true
- name: global_var | Get HDFS nodes
set_fact:
scale_hdfs_nodes_list: "{{ scale_hdfs_namenodes_list + scale_hdfs_datanodes_list }}"
- name: global_var | make unique HDFS nodes
set_fact:
scale_hdfs_nodes_list: "{{ scale_hdfs_nodes_list | unique }}"
- name: check | Check if atleast one hdfs node is configured
assert:
that:
- scale_hdfs_nodes_list|length > 0
fail_msg: "No hdfs nodes configured"
- name: check | Fetch JAVA_HOME path
shell: echo $JAVA_HOME
register: java_path
when: ansible_fqdn in scale_hdfs_nodes_list or inventory_hostname in scale_hdfs_nodes_list
- name: check | Check JAVA_HOME path exist
stat:
path: "{{ java_path.stdout }}"
register: java_path_details
when: ansible_fqdn in scale_hdfs_nodes_list or inventory_hostname in scale_hdfs_nodes_list
- name: check | Assert JAVA_HOME path exist
assert:
that:
- java_path_details.stat.exists
fail_msg: The JAVA_HOME path does not exists !
when: ansible_fqdn in scale_hdfs_nodes_list or inventory_hostname in scale_hdfs_nodes_list
- name: check | Set path of JAVA_HOME
set_fact:
javahome_path: "{{ java_path.stdout }}"
when:
- ansible_fqdn in scale_hdfs_nodes_list or inventory_hostname in scale_hdfs_nodes_list
- name: check | verify JAVA
command: "ls {{ javahome_path }}/bin/java"
register: jvm_list
when:
- ansible_fqdn in scale_hdfs_nodes_list or inventory_hostname in scale_hdfs_nodes_list
- javahome_path|length > 0
- fail:
msg: "JAVA_HOME not set properly"
when:
- ansible_fqdn in scale_hdfs_nodes_list or inventory_hostname in scale_hdfs_nodes_list
- jvm_list.rc != 0
- name: check | get hdfs rpm dir
set_fact:
hdfs_rpm_dir: "hdfs_3.1.1.x"
- name: check | get hdfs rpm dir
set_fact:
hdfs_rpm_dir: "hdfs_3.2.2.x"
when:
- ansible_fqdn in scale_hdfs_nodes_list or inventory_hostname in scale_hdfs_nodes_list
- transparency_322_enabled|bool
ignore_errors: true
- debug:
msg: "hdfs_rpm_dir: {{ hdfs_rpm_dir}}"
- name: Check and fetch gpfs.hdfs-protocol version
shell:
rpm -qp "{{ scale_extracted_path }}/hdfs_rpms/rhel/{{ hdfs_rpm_dir }}/gpfs.hdfs-protocol-*.x86_64.rpm"
--qf '%{VERSION}.%{RELEASE}\n' | cut -d '.' -f -4
register: gpfs_hdfs_protocol_version
delegate_to: localhost
run_once: true
- debug:
msg: "gpfs_hdfs_protocol_version: {{ gpfs_hdfs_protocol_version.stdout }}"
- name: check | Fetch hdfs extracted tar
set_fact:
hdfs_dependency_jars_dir: "/opt/hadoop/jars/hadoop-3.1.4"
when:
- transparency_322_enabled|bool == False
- gpfs_hdfs_protocol_version.rc == 0
- gpfs_hdfs_protocol_version.stdout is version('3.1.1.19', '<')
- name: check | Fetch hdfs extracted tar
set_fact:
hdfs_dependency_jars_dir: "/opt/cloudera/parcels"
when:
- transparency_322_enabled|bool == False
- gpfs_hdfs_protocol_version.rc == 0
- gpfs_hdfs_protocol_version.stdout is version('3.1.1.18', '>')
- name: Check gpfs.hdfs-protocol version for standalone installation
fail:
msg: >
"Standalone installation of gpfs.hdfs-protocol version is not supported. It can only be upgraded"
" from gpfs.hdfs-protocol version 3.2.2-5. For additional information, refer to the documentation available at the following link:"
" https://www.ibm.com/docs/en/storage-scale-bda?topic=hdfs-setup-transparency-cluster."
when:
- ansible_fqdn in scale_hdfs_nodes_list or inventory_hostname in scale_hdfs_nodes_list
- transparency_322_enabled|bool
- gpfs_hdfs_protocol_version.rc == 0
- gpfs_hdfs_protocol_version.stdout is version('3.2.2.5', '<')
- debug:
msg: "hdfs_dependency_jars_dir: {{ hdfs_dependency_jars_dir }}"
when:
- transparency_322_enabled|bool == False
- name: check | verify dependency jars
command: "ls {{ hdfs_dependency_jars_dir }}"
register: dep_jars
when:
- ansible_fqdn in scale_hdfs_nodes_list or inventory_hostname in scale_hdfs_nodes_list
- transparency_322_enabled|bool == False
ignore_errors: true
- fail:
msg: >
"Dependency jars not exist in {{ hdfs_dependency_jars_dir }} directory, which are essential prerequisites, For further details, "
"please consult the documentation via the following link: https://www.ibm.com/docs/en/storage-scale-bda?topic=hdfs-setup"
when:
- ansible_fqdn in scale_hdfs_nodes_list or inventory_hostname in scale_hdfs_nodes_list
- transparency_322_enabled|bool == False
- dep_jars.rc != 0