ansible批量安裝zabbix_agent && 修改配置文件


Ansible常用指令

 

 

rpm -i https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm

rpm -i https://repo.zabbix.com/zabbix/4.0/rhel/6/x86_64/zabbix-release-4.0-1.el6.noarch.rpm

 

 

yum install zabbix-agent -y

 

vi /etc/zabbix/zabbix_agentd.conf

 

 

 

 

ServerActive=127.0.0.1

 

Hostname=Zabbix server

Server=127.0.0.1

 

zabbix-agent部署

ansible dev3 -m shell -a ‘’     查看配置可用shell模塊

ansible dev3 -m lineinfile -a 'path=/etc/zabbix/zabbix_agentd.conf regexp="^ServerActive=" line="ServerActive=172.17.31.76:10051"'    替換遠程文件內容

ansible dev3 -m lineinfile -a 'path=/etc/zabbix/zabbix_agentd.conf regexp="^Server=" line="Server=127.0.0.1,172.17.31.76"'      替換遠程文件內容

 

Copy  script  yum vars 等常用模塊,適用yml文件

命令行直接使用shell模塊簡單粗暴。

 

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM