Skip to content

Commit e017bd8

Browse files
authored
Merge pull request #13 from frischHWC/to-v2-0
To v2 0
2 parents 1734e56 + c76f81a commit e017bd8

File tree

10 files changed

+250
-402
lines changed

10 files changed

+250
-402
lines changed

README.adoc

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ One script to rule them all: CDP / CDP Private Cloud / CDH / HDP !
44

55
Given some machines, this script will **setup** all pre-requisites, **Install**, **Configure** a fully **secure** cluster and **Load Data** into it.
66

7+
8+
image:images/one-script-all.gif[Example of a basic launch]
9+
10+
711
## Table of tested Deployments
812

913
[.stripes-even, cols="1,1,4,1,1,1,1,4"]
@@ -12,16 +16,7 @@ Given some machines, this script will **setup** all pre-requisites, **Install**,
1216

1317
| ✓
1418
| basic
15-
| CDH 7.1.9.3 & CM 7.11.3.3
16-
| CENTOS 7.9
17-
| Postgres 14
18-
| MIT KDC
19-
| True
20-
|
21-
22-
| ✓
23-
| basic-enc
24-
| CDH 7.1.9.3 & CM 7.11.3.3
19+
| CDP 7.1.9.4 & CM 7.11.3.6
2520
| CENTOS 7.9
2621
| Postgres 14
2722
| MIT KDC
@@ -30,7 +25,7 @@ Given some machines, this script will **setup** all pre-requisites, **Install**,
3025

3126
| ✓
3227
| full
33-
| CDH 7.1.9.3 & CM 7.11.3.3
28+
| CDP 7.1.9.4 & CM 7.11.3.6
3429
| CENTOS 7.9
3530
| Postgres 14
3631
| MIT KDC
@@ -39,7 +34,7 @@ Given some machines, this script will **setup** all pre-requisites, **Install**,
3934

4035
| ✓
4136
| all-services
42-
| CDH 7.1.9.3 & CM 7.11.3.3
37+
| CDP 7.1.9.4 & CM 7.11.3.6
4338
| CENTOS 7.9
4439
| Postgres 14
4540
| MIT KDC
@@ -48,7 +43,7 @@ Given some machines, this script will **setup** all pre-requisites, **Install**,
4843

4944
| ✓
5045
| streaming
51-
| CDH 7.1.9.3 & CM 7.11.3.3
46+
| CDP 7.1.9.4 & CM 7.11.3.6 & CFM 2.1.6
5247
| CENTOS 7.9
5348
| Postgres 14
5449
| MIT KDC
@@ -57,17 +52,16 @@ Given some machines, this script will **setup** all pre-requisites, **Install**,
5752

5853
| ✓
5954
| cdp-streaming-with-efm
60-
| CDH 7.1.9.3 & CM 7.11.3.2
55+
| CDP 7.1.9.4 & CM 7.11.3.6 & CFM 2.1.6 & EFM 2.1.2
6156
| RHEL 8.8
6257
| Postgres 14
6358
| MIT KDC
6459
| True
65-
| YCLOUD
6660
| Use --jdk-version=17 (and a RHEL >= 8)
6761

6862
| ✓
6963
| cdp-observability
70-
| CDH 7.1.9.3 & CM 7.11.3
64+
| CDP 7.1.9.4 & CM 7.11.3.6
7165
| CENTOS 7.9
7266
| Postgres 14
7367
| MIT KDC
@@ -85,7 +79,7 @@ Given some machines, this script will **setup** all pre-requisites, **Install**,
8579

8680
| ✓
8781
| pvc
88-
| CDH 7.1.9.3 & CM 7.11.3.3 & PvC 1.5.2-h3
82+
| CDP 7.1.9.4 & CM 7.11.3.2 & PvC 1.5.3
8983
| CENTOS 7.9
9084
| Postgres 14
9185
| Free IPA
@@ -94,7 +88,7 @@ Given some machines, this script will **setup** all pre-requisites, **Install**,
9488

9589
| ✓
9690
| all-services-pvc
97-
| CDH 7.1.9.3 & CM 7.11.3.3 & PvC 1.5.2-h3
91+
| CDP 7.1.9.4 & CM 7.11.3.2 & PvC 1.5.3
9892
| CENTOS 7.9
9993
| Postgres 14
10094
| Free IPA
@@ -140,7 +134,7 @@ Given some machines, this script will **setup** all pre-requisites, **Install**,
140134

141135
|
142136
| basic
143-
| CDH 7.1.9.3 & CM 7.11.3.3
137+
| CDP 7.1.9.4 & CM 7.11.3.6
144138
| CENTOS 8.8
145139
| Postgres 14
146140
| MIT KDC
@@ -149,7 +143,7 @@ Given some machines, this script will **setup** all pre-requisites, **Install**,
149143

