author | Luke Hoersten <luke@hoersten.org> |
Sun, 17 Nov 2019 08:51:19 -0600 | |
changeset 77 | e5c97510c1c0 |
parent 75 | d8c87a41cc6d |
child 81 | 5fe7c52b2063 |
permissions | -rw-r--r-- |
60 | 1 |
--- |
2 |
||
3 |
- name: add erland solutions key |
|
4 |
become: yes |
|
75
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
5 |
apt_key: url="http://packages.erlang-solutions.com/debian/erlang_solutions.asc" |
60 | 6 |
|
7 |
- name: install erland solutions repo |
|
8 |
become: yes |
|
75
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
9 |
apt_repository: repo="deb http://binaries.erlang-solutions.com/debian buster contrib" |
60 | 10 |
|
11 |
- name: update apt package cache |
|
12 |
become: yes |
|
13 |
apt: upgrade="dist" update_cache="yes" cache_valid_time="3600" |
|
14 |
||
73
3e6344570822
Fixed deprecated ansible syntax.
Luke Hoersten <luke@hoersten.org>
parents:
69
diff
changeset
|
15 |
- name: install pleroma apt packages |
60 | 16 |
become: yes |
73
3e6344570822
Fixed deprecated ansible syntax.
Luke Hoersten <luke@hoersten.org>
parents:
69
diff
changeset
|
17 |
apt: name="{{pleroma_apt_packages}}" |
60 | 18 |
|
19 |
- name: add users |
|
20 |
become: yes |
|
21 |
user: name="{{pleroma_user}}" shell="/bin/bash" |
|
22 |
||
23 |
- name: checkout plemora |
|
24 |
become: yes |
|
25 |
become_user: "{{pleroma_user}}" |
|
26 |
git: |
|
27 |
repo: "https://git.pleroma.social/pleroma/pleroma.git" |
|
28 |
dest: "~{{pleroma_user}}/pleroma" |
|
75
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
29 |
version: "{{pleroma_version}}" |
60 | 30 |
force: yes |
31 |
||
32 |
- name: install pleroma config files |
|
33 |
template: |
|
34 |
src: "{{item}}.j2" |
|
35 |
dest: "~{{pleroma_user}}/pleroma/config/{{item}}" |
|
36 |
owner: "{{pleroma_user}}" |
|
37 |
group: "{{pleroma_user}}" |
|
38 |
mode: "0775" |
|
39 |
become: yes |
|
40 |
with_items: |
|
41 |
- "setup_db.psql" |
|
64 | 42 |
- "prod.secret.exs" |
62
63586cf10d46
Added more config variables to pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
60
diff
changeset
|
43 |
notify: restart pleroma |
60 | 44 |
|
45 |
- name: install pleroma psql |
|
46 |
become: yes |
|
66 | 47 |
become_user: "{{pleroma_db_superuser}}" |
75
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
48 |
command: "psql -f ~{{pleroma_user}}/pleroma/config/setup_db.psql" |
62
63586cf10d46
Added more config variables to pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
60
diff
changeset
|
49 |
notify: restart pleroma |
75
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
50 |
|
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
51 |
# - name: restore |
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
52 |
# postgresql_db: |
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
53 |
# state: "restore" |
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
54 |
# db: "{{pleroma_user}}" |
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
55 |
# target: "/tmp/{{pleroma_user}}-backup.sql" |
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
56 |
# login_user: "{{pleroma_user}}" |
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
57 |
# login_password: "{{pleroma_db_passwd}}" |
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
58 |
# login_host: "{{pleroma_db_host}}" |
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
59 |
# when: "{{pleroma_restore_db}}" |
60 | 60 |
|
61 |
- name: migrate db |
|
62 |
become: yes |
|
63 |
become_user: "{{pleroma_user}}" |
|
64 |
command: "{{item}}" |
|
65 |
args: |
|
66 |
chdir: "~{{pleroma_user}}/pleroma/" |
|
67 |
with_items: |
|
68 |
- "mix local.hex --force" |
|
69 |
- "mix local.rebar --force" |
|
70 |
- "mix deps.get" |
|
74 | 71 |
- "mix ecto.migrate" |
62
63586cf10d46
Added more config variables to pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
60
diff
changeset
|
72 |
notify: restart pleroma |
65
4538ad030906
Moved mix commands to prod.
Luke Hoersten <luke@hoersten.org>
parents:
64
diff
changeset
|
73 |
environment: |
4538ad030906
Moved mix commands to prod.
Luke Hoersten <luke@hoersten.org>
parents:
64
diff
changeset
|
74 |
MIX_ENV: "prod" |
60 | 75 |
|
76 |
- name: install pleroma systemd service |
|
77 |
template: |
|
78 |
src: "pleroma.service.j2" |
|
67 | 79 |
dest: "/lib/systemd/system/{{pleroma_user}}.service" |
60 | 80 |
owner: "{{pleroma_user}}" |
81 |
group: "{{pleroma_user}}" |
|
82 |
mode: "0770" |
|
83 |
become: yes |
|
84 |
||
85 |
- name: enable pleroma systemd service |
|
67 | 86 |
systemd: name="{{pleroma_user}}" enabled="yes" state="started" |
60 | 87 |
become: yes |
75
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
88 |
|
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
89 |
|
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
90 |
# - name: backup db |
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
91 |
# postgresql_db: |
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
92 |
# state: "dump" |
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
93 |
# db: "{{pleroma_user}}" |
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
94 |
# target: "/tmp/{{pleroma_user}}-backup.sql" |
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
95 |
# login_user: "{{pleroma_user}}" |
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
96 |
# login_password: "{{pleroma_db_passwd}}" |
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
97 |
# login_host: "{{pleroma_db_host}}" |
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
98 |
|
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
99 |
|
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
100 |
|
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
101 |
|
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
102 |
|
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
103 |
# pg_dump -U pleroma_nth_io -h pleroma.ctzpnw3lfkwz.us-east-1.rds.amazonaws.com pleroma_nth_io -f pleroma_nth_io_dump.sql |