131 lines
3.1 KiB
YAML
131 lines
3.1 KiB
YAML
---
|
|
- name: Install pleroma
|
|
hosts: all
|
|
vars_files:
|
|
- ./group_vars.yml
|
|
|
|
tasks:
|
|
- name: Get indexes
|
|
become: true
|
|
ansible.builtin.apt:
|
|
update-cache: true
|
|
|
|
- name: Upgrade OS
|
|
become: true
|
|
ansible.builtin.apt:
|
|
upgrade: full
|
|
|
|
- name: Install deps for building
|
|
become: true
|
|
ansible.builtin.apt:
|
|
name:
|
|
- acl
|
|
- git
|
|
- build-essential
|
|
- postgresql
|
|
- postgresql-contrib
|
|
- cmake
|
|
- libmagic-dev
|
|
- elixir
|
|
- erlang-dev
|
|
- erlang-nox
|
|
- imagemagick
|
|
- ffmpeg
|
|
- libimage-exiftool-perl
|
|
- python3-psycopg2
|
|
|
|
- name: Create pleroma database user
|
|
become: true
|
|
become_user: postgres
|
|
community.postgresql.postgresql_user:
|
|
name: '{{ db_user }}'
|
|
password: '{{ db_password }}'
|
|
|
|
- name: Create pleroma database
|
|
become: true
|
|
become_user: postgres
|
|
community.postgresql.postgresql_db:
|
|
name: '{{ db_name }}'
|
|
owner: '{{ db_user }}'
|
|
|
|
- name: Create pleroma user
|
|
become: true
|
|
ansible.builtin.user:
|
|
name: pleroma
|
|
system: true
|
|
home: /var/lib/pleroma
|
|
shell: /bin/false
|
|
|
|
- name: Create pleroma directory
|
|
become: true
|
|
ansible.builtin.file:
|
|
path: /opt/pleroma
|
|
state: directory
|
|
recurse: true
|
|
owner: pleroma
|
|
group: pleroma
|
|
|
|
- name: Get pleroma source
|
|
become: true
|
|
become_user: pleroma
|
|
ansible.builtin.git:
|
|
repo: https://git.pleroma.social/pleroma/pleroma
|
|
dest: /opt/pleroma
|
|
version: stable
|
|
|
|
- name: Create pleroma config
|
|
become: true
|
|
become_user: pleroma
|
|
ansible.builtin.template:
|
|
src: ./templates/config.j2
|
|
dest: /opt/pleroma/config/prod.secret.exs
|
|
owner: pleroma
|
|
group: pleroma
|
|
mode: '0644'
|
|
|
|
- name: Install Hex
|
|
become: true
|
|
become_user: pleroma
|
|
ansible.builtin.shell:
|
|
chdir: /opt/pleroma
|
|
cmd: mix local.hex --force
|
|
|
|
- name: Install pleroma deps
|
|
become: true
|
|
become_user: pleroma
|
|
ansible.builtin.shell:
|
|
chdir: /opt/pleroma
|
|
cmd: mix deps.get
|
|
|
|
- name: Install rebar3
|
|
become: true
|
|
become_user: pleroma
|
|
ansible.builtin.shell:
|
|
chdir: /opt/pleroma
|
|
cmd: mix local.rebar --force
|
|
|
|
- name: Building pleroma and database migration
|
|
become: true
|
|
become_user: pleroma
|
|
ansible.builtin.shell:
|
|
chdir: /opt/pleroma
|
|
cmd: MIX_ENV=prod mix ecto.migrate
|
|
|
|
- name: Copy SystemD unit
|
|
become: true
|
|
ansible.builtin.copy:
|
|
src: /opt/pleroma/installation/pleroma.service
|
|
dest: /etc/systemd/system/pleroma.service
|
|
mode: '0644'
|
|
|
|
- name: Daemons reload
|
|
become: true
|
|
ansible.builtin.systemd_service:
|
|
daemon_reload: true
|
|
|
|
- name: Enable and start pleroma service
|
|
become: true
|
|
ansible.builtin.systemd_service:
|
|
name: pleroma
|
|
enabled: true
|
|
state: started
|