-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup_spark_distribution.yml
44 lines (39 loc) · 1.72 KB
/
setup_spark_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 spark in installed
stat: "path=/home/{{ ansible_user }}/spark-{{ spark_version }}-bin-hadoop3/bin"
register: spark_installation_path
- name: Download spark distribution in master if not installed
get_url:
url: "https://dlcdn.apache.org/spark/spark-{{ spark_version }}/spark-{{ spark_version }}-bin-hadoop3.tgz"
dest: "/home/{{ ansible_user }}/spark-{{ spark_version }}-bin-hadoop3.tgz"
checksum: "sha512:{{ spark_sha512_checksum }}"
delegate_to: master
when: spark_installation_path.stat.isdir is not defined or not spark_installation_path.stat.isdir
throttle: 1
- name: Sync spark from master to worker nodes
ansible.posix.synchronize:
src: "/home/{{ ansible_user }}/spark-{{ spark_version }}-bin-hadoop3.tgz"
dest: "/home/{{ ansible_user }}/spark-{{ spark_version }}-bin-hadoop3.tgz"
mode: push
delegate_to: master
when:
- inventory_hostname != 'master'
- spark_installation_path.stat.isdir is not defined or not spark_installation_path.stat.isdir
become: no
- name: Decompress the spark distribution
unarchive:
src: "/home/{{ ansible_user }}/spark-{{ spark_version }}-bin-hadoop3.tgz"
dest: "/home/{{ ansible_user }}"
remote_src: yes
creates: "/home/{{ ansible_user }}/spark-{{ spark_version }}-bin-hadoop3/bin"
register: installation_task
- name: Delete the spark download if successfully installed
file:
path: "/home/{{ ansible_user }}/spark-{{ spark_version }}-bin-hadoop3.tgz"
state: absent
when: installation_task is succeeded or installation_task is skipped
- name: Symlink decompressed spark directory to spark home
file:
src: "/home/{{ ansible_user }}/spark-{{ spark_version }}-bin-hadoop3"
dest: "{{ spark_home }}"
state: link