author | Luke Hoersten <luke@hoersten.org> |
Tue, 26 Nov 2019 19:44:11 -0600 | |
changeset 81 | 5fe7c52b2063 |
parent 75 | d8c87a41cc6d |
child 86 | 3dcdaac4adbf |
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 |
||
81 | 32 |
- name: install pleroma config |
60 | 33 |
template: |
81 | 34 |
src: "prod.secret.exs.j2" |
35 |
dest: "~{{pleroma_user}}/pleroma/config/prod.secret.exs" |
|
60 | 36 |
owner: "{{pleroma_user}}" |
37 |
group: "{{pleroma_user}}" |
|
81 | 38 |
mode: "0700" |
60 | 39 |
become: yes |
62
63586cf10d46
Added more config variables to pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
60
diff
changeset
|
40 |
notify: restart pleroma |
60 | 41 |
|
81 | 42 |
- name: install pleroma db schema file |
43 |
template: |
|
44 |
src: "setup_db.psql.j2" |
|
45 |
dest: "/tmp/setup_db.psql" |
|
46 |
owner: "{{pleroma_db_superuser}}" |
|
47 |
group: "{{pleroma_db_superuser}}" |
|
48 |
mode: "0700" |
|
49 |
become: yes |
|
50 |
||
60 | 51 |
- name: install pleroma psql |
52 |
become: yes |
|
66 | 53 |
become_user: "{{pleroma_db_superuser}}" |
81 | 54 |
command: "psql -f /tmp/setup_db.psql" |
62
63586cf10d46
Added more config variables to pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
60
diff
changeset
|
55 |
notify: restart pleroma |
75
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
56 |
|
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
57 |
# - name: restore |
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
58 |
# postgresql_db: |
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
59 |
# state: "restore" |
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
60 |
# db: "{{pleroma_user}}" |
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
61 |
# target: "/tmp/{{pleroma_user}}-backup.sql" |
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
62 |
# login_user: "{{pleroma_user}}" |
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
63 |
# login_password: "{{pleroma_db_passwd}}" |
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
64 |
# login_host: "{{pleroma_db_host}}" |
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
65 |
# when: "{{pleroma_restore_db}}" |
60 | 66 |
|
67 |
- name: migrate db |
|
68 |
become: yes |
|
69 |
become_user: "{{pleroma_user}}" |
|
70 |
command: "{{item}}" |
|
71 |
args: |
|
72 |
chdir: "~{{pleroma_user}}/pleroma/" |
|
73 |
with_items: |
|
74 |
- "mix local.hex --force" |
|
75 |
- "mix local.rebar --force" |
|
76 |
- "mix deps.get" |
|
74 | 77 |
- "mix ecto.migrate" |
62
63586cf10d46
Added more config variables to pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
60
diff
changeset
|
78 |
notify: restart pleroma |
65
4538ad030906
Moved mix commands to prod.
Luke Hoersten <luke@hoersten.org>
parents:
64
diff
changeset
|
79 |
environment: |
4538ad030906
Moved mix commands to prod.
Luke Hoersten <luke@hoersten.org>
parents:
64
diff
changeset
|
80 |
MIX_ENV: "prod" |
60 | 81 |
|
82 |
- name: install pleroma systemd service |
|
83 |
template: |
|
84 |
src: "pleroma.service.j2" |
|
67 | 85 |
dest: "/lib/systemd/system/{{pleroma_user}}.service" |
60 | 86 |
owner: "{{pleroma_user}}" |
87 |
group: "{{pleroma_user}}" |
|
88 |
mode: "0770" |
|
89 |
become: yes |
|
90 |
||
91 |
- name: enable pleroma systemd service |
|
67 | 92 |
systemd: name="{{pleroma_user}}" enabled="yes" state="started" |
60 | 93 |
become: yes |
75
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
94 |
|
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
95 |
|
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
96 |
# - name: backup db |
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
97 |
# postgresql_db: |
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
98 |
# state: "dump" |
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
99 |
# db: "{{pleroma_user}}" |
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
100 |
# target: "/tmp/{{pleroma_user}}-backup.sql" |
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
101 |
# login_user: "{{pleroma_user}}" |
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
102 |
# login_password: "{{pleroma_db_passwd}}" |
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
103 |
# login_host: "{{pleroma_db_host}}" |
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
104 |
|
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
105 |
|
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
106 |
|
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
107 |
|
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
108 |
|
d8c87a41cc6d
Pleroma role updates. Added Postgresql role.
Luke Hoersten <luke@hoersten.org>
parents:
74
diff
changeset
|
109 |
# pg_dump -U pleroma_nth_io -h pleroma.ctzpnw3lfkwz.us-east-1.rds.amazonaws.com pleroma_nth_io -f pleroma_nth_io_dump.sql |