#RISOTTO: do not compare
{% 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 %}
