-
Notifications
You must be signed in to change notification settings - Fork 3
/
playbook.yml
144 lines (130 loc) · 3.2 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
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
- hosts: hierbautberlin
remote_user: "{{username}}"
vars:
- traefik_version: 2.4.8
tasks:
- name: Install all needed apt packages
apt:
name: "{{ packages }}"
become: true
vars:
packages:
- automake
- build-essential
- certbot
- fop
- gdal-bin
- imagemagick
- inotify-tools
- libncurses5
- libncurses5-dev
- libpng-dev
- libssh-dev
- libxml2-utils
- m4
- osmctools
- poppler-utils
- postgresql-12
- postgresql-12-postgis-3
- postgresql-server-dev-12
- python3-dev
- python3-pip
- python3-setuptools
- qpdf
- tmux
- ufw
- unixodbc-dev
- webp
- xsltproc
- name: Enable UFW
become: true
ufw: direction=incoming policy=deny state=enabled
- name: UFW open SSH
become: true
ufw: rule=allow port=ssh
- name: UFW open HTTP
become: true
ufw: rule=allow port=http
- name: UFW open HTTP
become: true
ufw: rule=deny port=8080
- name: UFW open HTTPs
become: true
ufw: rule=allow port=https
- name: Install all needed python packages
become: true
pip:
name:
- psycopg2
- pdfminer.six
- name: Create database user
become: true
become_user: postgres
postgresql_user:
name: hierbautberlin
password: "{{ lookup('env','DB_PASSWORD') }}"
role_attr_flags: CREATEDB,NOSUPERUSER
no_password_changes: true
- name: Create a new database with name "hierbautberlin" and specific encoding and locale
become: true
become_user: postgres
postgresql_db:
name: hierbautberlin
encoding: UTF-8
lc_collate: en_US.UTF-8
lc_ctype: en_US.UTF-8
- name: Adds citext to hierbautberlin database
become: true
become_user: postgres
postgresql_ext:
ext: citext
db: hierbautberlin
- name: Adds unaccent to hierbautberlin database
become: true
become_user: postgres
postgresql_ext:
ext: unaccent
db: hierbautberlin
- name: Adds fuzzystrmatch to hierbautberlin database
become: true
become_user: postgres
postgresql_ext:
ext: fuzzystrmatch
db: hierbautberlin
- import_tasks: traefik/playbook.yml
become: true
- name: Add hierbautberlin service
become: true
template:
src: [email protected]
dest: /etc/systemd/system/[email protected]
owner: root
group: root
mode: 0644
- name: Add hierbautberlin start on boot service
become: true
template:
src: hierbautberlin_start_on_boot.service.j2
dest: /etc/systemd/system/hierbautberlin_start_on_boot.service
owner: root
group: root
mode: 0644
- name: enable hierbautberlin_start_on_boot
become: true
systemd:
name: hierbautberlin_start_on_boot.service
enabled: true
- name: Add start_after_reboot script
template:
src: start_after_reboot.sh.j2
dest: /home/deploy/hierbautberlin/start_after_reboot.sh
owner: deploy
group: deploy
mode: 0755
handlers:
- name: traefik restart
become: true
systemd:
name: traefik
daemon_reload: true
state: restarted