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