-
Notifications
You must be signed in to change notification settings - Fork 27
/
playbook.yml
81 lines (70 loc) · 2.31 KB
/
playbook.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
---
- hosts: all
vars:
spark_home: /opt/spark
spark_pkg_name: spark-3.3.1-bin-hadoop3
spark_pkg_url: https://downloads.apache.org/spark/spark-3.3.1/spark-3.3.1-bin-hadoop3.tgz
tasks:
- name: Update all packages to the latest version
become: true
apt:
upgrade: dist
update_cache: yes
- name: Basic dependencies
become: true
apt:
name: ['software-properties-common', 'python3-software-properties', 'curl', 'git', 'vim']
state: latest
update_cache: yes
force_apt_get: true
- name: Install AdoptOpenJDK 11
become: true
block:
- name: Import keys
apt_key:
url: https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public
state: present
- name: Add repository
apt_repository:
repo: deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb xenial main
state: present
- name: Install package
apt:
name: ['adoptopenjdk-11-hotspot', 'ca-certificates']
state: latest
update_cache: yes
force_apt_get: true
- name: Clone classrom repository
git:
repo: 'https://github.com/luisbelloch/data_processing_course.git'
dest: '{{ ansible_env.HOME }}/data_processing_course'
- stat:
path: '/opt/{{ spark_pkg_name }}'
register: spark_dest
- name: Install SPARK
when: spark_dest.stat.islnk is not defined
block:
- name: Download Spark
become: true
unarchive:
src: '{{ spark_pkg_url }}'
dest: /opt
remote_src: yes
- name: Link to latest version
become: true
file:
state: link
src: '/opt/{{ spark_pkg_name }}'
dest: '{{ spark_home }}'
- name: Add Spark to PATH
lineinfile:
path: '{{ ansible_env.HOME }}/.bashrc'
line: 'export PATH=$PATH:/opt/{{ spark_pkg_name }}/bin'
- name: Set PySpark Python version to 3
lineinfile:
path: '{{ ansible_env.HOME }}/.bashrc'
line: 'export PYSPARK_PYTHON=python3'
# https://bugs.python.org/issue19846
- name: Update locale
become: true
command: update-locale LC_ALL=en_US.UTF-8