2019-10-02 01:31:38 +01:00
|
|
|
---
|
|
|
|
- name: Ensure Pleroma dependencies are installed.
|
|
|
|
apk:
|
|
|
|
name: unzip, ncurses
|
|
|
|
state: present
|
|
|
|
|
2019-10-15 09:16:24 +01:00
|
|
|
- name: Ensure group '{{ pleroma_user.group }}' exists.
|
2019-10-02 01:31:38 +01:00
|
|
|
group:
|
2019-10-15 09:16:24 +01:00
|
|
|
gid: "{{ pleroma_user.id }}"
|
|
|
|
name: "{{ pleroma_user.group }}"
|
2019-10-02 01:31:38 +01:00
|
|
|
state: present
|
|
|
|
system: yes
|
|
|
|
|
2019-10-15 09:16:24 +01:00
|
|
|
- name: Ensure user '{{ pleroma_user.name }}' exists.
|
2019-10-02 01:31:38 +01:00
|
|
|
user:
|
2019-10-15 09:16:24 +01:00
|
|
|
group: "{{ pleroma_user.group }}"
|
|
|
|
home: "{{ pleroma_user.home }}"
|
|
|
|
name: "{{ pleroma_user.name }}"
|
|
|
|
shell: "{{ pleroma_user.shell }}"
|
2019-10-02 01:31:38 +01:00
|
|
|
state: present
|
|
|
|
system: yes
|
2019-10-15 09:16:24 +01:00
|
|
|
uid: "{{ pleroma_user.id }}"
|
2019-10-02 01:31:38 +01:00
|
|
|
|
|
|
|
- name: Ensure the Pleroma data and config directories exists.
|
|
|
|
file:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: directory
|
|
|
|
mode: '0700'
|
2019-10-15 09:16:24 +01:00
|
|
|
owner: "{{ pleroma_user.name }}"
|
|
|
|
group: "{{ pleroma_user.group }}"
|
2019-10-02 01:31:38 +01:00
|
|
|
loop:
|
2019-10-15 09:16:24 +01:00
|
|
|
- "{{ pleroma_config_dir }}"
|
|
|
|
- "{{ pleroma_base_data_dir }}"
|
|
|
|
- "{{ pleroma_uploads_dir }}"
|
|
|
|
- "{{ pleroma_static_dir }}"
|
2019-11-12 23:09:21 +00:00
|
|
|
- "{{ pleroma_static_dir }}/images"
|
2019-10-02 01:31:38 +01:00
|
|
|
|
|
|
|
- name: Ensuring that the release build of pleroma is downloaded.
|
|
|
|
get_url:
|
2019-10-24 22:51:53 +01:00
|
|
|
url: "{{ pleroma_download_url }}"
|
|
|
|
dest: "{{ pleroma_download_dest }}"
|
2019-10-02 01:31:38 +01:00
|
|
|
|
|
|
|
- name: Unzipping the release build of pleroma.
|
|
|
|
unarchive:
|
|
|
|
remote_src: yes
|
2019-10-24 22:51:53 +01:00
|
|
|
src: "{{ pleroma_download_dest }}"
|
2019-10-02 01:31:38 +01:00
|
|
|
dest: /tmp
|
2019-10-15 09:16:24 +01:00
|
|
|
owner: "{{ pleroma_user.name }}"
|
|
|
|
group: "{{ pleroma_user.group }}"
|
2019-10-02 01:31:38 +01:00
|
|
|
|
|
|
|
- name: Ensuring that Pleroma is installed.
|
|
|
|
shell: |
|
2019-10-15 09:16:24 +01:00
|
|
|
find /tmp/release/ -mindepth 1 -maxdepth 1 | xargs -I dir mv dir {{ pleroma_user.home }}
|
2019-10-02 01:31:38 +01:00
|
|
|
args:
|
2019-10-15 09:16:24 +01:00
|
|
|
creates: "{{ pleroma_user.home }}/bin/pleroma"
|
2019-10-02 01:31:38 +01:00
|
|
|
|
|
|
|
- name: Ensuring the configuration file is set.
|
|
|
|
template:
|
|
|
|
src: etc_pleroma_config.exs.j2
|
2019-10-15 09:16:24 +01:00
|
|
|
dest: "{{ pleroma_config_dir }}/config.exs"
|
|
|
|
owner: "{{ pleroma_user.name }}"
|
|
|
|
group: "{{ pleroma_user.group }}"
|
2019-10-02 01:31:38 +01:00
|
|
|
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: |
|
2019-10-15 09:16:24 +01:00
|
|
|
find {{ pleroma_user.home }} -mindepth 1 -maxdepth 1 -type d | xargs -I dir chmod 0700 dir
|
|
|
|
find {{ pleroma_user.home }} -mindepth 1 -maxdepth 1 -type d | xargs -I dir chown -R {{ pleroma_user.name }}:{{ pleroma_user.group }} dir
|
2019-10-02 01:31:38 +01:00
|
|
|
|
2019-11-12 23:09:21 +00:00
|
|
|
- name: Uploading the background image to the static directory
|
|
|
|
copy:
|
|
|
|
src: "{{ pleroma.config.frontend.background }}"
|
|
|
|
dest: "{{ pleroma_static_dir }}/images/pleroma-background.png"
|
|
|
|
owner: "{{ pleroma_user.name }}"
|
|
|
|
group: "{{ pleroma_user.group }}"
|
|
|
|
mode: '0400'
|
|
|
|
when: pleroma.config.frontend.background|length
|
|
|
|
|
2019-10-02 01:31:38 +01:00
|
|
|
- name: Setting up the Pleroma service.
|
|
|
|
copy:
|
2019-10-15 09:16:24 +01:00
|
|
|
src: "{{ pleroma_user.home }}/installation/init.d/pleroma"
|
2019-10-02 01:31:38 +01:00
|
|
|
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
|
2019-10-15 09:16:24 +01:00
|
|
|
state: restarted
|
2019-10-02 01:31:38 +01:00
|
|
|
|
|
|
|
- name: Cleaning up
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: absent
|
|
|
|
loop:
|
2019-10-24 22:51:53 +01:00
|
|
|
- "{{ pleroma_download_dest }}"
|
2019-10-02 01:31:38 +01:00
|
|
|
- /tmp/release
|