pleroma/otp/tasks/instance.yaml
author Luke Hoersten <luke@hoersten.org>
Mon, 07 Oct 2024 15:25:37 -0500
changeset 238 bdbc88cb5078
parent 237 c6c11084c802
permissions -rw-r--r--
Lots of updates and fixes for Ubuntu 24.04 Noble.

---

- name: install pleroma instance config
  template:
    src: "config.exs.j2"
    dest: "/etc/pleroma/{{pleroma_instance}}.config.exs"
    owner: "pleroma"
    group: "pleroma"
    mode: "0600"
  become: yes
  notify: restart pleroma instance

- name: create instance data directory
  become: yes
  file:
    path: "{{item}}"
    state: "directory"
    owner: "pleroma"
    group: "pleroma"
    mode: "0755"
  loop:
    - "{{pleroma_data_dir}}/{{pleroma_instance}}"
    - "{{pleroma_data_dir}}/{{pleroma_instance}}/uploads"
    - "{{pleroma_data_dir}}/{{pleroma_instance}}/static"

- name: install pleroma db schema file
  become: yes
  template:
    src: "setup_db.psql.j2"
    dest: "/tmp/setup_db_{{pleroma_instance}}.psql"
    owner: "{{pleroma_db_superuser}}"
    group: "{{pleroma_db_superuser}}"
    mode: "0600"
  changed_when: false

- name: install pleroma psql
  become: yes
  become_user: "{{pleroma_db_superuser}}"
  command: "psql -f /tmp/setup_db_{{pleroma_instance}}.psql"
  changed_when: false

- include_tasks: soapbox.yaml
  when: pleroma_soapbox

- name: ensure pleroma instance is enabled and started
  become: yes
  systemd: name="pleroma@{{pleroma_instance}}.service" enabled="yes" state="started"

- name: migrate db
  become: yes
  become_user: "pleroma"
  command: "/opt/pleroma/bin/pleroma_ctl migrate"
  args:
    chdir: "/opt/pleroma/"
  environment:
    PLEROMA_CONFIG_PATH: "/etc/pleroma/{{pleroma_instance}}.config.exs"
  changed_when: false