pleroma/otp/tasks/instance.yaml
author Luke Hoersten <luke@hoersten.org>
Mon, 26 Jul 2021 16:08:03 -0500
changeset 175 5b2a3d2cce22
parent 143 7d4a477be685
child 185 11e3b643c6ef
permissions -rw-r--r--
Changing www root content does not require an nginx reload.
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
    - "{{pleroma_data_dir}}/{{pleroma_instance}}/static/emoji"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    26
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    27
- name: install pleroma db schema file
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    28
  become: yes
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    29
  template:
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    30
    src: "setup_db.psql.j2"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    31
    dest: "/tmp/setup_db_{{pleroma_instance}}.psql"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    32
    owner: "{{pleroma_db_superuser}}"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    33
    group: "{{pleroma_db_superuser}}"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    34
    mode: "0600"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    35
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    36
- name: install pleroma psql
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    37
  become: yes
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    38
  become_user: "{{pleroma_db_superuser}}"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    39
  command: "psql -f /tmp/setup_db_{{pleroma_instance}}.psql"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    40
  changed_when: false
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    41
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    42
- include_tasks: soapbox.yaml
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    43
  when: pleroma_soapbox
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    44
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    45
- name: ensure pleroma instance is enabled and started
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    46
  become: yes
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    47
  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
    48
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    49
- name: migrate db
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    50
  become: yes
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    51
  become_user: "pleroma"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    52
  command: "/opt/pleroma/bin/pleroma_ctl migrate"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    53
  args:
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    54
    chdir: "/opt/pleroma/"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    55
  environment:
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    56
    PLEROMA_CONFIG_PATH: "/etc/pleroma/{{pleroma_instance}}.config.exs"
0708c9c075fc Added proper reinstall logic for pleroma.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    57
  changed_when: false