updated zabbix state

This commit is contained in:
Paul 2020-10-25 16:35:57 +01:00
parent f3b1890de2
commit f0ebf07e34
18 changed files with 120 additions and 37 deletions

View File

@ -0,0 +1,28 @@
---
{%- from "zabbix/map.jinja" import zabbix with context %}
zabbix_log_dir:
file.directory:
- name: /var/log/zabbix
- user: zabbix
- group: zabbix
- mode: 755
- watch_in:
- service: zabbix_agent_service
zabbix_agent_config:
file.managed:
- name: /etc/zabbix/zabbix_agentd.conf
- source: salt://zabbix/templates/zabbix_agentd.conf.j2
- template: jinja
- watch_in:
- service: zabbix_agent_service
{% if zabbix.agent.config.TLSPSKFile is iterable %}
zabbix_agent_tlspsk_file:
file.managed:
- name: {{ zabbix.agent.config.TLSPSKFile }}
- contents: {{ zabbix.agent.psk }}
- create: true
- watch_in:
- service: zabbix_agent_service
{% endif %}

View File

@ -0,0 +1,5 @@
---
include:
- .install
- .config
- .service

View File

@ -0,0 +1,5 @@
---
{%- from "zabbix/map.jinja" import zabbix with context %}
zabbix_agent_pkgs:
pkg.latest:
- pkgs: {{ zabbix.agent.pkgs }}

View File

@ -0,0 +1,6 @@
---
{%- from "zabbix/map.jinja" import zabbix with context %}
zabbix_agent_service:
service.running:
- name: zabbix-agent
- enable: true

View File

@ -1,7 +0,0 @@
---
{%- from "zabbix_server/map.jinja" import zabbix_server with context %}
zabbix_server-config:
file.managed:
- name: /etc/zabbix/zabbix_server.conf
- source: salt://zabbix_server/templates/zabbix_server.conf.j2
- template: jinja

View File

@ -1,10 +1,26 @@
--- ---
zabbix_server: zabbix:
pkgs: server:
- zabbix-frontend-php enabled: false
- zabbix-server-pgsql pkgs:
config: - zabbix-frontend-php
DBHost: zabbix - zabbix-server-pgsql
DBName: zabbix config:
DBUser: zabbix DBHost: zabbix
DBPassword: zabbix DBName: zabbix
DBPassword: zabbix
DBUser: zabbix
LogFile: /var/log/zabbix/zabbix_server.log
LogType: file
PidFile: /run/zabbix/zabbix_server.pid
agent:
enabled: true
pkgs:
- zabbix-agent
config:
LogFile: /var/log/zabbix/zabbix_agentd.log
LogFileSize: 0
LogType: file
PidFile: /var/run/zabbix/zabbix_agentd.pid
Server: 127.0.0.1
ServerActive: zabbix.paulbsd.com

View File

@ -1,8 +1,13 @@
--- ---
{%- from "zabbix/map.jinja" import zabbix with context %}
include: include:
{% if zabbix.server.enabled %}
- repos
- postgresql - postgresql
- php - php
- .install - .server
- .provision {% endif %}
- .config {% if zabbix.agent.enabled %}
- .service - repos
- .agent
{% endif %}

View File

@ -1,5 +0,0 @@
---
{%- from "zabbix_server/map.jinja" import zabbix_server with context %}
zabbix_server_pkgs:
pkg.latest:
- pkgs: {{ zabbix_server.pkgs }}

View File

@ -1,5 +1,5 @@
{%- import_yaml "zabbix_server/defaults.yaml" as default_settings -%} {%- import_yaml "zabbix/defaults.yaml" as default_settings -%}
{%- set defaults = salt['grains.filter_by'](default_settings, default='zabbix_server') -%} {%- set defaults = salt['grains.filter_by'](default_settings, default='zabbix') -%}
{%- set zabbix_server = salt['pillar.get']('zabbix_server', default=defaults, merge=True) -%} {%- set zabbix = salt['pillar.get']('zabbix', default=defaults, merge=True) -%}

9
states/zabbix/repo.sls Normal file
View File

@ -0,0 +1,9 @@
---
{%- from "zabbix/map.jinja" import zabbix with context %}
zabbix_repo:
pkgrepo.managed:
- name: deb {{ zabbix.repo.url }} {{ zabbix.repo.distro }} main
- humanname: Zabbix repository
- file: /etc/apt/sources.list.d/zabbix.list
- keyid: 082AB56BA14FE591
- keyserver: keyserver.ubuntu.com

View File

@ -0,0 +1,7 @@
---
{%- from "zabbix/map.jinja" import zabbix with context %}
zabbix_server_config:
file.managed:
- name: /etc/zabbix/zabbix_server.conf
- source: salt://zabbix/templates/zabbix_server.conf.j2
- template: jinja

View File

@ -0,0 +1,5 @@
---
include:
- .install
- .config
- .service

View File

@ -0,0 +1,5 @@
---
{%- from "zabbix/map.jinja" import zabbix with context %}
zabbix_server_pkgs:
pkg.latest:
- pkgs: {{ zabbix.server.pkgs }}

View File

@ -0,0 +1,6 @@
---
{%- from "zabbix/map.jinja" import zabbix with context %}
zabbix_server_service:
service.running:
- name: zabbix-server
- enable: true

View File

@ -1,6 +0,0 @@
---
{%- from "zabbix_server/map.jinja" import zabbix_server with context %}
zabbix_server-service:
service.running:
- name: zabbix-server
- enabled: true

View File

@ -0,0 +1,4 @@
{%- from "zabbix/map.jinja" import zabbix with context %}
{%- for k, v in zabbix.agent.config.items() %}
{{ k }}={{ v }}
{%- endfor %}

View File

@ -1,4 +1,4 @@
{%- from "zabbix_server/map.jinja" import zabbix_server with context %} {%- from "zabbix/map.jinja" import zabbix with context %}
{% for k, v in zabbix_server.config.items() %} {%- for k, v in zabbix.server.config.items() %}
{{ k }}={{ v }} {{ k }}={{ v }}
{% endfor %} {%- endfor %}