150144
|
151145
| full
152-
| CDH 7.1.9.3 & CM 7.11.3.3
146+
| CDP 7.1.9.4 & CM 7.11.3.6
153147
| CENTOS 8.8
154148
| Postgres 14
155149
| MIT KDC
@@ -158,7 +152,7 @@ Given some machines, this script will **setup** all pre-requisites, **Install**,
158152

159153
|
160154
| streaming
161-
| CDH 7.1.9.3 & CM 7.11.3.3
155+
| CDP 7.1.9.4 & CM 7.11.3.6 & CFM 2.1.6
162156
| CENTOS 8.8
163157
| Postgres 14
164158
| MIT KDC
@@ -167,7 +161,7 @@ Given some machines, this script will **setup** all pre-requisites, **Install**,
167161

168162
|
169163
| pvc
170-
| CDH 7.1.9.3 & CM 7.11.3.3 & PvC 1.5.2-h3
164+
| CDP 7.1.9.4 & CM 7.11.3.2 & PvC 1.5.3
171165
| CENTOS 8.8
172166
| Postgres 14
173167
| Free IPA

RELEASE_NOTES.adoc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# Releases Notes
22

3+
## v2.0
4+
5+
### New Features:
6+
7+
- Revamp of script to be good looking and easy to read
8+
- Add Gif on README
9+
- Update to latest versions
10+
- Support for EFM
11+
- Support for PvC 1.5.3
12+
- Datagen version 0.4.14
13+
14+
### WIP:
15+
16+
- Issue on stuck ansible connection when importing the cluster template => Need to relaunch the playbooks and stop stuck connection
17+
- Issue on Postgres 14 with RHEL 8 that needs to enable the service once failed and relaunch installation
18+
- Parameters for more network and disks settings on Cloud
19+
- PvC on AWS (Requires some PTR Records)
20+
321
## v1.2
422

523
### New Features:

ansible-cdp-all-services/cluster.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ clusters:
165165
ozone.service.id: "{{ cluster_name }}"
166166
ozone.scm.primordial.node.id: "{{ groups.cluster_master_nodes | first | default(omit) }}"
167167
ozone.administrators: "{{ default_admin_user }}"
168+
OZONE_MANAGER:
169+
ozone-conf/ozone-site.xml_role_safety_valve: <property><name>ozone.om.snapshot.load.native.lib</name><value>false</value></property>
168170

169171
SPARK_ON_YARN:
170172
SERVICEWIDE:

ansible-cdp-streaming/cluster.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,6 @@ clusters:
271271
repositories:
272272
- "{{ cdh_repo }}"
273273
- "{{ cfm_repo }}"
274-
- "{{ cem_repo }}"
275274

276275
baseCluster:
277276
name: "{{ cluster_name }}"

ansible-cdp-streaming/extra_vars.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ cloudera_manager_csds:
3131
- ${CSA_SSB_CSD}
3232
- ${CFM_CSD}
3333
- ${CFM_REGISTRY_CSD}
34-
- ${CEM_CSD}
3534
cloudera_manager_options:
3635
# set values to null to delete (and revert to default)
3736
custom_banner_html: ""

