-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsite.yml
executable file
·76 lines (64 loc) · 1.65 KB
/
site.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
#!/usr/bin/env ansible-playbook
---
- name: Provision an EC2 instance
hosts: localhost
connection: local
gather_facts: no
roles:
- provision_ec2
- userlist
post_tasks:
- name: Refresh EC2 inventory
shell: inventory/ec2.py --refresh-cache
- meta: refresh_inventory
- name: Create cookie_secret
shell: openssl rand -hex 1024 > ./security/cookie_secret
- name: Install and configure jupyterhub on it.
hosts: "tag_Project_{{ project }}:&tag_Name_{{ project }}"
connection: ssh
become: yes
gather_facts: no
vars_files:
- "group_vars/all"
pre_tasks:
- name: Install python in raw mode
raw: sudo apt-get install -y python
- name: Load usernames into memory
include_vars: "./userlist.yml"
no_log: yes
tags: addusers
- name: 'Add users to the server'
user:
name: "{{ item.username }}"
password: "{{ item.pwd | password_hash('sha512') }}"
with_items: "{{ users }}"
no_log: yes
tags: addusers
roles:
- role: cloudflare
when: cloudflare_token is defined and cloudflare_email is defined
tags: restart
- role: antoiner77.caddy
caddy_config: |
{{ domain }} {
proxy / localhost:8000 {
header_upstream Host {host}
header_upstream X-Real-IP {remote}
header_upstream X-Forwarded-Proto {scheme}
websocket
}
}
tags: caddy
- common
- python
- supervisor
- r
- julia
- jupyterhub
tasks:
- name: restart jupyterhub
supervisorctl:
name: jupyterhub
state: restarted
tags:
- restart