-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhadoop-setup.yml
135 lines (126 loc) · 3.51 KB
/
hadoop-setup.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
- name: "configuring NameNode"
hosts: name
vars_files:
- namenode-vars.yml
tasks:
- name: "Copy jdk to name node"
copy:
src: "{{ jdk }}"
dest: "/root/"
- name: "Copy hadoop to name node"
copy:
src: "{{ hadoop }}"
dest: "/root/"
- name: "Installing JDK"
shell: "rpm -ivh {{ jdk }}"
register: Java
ignore_errors: yes
- name: "Jdk Installation"
debug:
var: Java.stdout
- name: "Installing Hadoop"
shell: "rpm -ivh {{ hadoop }} --force"
register: Hadoop
ignore_errors: yes
- name: "Hadop Installation"
debug:
var: Hadoop.stdout
- name: "Disabling Firewall"
shell: "systemctl stop firewalld"
ignore_errors: True
- name: "Put SELinux in permissive mode"
selinux:
policy: targeted
state: permissive
- name: "creating a directory for namenode"
file:
name: "{{ directory_path }}"
state: directory
- name: "Configuring hdfs-site file"
blockinfile:
path: "{{ hdfs_path }}"
insertafter: "<configuration>"
block: |
<property>
<name>dfs.name.dir</name>
<value>{{ directory_path }}</value>
</property>
- name: "Configuring core-site file"
blockinfile:
path: "{{ core_path }}"
insertafter: "<configuration>"
block: |
<property>
<name>fs.default.name</name>
<value>hdfs://{{ ansible_facts['default_ipv4']['address'] }}:9001</value>
</property>
- name: "format namenode directory"
shell: "hadoop namenode -format -force -nonInteractive"
- name: Starting Namenode
shell: "hadoop-daemon.sh start namenode"
- name: NameNode
shell: "jps"
- name: "configuring DataNode"
hosts: data
vars_files:
- namenode-vars.yml
vars_prompt:
- name: master_ip
prompt: "Enter the IP Address of Master Node:"
private: no
tasks:
- name: "Copy jdk to data-node"
copy:
src: "{{ jdk }}"
dest: "/root/"
- name: "Copy hadoop to data-node"
copy:
src: "{{ hadoop }}"
dest: "/root/"
- name: "Installing JDK"
shell: "rpm -ivh {{ jdk }}"
register: Java
ignore_errors: yes
- name: "Jdk Installation"
debug:
var: Java.stdout
- name: "Installing Hadoop"
shell: "rpm -ivh {{ hadoop }} --force"
register: Hadoop
ignore_errors: yes
- name: "Hadop Installation"
debug:
var: Hadoop.stdout
- name: "Disabling Firewall"
shell: "systemctl stop firewalld"
ignore_errors: True
- name: "Put SELinux in permissive mode"
selinux:
policy: targeted
state: permissive
- name: "creating a directory for datanode"
file:
name: "{{ directory_path }}"
state: directory
- name: "Configuring hdfs-site file"
blockinfile:
path: "{{ hdfs_path }}"
insertafter: "<configuration>"
block: |
<property>
<name>dfs.data.dir</name>
<value>{{ directory_path }}</value>
</property>
- name: "Configuring core-site file"
blockinfile:
path: "{{ core_path }}"
insertafter: "<configuration>"
block: |
<property>
<name>fs.default.name</name>
<value>hdfs://{{ master_ip }}:9001</value>
</property>
- name: "Starting datanode"
shell: "hadoop-daemon.sh start datanode"
- name: DataNode
shell: "jps"