functions.sh

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
#!/bin/bash
20+
21+
# Print a spin
22+
#
23+
# Usage:
24+
# spin
25+
# ....
26+
# end_spin
27+
sp="/-\|"
28+
sc=0
29+
spin() {
30+
printf "\b${sp:sc++:1}"
31+
((sc==${#sp})) && sc=0
32+
}
33+
end_spin() {
34+
printf "\r%s\n" "$@"
35+
}
36+
37+
# Print a progress bar like that :
38+
# Progress : [########################################] 100%
39+
#
40+
# Usage:
41+
# progress_bar <progress> <max_progress>
42+
function progress_bar {
43+
if [ $1 -le $2 ]; then
44+
let _progress=(${1}*100/${2}*100)/100
45+
else
46+
let _one=($2 - 1)
47+
let _progress=(${_one}*100/${2}*100)/100
48+
fi
49+
let _done=(${_progress}*4)/10
50+
let _left=40-$_done
51+
52+
_fill=$(printf "%${_done}s")
53+
_empty=$(printf "%${_left}s")
54+
55+
printf "\rProgress : [${_fill// /#}${_empty// /-}] ${_progress}%%"
56+
57+
}
58+
59+
# Launch a playbook with retries, timeouts and prints its progress, and check if it succeeds or not
60+
#
61+
# Usage:
62+
# launch_playbook <playbook_name> "Success Message" "Error Message" <Expected_time_to_complete (Set it to 0, to print a spin instead of a progress bar)> <Timeout> <Number of retries> <true or false if it ahs to be launched remotely>
63+
#
64+
function launch_playbook() {
65+
local playbook=$1
66+
local success_message=$2
67+
local error_message=$3
68+
local expected_time=$4
69+
local command_timeout=$5
70+
local retry=$6
71+
local remote_launch=$7
72+
73+
local launch_tried=0
74+
local launch_failed=true
75+
local launch_timeout=false
76+
77+
while [ $launch_tried -le $retry ] ; do
78+
if [ $launch_tried -gt 0 ]; then
79+
logger info "Launching a retry because installation failed, retry is : #bold:$launch_tried out of $FREE_IPA_TRIES#end_bold possible tries"
80+
fi
81+
82+
if [ "${DEBUG}" = "true" ]
83+
then
84+
if [ "$remote_launch" = "true" ] ; then
85+
logger debug " Command launched on remote node: ansible-playbook -i hosts --extra-vars @environment/extra_vars.yml ${playbook}.yml ${ANSIBLE_PYTHON_3_PARAMS} "
86+
else
87+
logger debug " Command launched: ansible-playbook -i ${HOSTS_FILE} playbooks/${playbook}/main.yml --extra-vars \"@/tmp/${playbook}_extra_vars.yml\" ${ANSIBLE_PYTHON_3_PARAMS} "
88+
fi
89+
fi
90+
91+
if [ "$remote_launch" = "true" ] ; then
92+
log_file="${LOG_DIR}/deployment.log"
93+
logger info " Follow progression in: #underline:$log_file "
94+
ssh ${NODE_USER}@${NODE_0} "cd ~/deployment/ansible-repo/ ; ansible-playbook -i hosts --extra-vars @environment/extra_vars.yml ${playbook}.yml ${ANSIBLE_PYTHON_3_PARAMS}" >> $log_file 2>&1 &
95+
else
96+
log_file="${LOG_DIR}/${playbook}.log"
97+
cp playbooks/${playbook}/extra_vars.yml /tmp/${playbook}_extra_vars.yml
98+
envsubst < /tmp/${playbook}_extra_vars.yml > /tmp/${playbook}_extra_vars.yml.tmp && mv /tmp/${playbook}_extra_vars.yml.tmp /tmp/${playbook}_extra_vars.yml
99+
logger info " Follow progression in: #underline:$log_file "
100+
ansible-playbook -i ${HOSTS_FILE} playbooks/${playbook}/main.yml --extra-vars "@/tmp/${playbook}_extra_vars.yml" ${ANSIBLE_PYTHON_3_PARAMS} > $log_file 2>&1 &
101+
fi
102+
103+
local pid=$!
104+
local start=$SECONDS
105+
106+
if [ "${DEBUG}" = "true" ]
107+
then
108+
logger debug "pid is: $pid"
109+
fi
110+
111+
local duration=$(( SECONDS - start ))
112+
while [ $duration -lt $command_timeout ] ; do
113+
if [ $(ps -p $pid | wc -l) -eq 1 ] ; then
114+
break
115+
fi
116+
if [ $expected_time -gt 0 ] ; then
117+
progress_bar $duration $expected_time
118+
else
119+
spin
120+
fi
121+
sleep 0.5
122+
duration=$(( SECONDS - start ))
123+
done
124+
if [ $expected_time -gt 0 ] ; then
125+
end_spin
126+
fi
127+
if [ $duration -gt $command_timeout ] ; then
128+
launch_timeout=true
129+
fi
130+
131+
OUTPUT=$(tail -${ANSIBLE_LINES_NUMBER} $log_file | grep -A${ANSIBLE_LINES_NUMBER} RECAP | grep -v "failed=0" | wc -l | xargs)
132+
if [ "${OUTPUT}" == "2" ] && [ $launch_timeout = "false" ]
133+
then
134+
logger success "$success_message"
135+
logger info ""
136+
launch_failed=false
137+
break
138+
else
139+
logger warn " $error_message "
140+
if [ "${DEBUG}" = "true" ]
141+
then
142+
logger debug "Will kill process with pid: $pid"
143+
fi
144+
kill -9 $pid 2>&1 > /dev/null
145+
fi
146+
launch_tried=$((launch_tried + 1))
147+
# Not elegant but only workaround as of now for postgresql on RHEL 8
148+
if [ "$launch_timeout" = true ] && [ "$playbook" = "create_infrastructure" ] ; then
149+
ssh ${NODE_USER}@${NODE_0} "systemctl enable postresql-14"
150+
fi
151+
done
152+
if [ "${launch_failed}" == "true" ]
153+
then
154+
logger error "$error_message"
155+
logger error " See details in file: #underline:$log_file "
156+
exit 1
157+
fi
158+
159+
}

images/one-script-all.gif

1.98 MB
Loading

playbooks/user_creation/ranger_policies/policies/admin/nifi-registry.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
"/swagger",
1515
"/tenants",
1616
"/proxy",
17-
"/policies",
18-
"{{ user.name }}_*"
17+
"/policies"
1918
],
2019
"isExcludes": false,
2120
"isRecursive": false

playbooks/user_creation/ranger_policies/policies/admin/nifi.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
"/controller",
1919
"/tenants",
2020
"/provenance",
21-
"/policies",
22-
"/{{ user.name }}_*"
21+
"/policies"
2322
],
2423
"isExcludes": false,
2524
"isRecursive": false

0 commit comments

Comments
 (0)