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"
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。