-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnamenode.yml
60 lines (48 loc) · 1.82 KB
/
namenode.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
- hosts: namenode
vars_files:
- hadoop_var.yml
tasks:
- file:
path: "/root/hadoop/Packages"
state: directory
- copy:
src: "/root/hadoop"
dest: "/root/hadoop"
- dnf:
name: "python3-dnf"
- dnf:
name: "/root/hadoop/hadoop/jdk-8u171-linux-x64.rpm"
disable_gpg_check: yes
- shell:
cmd: "rpm -i hadoop-1.2.1-1.x86_64.rpm --force"
chdir: "/root/hadoop/hadoop"
- file:
path: "/{{nn_folder}}"
state: "directory"
- blockinfile:
path: "/etc/hadoop/hdfs-site.xml"
insertafter: "<configuration>"
block: "<property>\n<name>dfs.name.dir</name>\n<value>{{nn_folder}}</value>\n</property>\n"
notify:
- Format Namenode
- debug:
var: x
- blockinfile:
path: "/etc/hadoop/core-site.xml"
insertafter: "<configuration>"
block:
"<property>
\n<name>fs.default.name</name>
\n<value>hdfs://{{ansible_facts['default_ipv4']['address']}}:{{nn_port_number}}</value>
\n</property>"
notify:
- Start Namenode
handlers:
- name: Format Namenode
ignore_errors: yes
shell:
cmd: "echo Y|hadoop namenode -format"
- name: Start Namenode
shell:
cmd: "hadoop-daemon.sh start namenode"
ignore_errors: yes