-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup_hadoop_distribution.yml
44 lines (39 loc) · 1.69 KB
/
setup_hadoop_distribution.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
---
- name: Check if hadoop in installed
stat: "path=/home/{{ ansible_user }}/hadoop-{{ hadoop_version }}/bin"
register: hadoop_installation_path
- name: Download hadoop distribution in master if not installed in host
get_url:
url: "https://dlcdn.apache.org/hadoop/common/hadoop-{{ hadoop_version }}/hadoop-{{ hadoop_version }}.tar.gz"
dest: "/home/{{ ansible_user }}/hadoop-{{ hadoop_version }}.tar.gz"
checksum: "sha512:{{ hadoop_sha512_checksum }}"
delegate_to: master
when: hadoop_installation_path.stat.isdir is not defined or not hadoop_installation_path.stat.isdir
throttle: 1
- name: Sync hadoop from master to worker nodes
ansible.posix.synchronize:
src: "/home/{{ ansible_user }}/hadoop-{{ hadoop_version }}.tar.gz"
dest: "/home/{{ ansible_user }}/hadoop-{{ hadoop_version }}.tar.gz"
mode: push
delegate_to: master
when:
- inventory_hostname != 'master'
- hadoop_installation_path.stat.isdir is not defined or not hadoop_installation_path.stat.isdir
become: no
- name: Decompress the hadoop distribution
unarchive:
src: "/home/{{ ansible_user }}/hadoop-{{ hadoop_version }}.tar.gz"
dest: "/home/{{ ansible_user }}"
remote_src: yes
creates: "/home/{{ ansible_user }}/hadoop-{{ hadoop_version }}/bin"
register: installation_task
- name: Remove local copy of hadoop download if successfully installed
file:
path: "/home/{{ ansible_user }}/hadoop-{{ hadoop_version }}.tar.gz"
state: absent
when: installation_task is succeeded or installation_task is skipped
- name: Symlink decompressed hadoop directory to hadoop home
file:
src: "/home/{{ ansible_user }}/hadoop-{{ hadoop_version }}"
dest: "{{ hadoop_home }}"
state: link