Skip to content

Commit

Permalink
Copied initialize-pgsql user creation tasks from zabbix_server to zab…
Browse files Browse the repository at this point in the history
…bix_proxy (#1397)
  • Loading branch information
karl1k authored Sep 26, 2024
1 parent f458d14 commit ceff9d3
Showing 1 changed file with 13 additions and 4 deletions.
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

0 comments on commit ceff9d3

Please sign in to comment.