ansible批量安装zabbix-agent
centos7.x
网站建设哪家好,找成都创新互联!专注于网页设计、网站建设、微信开发、小程序定制开发、集团企业网站建设等服务项目。为回馈新老客户创新互联还提供了南平免费建站欢迎大家使用!
ansible -i add_zabbix_list zabbix -s -m shell -a "rpm -iUh http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-agent-4.0.1-1.el7.x86_64.rpm"
<--
如果无法在线安装rpm包就分发过去
ansible -i add_zabbix_list zabbix -s -m shell -a "mkdir /data/tools"
ansible -i add_zabbix_list zabbix -s -m copy -a "src=/data/tools/zabbix-agent-4.0.1-1.el7.x86_64.rpm dest=/data/tools"
ansible -i add_zabbix_list zabbix -s -m shell -a "rpm -ivh /data/tools/zabbix-agent-4.0.1-1.el7.x86_64.rpm"
-->
ansible -i add_zabbix_list zabbix -s -m shell -a "ls -la /etc/zabbix"
ansible -i add_zabbix_list zabbix -s -m copy -a "src=/etc/zabbix dest=/etc owner=root group=root mode=0755"
ansible -i add_zabbix_list zabbix -s -m shell -a "sed -i '/Hostname/s/^/#/g' /etc/zabbix/zabbix_agentd.conf"
ansible -i add_zabbix_list zabbix -s -m shell -a 'echo "Hostname=`hostname`" >> /etc/zabbix/zabbix_agentd.conf'
ansible -i add_zabbix_list zabbix -s -m file -a "path=/data/zabbixdata state=directory recurse=yes owner=zabbix group=zabbix"
ansible -i add_zabbix_list zabbix -s -m systemd -a "name=zabbix-agent state=started"
ansible -i add_zabbix_list zabbix -s -m systemd -a "name=zabbix-agent state=started enabled=true"
ansible -i add_zabbix_list zabbix -s -m shell -a "cat /etc/zabbix/zabbix_agentd.conf"
ansible -i add_zabbix_list zabbix -s -m shell -a "netstat -lntup|grep 10050"
centos6.x
ansible -i t3_test_list test -s -m shell -a "rpm -iUh https://repo.zabbix.com/zabbix/4.0/rhel/6/x86_64/zabbix-agent-4.0.1-1.el6.x86_64.rpm"
ansible -i t3_test_list test -s -m shell -a "rpm -qa |grep zabbix"
ansible -i t3_test_list test -s -m shell -a "ls -la /etc/zabbix"
ansible -i t3_test_list test -s -m unarchive -a "src=/data/scripts/iplistfile/zabbix.tar.gz dest=/etc/ owner=root group=root"
ansible -i t3_test_list test -s -m service -a "name=zabbix-agent state=started enabled=true"
ansible -i t3_test_list test -s -m shell -a "service zabbix-agent stop"
ansible -i t3_test_list test -s -m shell -a "sed -i '/Hostname/s/^/#/g' /etc/zabbix/zabbix_agentd.conf"
ansible -i t3_test_list test -s -m shell -a 'echo "Hostname=`hostname`" >> /etc/zabbix/zabbix_agentd.conf'
ansible -i t3_test_list test -s -m file -a "path=/data/zabbixdata state=directory recurse=yes owner=zabbix group=zabbix"
ansible -i t3_test_list test -s -m service -a "name=zabbix-agent state=started"
ansible -i t3_test_list test -s -m shell -a "netstat -lntup|grep 10050"
网站栏目:ansible批量安装zabbix-agent
本文来源:http://pwwzsj.com/article/ipchdi.html