pleroma/otp/tasks/instance.yaml
author Luke Hoersten <luke@hoersten.org>
Sat, 11 Feb 2023 10:49:06 -0600
changeset 209 81014d20e5b1
parent 185 11e3b643c6ef
child 237 c6c11084c802
permissions -rw-r--r--
Use rsync for nginx root copy.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
141
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     1
---
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     2
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     3
- name: install pleroma instance config
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     4
  template:
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     5
    src: "config.exs.j2"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     6
    dest: "/etc/pleroma/{{pleroma_instance}}.config.exs"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     7
    owner: "pleroma"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     8
    group: "pleroma"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     9
    mode: "0600"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    10
  become: yes
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    11
  notify: restart pleroma instance
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    12
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    13
- name: create instance data directory
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    14
  become: yes
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    15
  file:
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    16
    path: "{{item}}"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    17
    state: "directory"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    18
    owner: "pleroma"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    19
    group: "pleroma"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    20
    mode: "0755"
143
7d4a477be685 Updated pleroma to 2.2.0 and added new dep.
Luke Hoersten <luke@hoersten.org>
parents: 141
diff changeset
    21
  loop:
141
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    22
    - "{{pleroma_data_dir}}/{{pleroma_instance}}"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    23
    - "{{pleroma_data_dir}}/{{pleroma_instance}}/uploads"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    24
    - "{{pleroma_data_dir}}/{{pleroma_instance}}/static"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    25
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    26
- name: install pleroma db schema file
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    27
  become: yes
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    28
  template:
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    29
    src: "setup_db.psql.j2"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    30
    dest: "/tmp/setup_db_{{pleroma_instance}}.psql"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    31
    owner: "{{pleroma_db_superuser}}"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    32
    group: "{{pleroma_db_superuser}}"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    33
    mode: "0600"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    34
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    35
- name: install pleroma psql
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    36
  become: yes
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    37
  become_user: "{{pleroma_db_superuser}}"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    38
  command: "psql -f /tmp/setup_db_{{pleroma_instance}}.psql"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    39
  changed_when: false
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    40
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    41
- include_tasks: soapbox.yaml
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    42
  when: pleroma_soapbox
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    43
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    44
- name: ensure pleroma instance is enabled and started
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    45
  become: yes
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    46
  systemd: name="pleroma@{{pleroma_instance}}.service" enabled="yes" state="started"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    47
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    48
- name: migrate db
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    49
  become: yes
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    50
  become_user: "pleroma"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    51
  command: "/opt/pleroma/bin/pleroma_ctl migrate"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    52
  args:
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    53
    chdir: "/opt/pleroma/"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    54
  environment:
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    55
    PLEROMA_CONFIG_PATH: "/etc/pleroma/{{pleroma_instance}}.config.exs"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    56
  changed_when: false