diff --git a/states/zabbix/agent/config.sls b/states/zabbix/agent/config.sls index aedc6d8..d7cebd1 100644 --- a/states/zabbix/agent/config.sls +++ b/states/zabbix/agent/config.sls @@ -3,8 +3,8 @@ zabbix_config_dir: file.directory: - name: /etc/zabbix - - user: root - - group: root + - user: {{ zabbix.agent.user }} + - group: {{ zabbix.agent.user }} - mode: 755 - watch_in: - service: zabbix_agent_service @@ -12,8 +12,8 @@ zabbix_config_dir: zabbix_log_dir: file.directory: - name: /var/log/zabbix - - user: zabbix - - group: zabbix + - user: {{ zabbix.agent.user }} + - group: {{ zabbix.agent.user }} - mode: 755 - watch_in: - service: zabbix_agent_service @@ -21,8 +21,8 @@ zabbix_log_dir: zabbix_agent_config_dir: file.directory: - name: /etc/zabbix/zabbix_agentd.conf.d - - user: root - - group: root + - user: {{ zabbix.agent.user }} + - group: {{ zabbix.agent.user }} - mode: 755 - watch_in: - service: zabbix_agent_service @@ -30,6 +30,8 @@ zabbix_agent_config_dir: zabbix_agent_config: file.managed: - name: /etc/zabbix/zabbix_agentd.conf + - user: {{ zabbix.agent.user }} + - group: {{ zabbix.agent.user }} - source: salt://zabbix/templates/zabbix_agentd.conf.j2 - template: jinja - watch_in: @@ -39,6 +41,8 @@ zabbix_agent_config: zabbix_agent_tlspsk_file: file.managed: - name: {{ zabbix.agent.config.TLSPSKFile }} + - user: {{ zabbix.agent.user }} + - group: {{ zabbix.agent.user }} - contents: {{ zabbix.agent.psk }} - create: true - watch_in: @@ -49,8 +53,8 @@ zabbix_userparameters: file.managed: - name: /etc/zabbix/zabbix_agentd.conf.d/user_parameters.conf - source: salt://zabbix/templates/user_parameters.j2 - - user: root - - group: root + - user: {{ zabbix.agent.user }} + - group: {{ zabbix.agent.user }} - mode: 0755 - template: jinja - watch_in: diff --git a/states/zabbix/agent/scripts.sls b/states/zabbix/agent/scripts.sls index a87c180..fe98723 100644 --- a/states/zabbix/agent/scripts.sls +++ b/states/zabbix/agent/scripts.sls @@ -3,13 +3,15 @@ zabbix_script_dir: file.directory: - name: /etc/zabbix/scripts + - user: {{ zabbix.agent.user }} + - group: {{ zabbix.agent.group }} {%- for key, value in zabbix.agent.scripts.items() %} zabbix_script_{{ key }}: file.managed: - name: /etc/zabbix/scripts/{{ value.name }} - source: salt://zabbix/scripts/{{ value.name }} - - user: zabbix - - group: zabbix + - user: {{ zabbix.agent.user }} + - group: {{ zabbix.agent.group }} - mode: 0755 {%- endfor %} diff --git a/states/zabbix/defaults.yaml b/states/zabbix/defaults.yaml index 3d0450e..42c9618 100644 --- a/states/zabbix/defaults.yaml +++ b/states/zabbix/defaults.yaml @@ -2,6 +2,8 @@ zabbix: server: enabled: false + user: zabbix + group: zabbix pkgs: - zabbix-frontend-php - zabbix-server-pgsql @@ -15,6 +17,8 @@ zabbix: PidFile: /run/zabbix/zabbix_server.pid agent: enabled: true + user: zabbix + group: zabbix pkgs: - python3-pyzabbix - zabbix-agent diff --git a/states/zabbix/server/config.sls b/states/zabbix/server/config.sls index 7ff5fdd..f9397ba 100644 --- a/states/zabbix/server/config.sls +++ b/states/zabbix/server/config.sls @@ -4,4 +4,6 @@ zabbix_server_config: file.managed: - name: /etc/zabbix/zabbix_server.conf - source: salt://zabbix/templates/zabbix_server.conf.j2 + - user: {{ zabbix.server.user }} + - group: {{ zabbix.server.group }} - template: jinja