source: other-projects/hathitrust/vagrant-spark-hdfs-cluster/trunk/modules/hadoop/manifests/init.pp@ 30913

Last change on this file since 30913 was 30913, checked in by davidb, 7 years ago

Renaming to better represent what the cluster is designed for

File size: 2.8 KB
Line 
1class hadoop {
2
3exec { "download_hadoop":
4 # Download from nearby mirror, otherwise task can time-out
5 command => "wget -O /tmp/hadoop-2.7.3.tar.gz http://apache.mirror.amaze.com.au/hadoop/common/hadoop-2.7.3/hadoop-2.7.3.tar.gz",
6 # command => "wget -O /tmp/hadoop-2.7.3.tar.gz http://www-eu.apache.org/dist/hadoop/common/hadoop-2.7.3/hadoop-2.7.3.tar.gz",
7 path => $path,
8 user => $user,
9 group => $user,
10 unless => "ls ${install_dir} | grep hadoop-2.7.3",
11 require => Package["openjdk-7-jdk"]
12 }
13
14exec { "unpack_hadoop" :
15 command => "tar -zxf /tmp/hadoop-2.7.3.tar.gz -C ${install_dir}",
16 path => $path,
17 creates => "${hadoop_home}-2.7.3",
18 require => Exec["download_hadoop"]
19 }
20
21exec { "rename_hadoop" :
22 command => "ln -s ${install_dir}/hadoop-2.7.3 ${install_dir}/hadoop",
23 path => $path,
24 creates => "${hadoop_home}",
25 require => Exec["unpack_hadoop"]
26 }
27
28exec { 'chown_hadoop':
29 command => "/bin/chown -R ${user}:${group} ${hadoop_home}-2.7.3",
30 path => '/bin',
31 user => 'root',
32 require => Exec["rename_hadoop"]
33 }
34
35file {
36 "${hadoop_home}/etc/hadoop/slaves":
37 content => template('hadoop/slaves'),
38 mode => 644,
39 owner => $user,
40 group => $group,
41 require => Exec["chown_hadoop"]
42 }
43
44file {
45 "${hadoop_home}/etc/hadoop/masters":
46 content => template('hadoop/masters'),
47 mode => 644,
48 owner => $user,
49 group => $group,
50 require => Exec["chown_hadoop"]
51 }
52
53file {
54 "${hadoop_home}/etc/hadoop/core-site.xml":
55 content => template('hadoop/core-site.xml'),
56 mode => 644,
57 owner => $user,
58 group => $group,
59 require => Exec["chown_hadoop"]
60 }
61
62file {
63 "${hadoop_home}/etc/hadoop/mapred-site.xml":
64 content => template('hadoop/mapred-site.xml'),
65 mode => 644,
66 owner => $user,
67 group => $group,
68 require => Exec["chown_hadoop"]
69 }
70
71 file {
72 "${hadoop_home}/etc/hadoop/hdfs-site.xml":
73 content => template('hadoop/hdfs-site.xml'),
74 mode => 644,
75 owner => $user,
76 group => $group,
77 require => Exec["chown_hadoop"]
78 }
79
80file {
81 "${hadoop_home}/etc/hadoop/hadoop-env.sh":
82 content => template('hadoop/hadoop-env.sh'),
83 mode => 644,
84 owner => $user,
85 group => $group,
86 require => Exec["chown_hadoop"]
87 }
88
89file {
90 [ "${hadoop_home}/hadoop_store",
91 "${hadoop_home}/hadoop_store/hdfs",
92 "${hadoop_home}/hadoop_store/hdfs/namenode",
93 "${hadoop_home}/hadoop_store/hdfs/datanode"]:
94 ensure => 'directory',
95 owner => "${user}",
96 group => "${group}",
97 mode => 755,
98 require => Exec["chown_hadoop"]
99 }
100
101file {
102 "/home/${user}/.bashrc-setup-hadoop":
103 content => template('hadoop/setup-hadoop.bash'),
104 mode => 644,
105 owner => $user,
106 group => $group,
107 require => [ Exec["unpack_hadoop"], File["/home/${user}"] ]
108 }
109
110file_line { "setup_hadoop_home":
111 ensure => present,
112 path => "/home/${user}/.bashrc",
113 line => ". .bashrc-setup-hadoop",
114 require => [ Exec["unpack_hadoop"], File["/home/${user}"] ]
115 }
116
117
118
119}
120
Note: See TracBrowser for help on using the repository browser.