dataset/seed/postgresql/templates/postgresql.sql

16 lines
856 B
MySQL
Raw Permalink Normal View History

2023-01-17 21:43:32 +01:00
#RISOTTO: do not compare
2023-06-23 08:12:05 +02:00
{% set new_accounts = [('rougail_test', 'rougail_test', 'rougail_test'|get_password(server_name=domain_name_eth0, description="remote", type="cleartext", hide=hide_secret, temporary=True))] %}
{% for server in accounts.remotes %}
{% set name = server|normalize_family %}
{% set database = accounts["remote_" + name]["database_" + name] %}
{% set username = accounts["remote_" + name]["username_" + name] %}
{% set password = accounts["remote_" + name]["password_" + name] %}
{{ new_accounts.append((database, username, password)) }}
{% endfor %}
{% for database, name, password in new_accounts %}
CREATE DATABASE "{{ name }}";
CREATE ROLE "{{ name }}" WITH LOGIN ENCRYPTED PASSWORD '{{ password }}';
ALTER USER "{{ name }}" PASSWORD '{{ password }}';
GRANT ALL PRIVILEGES ON DATABASE "{{ name }}" TO "{{ database }}";
{% endfor %}