From 1ba89763661595cd80e7c152abdc1a82208215de Mon Sep 17 00:00:00 2001 From: nadeemshahzad Date: Mon, 18 Nov 2024 21:04:39 +0500 Subject: [PATCH] chore: add permissions --- playbooks/create_db_and_users.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/playbooks/create_db_and_users.yml b/playbooks/create_db_and_users.yml index 1b0f089da0c..48656ad19dd 100644 --- a/playbooks/create_db_and_users.yml +++ b/playbooks/create_db_and_users.yml @@ -192,6 +192,29 @@ login_password: "{{ database_connection.login_password }}" when: datadog_mysql_monitoring_enabled | default(false) + - name: Create Runtime setup consumer for datadog + mysql_query: + query: | + CREATE PROCEDURE {{ datadog_schema }}.enable_events_statements_consumers() + SQL SECURITY DEFINER + BEGIN + UPDATE performance_schema.setup_consumers SET enabled='YES' WHERE name LIKE 'events_statements_%'; + UPDATE performance_schema.setup_consumers SET enabled='YES' WHERE name = 'events_waits_current'; + END + login_host: "{{ database_connection.login_host }}" + login_user: "{{ database_connection.login_user }}" + login_password: "{{ database_connection.login_password }}" + when: datadog_mysql_monitoring_enabled | default(false) + ignore_errors: yes + + - name: Grant EXECUTE on enable_events_statements_consumers procedure to Datadog user + mysql_query: + query: "GRANT EXECUTE ON PROCEDURE {{ datadog_procedure_schema }}.enable_events_statements_consumers TO {{ datadog_user }}@'%';" + login_host: "{{ database_connection.login_host }}" + login_user: "{{ database_connection.login_user }}" + login_password: "{{ database_connection.login_password }}" + when: datadog_mysql_monitoring_enabled | default(false) + - name: Grant EXECUTE on explain_statement procedure in database {{ item }} to Datadog user mysql_query: query: |