ansible-role-epasmed/templates/pg-create-user-db.sh.j2

13 lines
414 B
Django/Jinja

#!/bin/bash
set -e
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE USER {{ epasmed_db_user }} password '{{ epasmed_db_pwd }}';
CREATE DATABASE {{ epasmed_db_name }}
OWNER {{ epasmed_db_user }}
ENCODING UTF8 LC_COLLATE 'en_US.UTF-8' LC_CTYPE 'en_US.UTF-8'
TEMPLATE template0;
GRANT ALL PRIVILEGES ON DATABASE {{ epasmed_db_name }} TO {{ epasmed_db_user }};
EOSQL