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

zabbix_proxy database user creation tasks updated to match zabbix_server #1397

Merged
merged 1 commit into from
Sep 26, 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
17 changes: 13 additions & 4 deletions roles/zabbix_proxy/tasks/initialize-pgsql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,29 @@
port: "{{ zabbix_proxy_dbport }}"
login_unix_socket: "{{ zabbix_proxy_pgsql_login_unix_socket | default(omit) }}"
name: "{{ zabbix_proxy_dbname }}"
state: present

- name: "PostgreSQL | Create database user"
community.postgresql.postgresql_user:
login_user: "{{ zabbix_proxy_pgsql_login_user | default(omit) }}"
login_password: "{{ zabbix_proxy_pgsql_login_password | default(omit) }}"
login_host: "{{ zabbix_proxy_pgsql_login_host | default(omit) }}"
port: "{{ zabbix_proxy_dbport }}"
login_unix_socket: "{{ zabbix_proxy_login_unix_socket | default(omit) }}"
name: "{{ zabbix_proxy_dbuser }}"
password: "{{ ('md5' + (zabbix_proxy_dbpassword + zabbix_proxy_dbuser)|hash('md5')) if zabbix_proxy_dbpassword_hash_method == 'md5' else zabbix_proxy_dbpassword }}"

- name: "PostgreSQL | Set database/user permissions"
community.postgresql.postgresql_privs:
login_user: "{{ zabbix_proxy_pgsql_login_user | default(omit) }}"
login_password: "{{ zabbix_proxy_pgsql_login_password | default(omit) }}"
login_host: "{{ zabbix_proxy_pgsql_login_host | default(omit) }}"
port: "{{ zabbix_proxy_dbport }}"
login_unix_socket: "{{ zabbix_proxy_login_unix_socket | default(omit) }}"
db: "{{ zabbix_proxy_dbname }}"
priv: ALL
state: present
encrypted: true
privs: ALL
type: schema
objs: public
role: "{{ zabbix_proxy_dbuser }}"

- name: "PostgreSQL verify or create schema"
when: zabbix_proxy_database_sqlload | bool
Expand Down