2023-06-23 08:12:05 +02:00
|
|
|
{% set new_accounts = [('_gateway', '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((server|string, database, username, password)) }}
|
|
|
|
{% endfor %}
|
|
|
|
{% for server, database, username, password in new_accounts %}
|
|
|
|
CREATE USER IF NOT EXISTS '{{ database}}'@'{{ server }}' IDENTIFIED BY '{{ password }}';
|
|
|
|
CREATE DATABASE IF NOT EXISTS {{ database }} CHARACTER SET utf8;
|
|
|
|
GRANT ALL PRIVILEGES ON {{ username }}.* TO '{{ database }}'@'{{ server }}' IDENTIFIED BY '{{password }}';
|
|
|
|
{% endfor %}
|
2022-07-05 22:09:16 +02:00
|
|
|
FLUSH PRIVILEGES;
|