States file:
[email protected] base]# cat Top.sls
Base
‘*‘:
-Init.env_init
[email protected] base]# cat Init/env_init.sls
Include
-Init.zabbix_agent
[email protected] base]# cat Init/zabbix_agent.sls
Zabbix-agent:
Pkg.installed:
-Name:zabbix22-agent
File.managed:
-Name:/etc/zabbix_agentd.conf
-Source:salt://init/files/zabbix_agentd.conf
-Tmplate:jinjia
-Defaults:
Server: {{pillar[' zabbix-agent ' [' Zabbix-server ']}}
-Require:
-Pkg:zabbix-agent
Service.running:
-Enable:true
-Watch:
-Pkg:zabbix-agent
-File:zabbix-agent
[email protected] pillar]# cat Base/top.sls
Base
‘*‘:
-Zabbix
[email protected] pillar]# cat Base/zabbix.sls
Zabbix-agent:
zabbix-server:192.168.1.65
[Email protected] files]# Grep-ev "^$|^#" zabbix_agentd.conf
Pidfile=/var/run/zabbix/zabbix_agentd.pid
Logfile=/var/log/zabbix/zabbix_agentd.log
Logfilesize=0
Server={{server}}
serveractive=127.0.0.1
Hostname=zabbix Server
include=/etc/zabbix_agentd.conf.d/
No such file will be error-activated at startup:
Mkdri/etc/zabbix_agentd.conf.d
Perform:
[[email protected] ~]# Salt ' * ' state.highstate test=true
[[email protected] ~]# Salt ' * ' state.highstate
Salt installation Zabbix