Fixed pgsql permissions.
---
- name: add erland solutions key
become: yes
apt_key: url="http://packages.erlang-solutions.com/debian/erlang_solutions.asc"
- name: install erland solutions repo
become: yes
apt_repository: repo="deb http://binaries.erlang-solutions.com/debian buster contrib"
- name: update apt package cache
become: yes
apt: upgrade="dist" update_cache="yes" cache_valid_time="3600"
- name: install pleroma apt packages
become: yes
apt: name="{{pleroma_apt_packages}}"
- name: add users
become: yes
user: name="{{pleroma_user}}" shell="/bin/bash"
- name: checkout plemora
become: yes
become_user: "{{pleroma_user}}"
git:
repo: "https://git.pleroma.social/pleroma/pleroma.git"
dest: "~{{pleroma_user}}/pleroma"
version: "{{pleroma_version}}"
force: yes
- name: install pleroma config
template:
src: "prod.secret.exs.j2"
dest: "~{{pleroma_user}}/pleroma/config/prod.secret.exs"
owner: "{{pleroma_user}}"
group: "{{pleroma_user}}"
mode: "0700"
become: yes
notify: restart pleroma
- name: install pleroma db schema file
template:
src: "setup_db.psql.j2"
dest: "/tmp/setup_db.psql"
owner: "{{pleroma_db_superuser}}"
group: "{{pleroma_db_superuser}}"
mode: "0700"
become: yes
- name: install pleroma psql
become: yes
become_user: "{{pleroma_db_superuser}}"
command: "psql -f /tmp/setup_db.psql"
notify: restart pleroma
# - name: restore
# postgresql_db:
# state: "restore"
# db: "{{pleroma_user}}"
# target: "/tmp/{{pleroma_user}}-backup.sql"
# login_user: "{{pleroma_user}}"
# login_password: "{{pleroma_db_passwd}}"
# login_host: "{{pleroma_db_host}}"
# when: "{{pleroma_restore_db}}"
- name: migrate db
become: yes
become_user: "{{pleroma_user}}"
command: "{{item}}"
args:
chdir: "~{{pleroma_user}}/pleroma/"
with_items:
- "mix local.hex --force"
- "mix local.rebar --force"
- "mix deps.get"
- "mix ecto.migrate"
notify: restart pleroma
environment:
MIX_ENV: "prod"
- name: install pleroma systemd service
template:
src: "pleroma.service.j2"
dest: "/lib/systemd/system/{{pleroma_user}}.service"
owner: "{{pleroma_user}}"
group: "{{pleroma_user}}"
mode: "0770"
become: yes
- name: enable pleroma systemd service
systemd: name="{{pleroma_user}}" enabled="yes" state="started"
become: yes
# - name: backup db
# postgresql_db:
# state: "dump"
# db: "{{pleroma_user}}"
# target: "/tmp/{{pleroma_user}}-backup.sql"
# login_user: "{{pleroma_user}}"
# login_password: "{{pleroma_db_passwd}}"
# login_host: "{{pleroma_db_host}}"
# pg_dump -U pleroma_nth_io -h pleroma.ctzpnw3lfkwz.us-east-1.rds.amazonaws.com pleroma_nth_io -f pleroma_nth_io_dump.sql