2017-11-26 21:52:17 +00:00
|
|
|
---
|
2017-11-26 21:50:14 +00:00
|
|
|
# This role installs the PostgreSQL server daemon and creates the mastodon
|
|
|
|
# database user
|
|
|
|
|
|
|
|
- name: Install PostgreSQL server and related packages
|
|
|
|
apt: name={{ item }} state=latest update_cache=yes
|
|
|
|
with_items:
|
|
|
|
- postgresql
|
|
|
|
- postgresql-contrib
|
|
|
|
- python-psycopg2
|
2017-11-27 18:24:55 +00:00
|
|
|
- name: Stop any Mastodon services that may be running
|
|
|
|
systemd: name={{ item }} state=stopped
|
|
|
|
with_items:
|
|
|
|
- mastodon-sidekiq
|
|
|
|
- mastodon-streaming
|
|
|
|
- mastodon-web
|
2017-11-26 21:50:14 +00:00
|
|
|
- name: Add Mastodon PostgreSQL database user
|
|
|
|
postgresql_user:
|
|
|
|
name: mastodon
|
|
|
|
role_attr_flags: CREATEDB
|
|
|
|
state: present
|
|
|
|
become: true
|
|
|
|
become_user: postgres
|
2017-11-27 17:12:42 +00:00
|
|
|
- name: Drop any existing database that may exist with the same name
|
|
|
|
postgresql_db:
|
2017-11-27 17:17:54 +00:00
|
|
|
name: "{{ DB_NAME }}"
|
2017-11-27 17:12:42 +00:00
|
|
|
state: absent
|
2017-11-27 17:19:45 +00:00
|
|
|
become: true
|
|
|
|
become_user: postgres
|