ansible批量安装zabbix-agent

发布时间:2020-05-21 12:57:41 作者:蜗牛远途
来源:网络 阅读:178

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"


推荐阅读:
  1. ansible笔记——安装配置ansible
  2. ansible安装及使用

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

ansinble zabbix age

上一篇:CentOS7删除/boot/initramfsxxx.img并尝试光盘救援模式修复

下一篇:使用mysql-proxy实现mysql的读写分离

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》