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"

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


分享标题:ansible批量安装zabbix-agent-创新互联
路径分享:http://myzitong.com/article/cojdde.html