Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use SSL for database connection when zabbix_server_dbtlsconnect is set #1404

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions roles/zabbix_server/tasks/initialize-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
login_host: "{{ zabbix_server_mysql_login_host | default(omit) }}"
login_port: "{{ zabbix_server_mysql_login_port | default(omit) }}"
login_unix_socket: "{{ zabbix_server_mysql_login_unix_socket | default(omit) }}"
check_hostname: "{{ zabbix_server_dbtlsconnect is defined and zabbix_server_dbtlsconnect != '' }}"
name: "{{ zabbix_server_dbname }}"
encoding: "{{ zabbix_server_dbencoding }}"
collation: "{{ zabbix_server_dbcollation }}"
Expand All @@ -58,6 +59,7 @@
login_host: "{{ zabbix_server_mysql_login_host | default(omit) }}"
login_port: "{{ zabbix_server_mysql_login_port | default(omit) }}"
login_unix_socket: "{{ zabbix_server_mysql_login_unix_socket | default(omit) }}"
check_hostname: "{{ zabbix_server_dbtlsconnect is defined and zabbix_server_dbtlsconnect != '' }}"
name: "{{ zabbix_server_dbuser }}"
password: "{{ zabbix_server_dbpassword }}"
host: "{{ zabbix_server_privileged_host }}"
Expand All @@ -82,6 +84,7 @@
login_host: "{{ zabbix_server_dbhost }}"
login_port: "{{ zabbix_server_dbport }}"
login_db: "{{ zabbix_server_dbname }}"
check_hostname: "{{ zabbix_server_dbtlsconnect is defined and zabbix_server_dbtlsconnect != '' }}"
query: "SELECT mandatory FROM dbversion"
rescue:
- name: "MySQL | Get and set schema import overrides"
Expand All @@ -95,6 +98,7 @@
login_host: "{{ zabbix_server_mysql_login_host | default(omit) }}"
login_port: "{{ zabbix_server_mysql_login_port | default(omit) }}"
login_unix_socket: "{{ zabbix_server_mysql_login_unix_socket | default(omit) }}"
check_hostname: "{{ zabbix_server_dbtlsconnect is defined and zabbix_server_dbtlsconnect != '' }}"
loop:
- innodb_default_row_format
- log_bin_trust_function_creators
Expand All @@ -111,6 +115,7 @@
login_host: "{{ zabbix_server_mysql_login_host | default(omit) }}"
login_port: "{{ zabbix_server_mysql_login_port | default(omit) }}"
login_unix_socket: "{{ zabbix_server_mysql_login_unix_socket | default(omit) }}"
check_hostname: "{{ zabbix_server_dbtlsconnect is defined and zabbix_server_dbtlsconnect != '' }}"
when: item.msg != _mysql_schema_import_overrides[item.name]
loop: "{{ _mysql_variable_defaults.results }}"
loop_control:
Expand All @@ -130,13 +135,15 @@
login_host: "{{ zabbix_server_mysql_login_host | default(omit) }}"
login_port: "{{ zabbix_server_mysql_login_port | default(omit) }}"
login_unix_socket: "{{ zabbix_server_mysql_login_unix_socket | default(omit) }}"
check_hostname: "{{ zabbix_server_dbtlsconnect is defined and zabbix_server_dbtlsconnect != '' }}"

- name: "MySQL | Import schema"
community.mysql.mysql_db:
login_user: "{{ zabbix_server_dbuser }}"
login_password: "{{ zabbix_server_dbpassword }}"
login_host: "{{ zabbix_server_dbhost }}"
login_port: "{{ zabbix_server_dbport }}"
check_hostname: "{{ zabbix_server_dbtlsconnect is defined and zabbix_server_dbtlsconnect != '' }}"
name: "{{ zabbix_server_dbname }}"
encoding: "{{ zabbix_server_dbencoding }}"
collation: "{{ zabbix_server_dbcollation }}"
Expand All @@ -154,6 +161,7 @@
login_host: "{{ zabbix_server_mysql_login_host | default(omit) }}"
login_port: "{{ zabbix_server_mysql_login_port | default(omit) }}"
login_unix_socket: "{{ zabbix_server_mysql_login_unix_socket | default(omit) }}"
check_hostname: "{{ zabbix_server_dbtlsconnect is defined and zabbix_server_dbtlsconnect != '' }}"
loop: "{{ _mysql_variable_defaults.results | default([]) }}"
loop_control:
label: "{{ item.name }}: {{ item.msg }}"