diff --git a/roles/zabbix_server/tasks/initialize-mysql.yml b/roles/zabbix_server/tasks/initialize-mysql.yml index d66a2e75b..1be30da93 100644 --- a/roles/zabbix_server/tasks/initialize-mysql.yml +++ b/roles/zabbix_server/tasks/initialize-mysql.yml @@ -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 }}" @@ -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 }}" @@ -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" @@ -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 @@ -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: @@ -130,6 +135,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: "MySQL | Import schema" community.mysql.mysql_db: @@ -137,6 +143,7 @@ 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 }}" @@ -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 }}"