diff --git a/roles/group_vars/all.sample b/roles/group_vars/all.sample new file mode 100644 index 0000000..5cd8ecc --- /dev/null +++ b/roles/group_vars/all.sample @@ -0,0 +1,4 @@ +# Specify the PostgreSQL database name you want to use for Mastodon +# Please note that the playbook will drop this database in preparation for Mastodon's +# database setup process. +DB_NAME: diff --git a/roles/mastodon-config/templates/.env.production.sample b/roles/mastodon-config/templates/.env.production.sample index eefccd0..5d56041 100644 --- a/roles/mastodon-config/templates/.env.production.sample +++ b/roles/mastodon-config/templates/.env.production.sample @@ -9,7 +9,7 @@ DB_HOST=/var/run/postgresql # Your PostgreSQL user DB_USER=mastodon # Your PostgreSQL DB name -DB_NAME=mastodon_production +DB_NAME={{ DB_NAME }} # Leave DB password empty DB_PASS= # Your DB_PORT diff --git a/roles/mastodon-postgresql/tasks/main.yml b/roles/mastodon-postgresql/tasks/main.yml index 570031e..da13b67 100644 --- a/roles/mastodon-postgresql/tasks/main.yml +++ b/roles/mastodon-postgresql/tasks/main.yml @@ -15,3 +15,9 @@ state: present become: true become_user: postgres +- name: Drop any existing database that may exist with the same name + postgresql_db: + name: {{ DB_NAME }} + state: absent + become: true + become_user: postgres