导航

ansible安装配置zabbix客户端

Posted on 2015-10-30 10:54  ggzone  阅读(167)  评论(0编辑  收藏  举报


安装软件

ansible host -m apt -a "name=zabbix-agent state=present"

ansible host -m shell -a "/sbin/ifconfig"


备份配置文件

ansible host -m shell -a "/bin/cp /etc/zabbix/zabbix_agentd.conf /etc/zabbix/zabbix_agentd.conf.bak"

查看更新会影响到的条数:

ansible host -m shell -a "/bin/cat /etc/zabbix/zabbix_agentd.conf|/bin/grep Server=127.0.0.1"

更新配置

ansible host -m shell -a "/bin/sed -i 's/Server=127.0.0.1/Server=10.8.0.231/g' /etc/zabbix/zabbix_agentd.conf "

重启服务

ansible host -m service -a "name=zabbix-agent state=restarted"