Skip to content

Commit

Permalink
chore: add permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
nadeemshahzad committed Nov 18, 2024
1 parent f61ad50 commit 1ba8976
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions playbooks/create_db_and_users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down

0 comments on commit 1ba8976

Please sign in to comment.