mastible/roles/mastodon-postgresql/tasks/main.yml

31 lines
861 B
YAML

---
# This role installs the PostgreSQL server daemon and creates the mastodon
# database user
- name: Install PostgreSQL server and related packages
apt: name={{ packages }} state=latest update_cache=yes
when: ansible_distribution_release == 'bionic'
vars:
packages:
- postgresql
- postgresql-contrib
- python-psycopg2
- name: Install PostgreSQL server and related packages
apt: name={{ packages }} state=latest update_cache=yes
when: ansible_distribution_release == 'focal'
vars:
packages:
- postgresql
- postgresql-contrib
- python3-psycopg2
- name: Add Mastodon PostgreSQL database user
postgresql_user:
name: mastodon
role_attr_flags: CREATEDB
state: present
become: true
become_user: postgres
- name: Run PostgreSQL install tasks
include_tasks: install.yml
when: install is defined