zabbix-agent+playbook
--- - hosts: webservers tasks: - name : '安装zabbix-agent' shell: rpm -qa | grep -q zabbix-release || rpm -ivh http://repo.zabbix.com/zabbix/4.4/rhel/6/x86_64/zabbix-release-4.4-1.el6.noarch.rpm - name: '安装zabbix-agent' yum: name=zabbix-agent state=latest - name: '修改分发配置文件' template: src=zabbix_agentd.conf dest=/etc/zabbix/zabbix_agentd.conf tags: zabbix-agent-conf notify: restart-agent - name: '关闭防火墙' service: name=iptables state=stopped - name: '关闭selinux' shell: setenforce 0 - name: '启动zabbix-agent' service: name=zabbix-agent state=started enabled=yes handlers: - name: restart-agent service: name=zabbix-agent state=restarted
[root@localhost zabbix]# vim zabbix_agentd.conf
编辑配置文件
Server=192.168.202.131 ServerActive=192.168.202.131 //zabbix-server 主机的ip地址