This repository has been archived on 2023-05-06. You can view files and clone it, but cannot push or open issues or pull requests.
pleroma-ansible-playbook/tasks/pleroma.yml

100 lines
2.2 KiB
YAML
Raw Normal View History

2019-10-02 01:31:38 +01:00
---
- name: Ensure Pleroma dependencies are installed.
apk:
name: unzip, ncurses
state: present
- name: Ensure group 'pleroma' exists.
group:
gid: 1200
name: pleroma
state: present
system: yes
- name: Ensure user 'pleroma' exists.
user:
group: pleroma
home: /opt/pleroma
name: pleroma
shell: /bin/false
state: present
system: yes
uid: 1200
# Directories
- name: Ensure the Pleroma data and config directories exists.
file:
name: "{{ item }}"
state: directory
mode: '0700'
owner: pleroma
group: pleroma
loop:
- /etc/pleroma
- /var/lib/pleroma
- /var/lib/pleroma/uploads
- /var/lib/pleroma/static
- name: Ensuring that the release build of pleroma is downloaded.
get_url:
url: https://git.pleroma.social/api/v4/projects/2/jobs/artifacts/master/download?job=amd64-musl
dest: /tmp/pleroma.zip
- name: Unzipping the release build of pleroma.
unarchive:
remote_src: yes
src: /tmp/pleroma.zip
dest: /tmp
owner: pleroma
group: pleroma
- name: Ensuring that Pleroma is installed.
shell: |
find /tmp/release/ -mindepth 1 -maxdepth 1 | xargs -I dir mv dir /opt/pleroma/
args:
creates: /opt/pleroma/bin/pleroma
- name: Ensuring the configuration file is set.
template:
src: etc_pleroma_config.exs.j2
dest: /etc/pleroma/config.exs
owner: pleroma
group: pleroma
mode: '0400'
- name: Running database migrations.
command:
argv:
- pleroma_ctl
- migrate
environment:
PATH: "{{ ansible_env.PATH }}:/opt/pleroma/bin"
- name: Ensuring that folder permissions are set properly in /opt/pleroma.
shell: |
find /opt/pleroma -mindepth 1 -maxdepth 1 -type d | xargs -I dir chmod 0700 dir
find /opt/pleroma -mindepth 1 -maxdepth 1 -type d | xargs -I dir chown -R pleroma:pleroma dir
- name: Setting up the Pleroma service.
copy:
src: /opt/pleroma/installation/init.d/pleroma
dest: /etc/init.d/pleroma
remote_src: yes
owner: root
group: root
mode: '0700'
- name: Ensuring that the Pleroma service is enabled and started.
service:
name: pleroma
enabled: yes
state: started
- name: Cleaning up
file:
path: "{{ item }}"
state: absent
loop:
- /tmp/pleroma.zip
- /tmp/release