From fc7808ace57cb882819b0785300867275659d94d Mon Sep 17 00:00:00 2001 From: Kalle Kiviaho Date: Fri, 10 Jan 2025 13:49:16 +0100 Subject: [PATCH] Add support for resource_limits when creating database users --- defaults/main.yml | 2 ++ molecule/default/vars/testvars.yml | 7 +++++++ tasks/users.yml | 1 + 3 files changed, 10 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index 085ef11..dd3a46f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -91,6 +91,8 @@ mariadb_users: [] # host: 100.64.200.10 # password: password # priv: "*.*:USAGE/db1.*:ALL" +# resource_limits: +# MAX_USER_CONNECTIONS: 20 # state: present|absent # Replication diff --git a/molecule/default/vars/testvars.yml b/molecule/default/vars/testvars.yml index 9da6440..8646ba0 100644 --- a/molecule/default/vars/testvars.yml +++ b/molecule/default/vars/testvars.yml @@ -28,6 +28,13 @@ mariadb_users: password: user2passwd priv: "db2.*:ALL" state: present + - name: user3 + host: "%" + password: user3passwd + priv: "db2.*:ALL" + resource_limits: + MAX_USER_CONNECTIONS: 20 + state: present mariadb_replication_user: - name: ReplicationUser diff --git a/tasks/users.yml b/tasks/users.yml index 9611248..0ceb850 100644 --- a/tasks/users.yml +++ b/tasks/users.yml @@ -9,5 +9,6 @@ append_privs: "{{ item.append_privs | default('no') }}" encrypted: "{{ item.encrypted | default('no') }}" login_unix_socket: "{{ mariadb_unix_socket }}" + resource_limits: "{{ item.resource_limits | default({}) }}" loop: "{{ mariadb_users }}" no_log: true