-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsetup_jupyter.yml
196 lines (162 loc) · 4.95 KB
/
setup_jupyter.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
---
- name: "Setup Ansible-Jupyter"
hosts: localhost
vars:
# General package on GNU/Linux.
general_packages:
- bash
- bash-completion
- ca-certificates
- curl
- git
- openssl
- sshpass
# Alpine Linux.
apk_packages:
- openssh-client
- vim
# Debian, Ubuntu.
apt_packages: "{{ apk_packages }}"
# Arch Linux.
pacman_packages:
- openssh
- vim
# Gentoo Linux.
portage_packages:
- bash
- bash-completion
- ca-certificates
- dev-vcs/git
- net-misc/curl
- openssh
- openssl
- sqlite
- vim
# CentOS.
yum_packages:
- openssh-clients
- vim-minimal
# openSUSE.
zypper_packages: "{{ pacman_packages }}"
# Python.
pip_packages:
- docker-py
- docker-compose
jupyter_notebook_config_py_url: "https://raw.githubusercontent.com/chusiang/ansible-jupyter.dockerfile/master/files/jupyter_notebook_config.py"
ssh_private_key_url: "https://raw.githubusercontent.com/chusiang/ansible-jupyter.dockerfile/master/files/ssh/id_rsa"
ansible_cfg_url: "https://raw.githubusercontent.com/chusiang/ansible-jupyter.dockerfile/master/ansible.cfg"
inventory_url: "https://raw.githubusercontent.com/chusiang/ansible-jupyter.dockerfile/master/inventory"
tasks:
- name: Install necessary packages of Linux
block:
- name: Install general linux packages
package:
name: "{{ general_packages }}"
state: present
when:
- general_packages is defined
- ansible_pkg_mgr != "portage"
- name: Install apk packages on Alpine Linux
apk:
name: "{{ apk_packages }}"
state: present
when:
- apk_packages is defined
- ansible_pkg_mgr == "apk"
- name: Install apt packages on Debian and Ubuntu
apt:
name: "{{ apt_packages }}"
state: present
when:
- apt_packages is defined
- ansible_pkg_mgr == "apt"
- name: Install pacman packages on Arch Linux
pacman:
name: "{{ pacman_packages }}"
state: present
when:
- pacman_packages is defined
- ansible_pkg_mgr == "pacman"
- name: Install portage packages on Gentoo Linux
portage:
package: "{{ portage_packages }}"
state: present
when:
- portage_packages is defined
- ansible_pkg_mgr == "portage"
- name: Install yum packages on CentOS
yum:
name: "{{ yum_packages }}"
state: present
when:
- yum_packages is defined
- ansible_pkg_mgr == "yum"
- name: Install zypper packages on openSUSE
zypper:
name: "{{ zypper_packages }}"
state: present
when:
- zypper_packages is defined
- ansible_pkg_mgr == "zypper"
- name: Install necessary packages of Python
block:
- name: Install general pip packages
pip:
name: "{{ pip_packages }}"
state: present
when: pip_packages is defined
- name: Install pysqlite on gentoo
pip:
name: pysqlite
state: present
when:
- ansible_pkg_mgr == "portage"
- name: Upgrade six
pip:
name: six
state: latest
tags: skip_ansible_lint
- name: Install and configuration Jupyter (application)
block:
- name: Install jupyter
pip:
name: jupyter
version: 1.0.0
state: present
# Disable jupyter authentication token. (1/2)
- name: Create `/root/.jupyter` directory
file:
path: /root/.jupyter
state: directory
mode: 0700
# Disable jupyter authentication token. (2/2)
- name: Get jupyter_notebook_config.py
get_url:
url: "{{ jupyter_notebook_config_py_url }}"
dest: /root/.jupyter/jupyter_notebook_config.py
mode: 0644
checksum: md5:c663914a24281ddf10df6bc9e7238b07
- name: Integrate Ansible and Jupyter
block:
- name: Create `/root/.ssh` directory
file:
path: /root/.ssh
state: directory
mode: 0700
- name: Get ssh private key
get_url:
url: "{{ ssh_private_key_url }}"
dest: /root/.ssh/id_rsa
mode: 0600
checksum: md5:6cc26e77bf23a9d72a51b22387bea61f
- name: Get ansible.cfg file
get_url:
url: "{{ ansible_cfg_url }}"
dest: /home/
mode: 0644
- name: Get inventory file
get_url:
url: "{{ inventory_url }}"
dest: /home/
mode: 0644
# vim: ft=yaml.ansible :