Skip to content

Commit df0dfd0

Browse files
authored
BIGTOP-3702. Add puppet manifests for Ranger. (#1074)
1 parent 4060af8 commit df0dfd0

File tree

4 files changed

+382
-0
lines changed

4 files changed

+382
-0
lines changed

bigtop-deploy/puppet/hieradata/bigtop/cluster.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,4 +218,8 @@ gpdb::common::db_base_dir: "/data_gp"
218218
gpdb::common::master_db_port: "5432"
219219
gpdb::common::segment_db_port_prefix: "4000"
220220

221+
# Ambari
221222
ambari::agent::server_host: "%{hiera('bigtop::hadoop_head_node')}"
223+
224+
# Ranger
225+
ranger::admin::admin_password: "Admin01234"

bigtop-deploy/puppet/manifests/cluster.pp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@
133133
},
134134
phoenix => {
135135
library => ["phoenix-server"],
136+
},
137+
ranger => {
138+
master => ["ranger-server"],
136139
}
137140
}
138141

@@ -199,6 +202,7 @@
199202
"ambari",
200203
"bigtop_utils",
201204
"phoenix",
205+
"ranger",
202206
]
203207

204208
node_with_roles::deploy_module { $modules:
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more
2+
# contributor license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright ownership.
4+
# The ASF licenses this file to You under the Apache License, Version 2.0
5+
# (the "License"); you may not use this file except in compliance with
6+
# the License. You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
class ranger {
17+
18+
class deploy($roles) {
19+
if ('ranger-server' in $roles) {
20+
include ranger::prerequisites
21+
include ranger::admin
22+
}
23+
}
24+
25+
class prerequisites {
26+
# Before Facter 3.14.17, Rocky Linux 8 is detected as 'RedHat'.
27+
# At the time of writing, Facter 3.14.2 is installed on Rocky Linux 8 by default.
28+
# https://puppet.com/docs/pe/2019.8/osp/release_notes_facter.html#enhancements-3-14-17
29+
if ($operatingsystem == 'RedHat' and 0 <= versioncmp($operatingsystemmajrelease, '8')) {
30+
# For some reason, 'python3' doesn't seem to work on Rocky Linux 8.
31+
$python = 'python36'
32+
} else {
33+
$python = 'python3'
34+
}
35+
36+
package { ['postgresql-jdbc', 'postgresql-server', $python]:
37+
ensure => latest,
38+
}
39+
40+
exec { 'initdb':
41+
command => '/usr/bin/pg_ctl initdb -D /var/lib/pgsql/data',
42+
user => 'postgres',
43+
require => Package['postgresql-jdbc', 'postgresql-server', $python],
44+
}
45+
46+
service { 'postgresql':
47+
ensure => running,
48+
require => Exec['initdb'],
49+
}
50+
}
51+
52+
class admin($admin_password) {
53+
package { 'ranger-admin':
54+
ensure => latest,
55+
require => Class['ranger::prerequisites'],
56+
}
57+
58+
file { '/usr/lib/ranger-admin/install.properties':
59+
content => template('ranger/ranger-admin/install.properties'),
60+
require => Package['ranger-admin'],
61+
}
62+
63+
exec { '/usr/lib/ranger-admin/setup.sh':
64+
cwd => '/usr/lib/ranger-admin',
65+
environment => 'JAVA_HOME=/usr/lib/jvm/java-1.8.0',
66+
require => File['/usr/lib/ranger-admin/install.properties'],
67+
}
68+
69+
exec { '/usr/lib/ranger-admin/set_globals.sh':
70+
cwd => '/usr/lib/ranger-admin',
71+
environment => 'JAVA_HOME=/usr/lib/jvm/java-1.8.0',
72+
require => Exec['/usr/lib/ranger-admin/setup.sh'],
73+
}
74+
75+
exec { 'systemctl daemon-reload':
76+
path => ["/bin", "/usr/bin"],
77+
require => Exec['/usr/lib/ranger-admin/set_globals.sh'],
78+
}
79+
80+
service { 'ranger-admin':
81+
ensure => running,
82+
require => Exec['systemctl daemon-reload'],
83+
}
84+
}
85+
}

0 commit comments

Comments
 (0)