Saltstack配置管理(2)

时间:2023-03-08 21:43:43

1.SaltStack批量安装zabbix_agent端.

vim /etc/salt/states/init/zabbix_agnet.sls

zabbix_install.conf:
pkg.installed:
#pkg.removed:
- names:
- zabbix22-agent file.managed:
- name: /etc/zabbix_agent.conf
- source: salt://init/files/zabbix_agentd.conf
- user: root
- group: root
- mode: 644 service.running:
- name: zabbix-agentd
- enable: True
#- reload: True
- watch:
- file: zabbix_install.conf

2.vim /etc/salt/states/top.sls

base:
'*': - init.zabbix_agnet

3.执行命令

salt '*' state.highstate test=Ture 	#测试,只是在minion端去运行,会列出改变,但实际不会执行.

salt '*' state.highstate