美文网首页
ansible-同步安装zabbix-agent服务

ansible-同步安装zabbix-agent服务

作者: 李哈哈_2c85 | 来源:发表于2020-08-17 15:34 被阅读0次

1、下载zabbix的yum库
2、使用yum模块安装zabbix-agent
3、启动服务、设置开机启动
4、修改zabbix-agent配置文件

在yaml文件中编写以上步骤----其实用的全是shell模块完全是敲命令只不过用ansible同步了下而已,目的达到就行了。。。。。。。太low了!
- hosts: k8snode
  remote_user: root
  tasks:
     - name: epel-download
       command: rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm  #不同版本选择不同的下载地址--centos7-zabbix4
     - name: yum zabbix-agent
       command: yum install -y zabbix-agent
     - name: start zabbix
       shell: systemctl enable zabbix-agent
     - name: start zabbix
       shell: systemctl start zabbix-agent
     - name: sed zabbix
       shell: sed -i 's/ServerActive=127.0.0.1/ServerActive=192.168.5.18/g' /etc/zabbix/zabbix_agentd.conf
     - name: sed zabbix
       shell: sed -i 's/Server=127.0.0.1/Server=192.168.5.18/g' /etc/zabbix/zabbix_agentd.conf
     - name: hostname
       shell: sed -i "s/Hostname=Zabbix server/Hostname=`hostname`/" /etc/zabbix/zabbix_agentd.conf
     - name: start zabbix
       shell: systemctl restart zabbix-agent

相关文章

网友评论

      本文标题:ansible-同步安装zabbix-agent服务

      本文链接:https://www.haomeiwen.com/subject/ppridktx.html