aboutsummaryrefslogtreecommitdiffstats
path: root/roles/mastodon/tasks/database.yml
blob: 37f6dcde8791e6c161b2cd2aa07feabcb8864095 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
- name: create database user
  postgresql_user:
    name: '{{ mastodon_db_user }}'
    password: '{{ mastodon_db_password }}'
    role_attr_flags: CREATEDB
    state: present
  environment:
    PGOPTIONS: "-c password_encryption=scram-sha-256"
  delegate_to: "{{ postgresql_inventory_host }}"
  become: yes
  become_user: postgres
  register: mastodon_db_user

- name: create database schema
  command:
    chdir: '{{ mastodon_install_dir }}'
    cmd: 'bundle exec rake db:setup'
  environment:
    RAILS_ENV: production
    SAFETY_ASSURED: 1
  become: yes
  become_user: '{{ mastodon_user }}'
  when: mastodon_db_user.changed