推荐系统网站开发徐州做网站企业
news/
2025/9/24 7:29:31/
文章来源:
推荐系统网站开发,徐州做网站企业,建站行业发展前景,网络工程实施方案本次以多台机器需部署zabbix客户端为例#xff1a;
机器先做免密互信#xff0c;ansible主机上执行ssh-keygen,一路回车#xff0c;然后将公钥发送给需管理的主机#xff1a;
ssh-copy-id rootIP
1、编辑hosts文件#xff0c;添加需配置的主机IP#xff0c;并测试连通…本次以多台机器需部署zabbix客户端为例
机器先做免密互信ansible主机上执行ssh-keygen,一路回车然后将公钥发送给需管理的主机
ssh-copy-id rootIP
1、编辑hosts文件添加需配置的主机IP并测试连通性
[rootoxidized ansible]# vim /etc/ansible/hosts
[all]
10.10.80.110
10.10.80.111
10.10.80.112
10.10.80.114
10.10.80.115
10.10.80.116
[rootoxidized ansible]# ansible all -m ping
10.10.80.111 | SUCCESS {ansible_facts: {discovered_interpreter_python: /usr/libexec/platform-python},changed: false,ping: pong
}
。。。
。。。
。。。
2、编写playbook剧本
[rootoxidized ansible]# cat zabbix.yml
- name: install zabbixhosts: alltasks:- name: copy zabbix-agent2_rpmcopy:src: /root/zabbix-agent2-6.4.0-release1.el7.x86_64.rpmdest: /root/zabbix-agent2-6.4.0-release1.el7.x86_64.rpm- name: copy zabbix.shcopy:src: /etc/ansible/zabbix-install.shdest: /root/zabbix-install.sh- name: install zabbix_agent2shell: sh /root/zabbix-install.sh
[rootoxidized ansible]# cat zabbix-install.sh
#!/bin/bash
cd /etc/yum.repos.d/ mkdir bak
mv *.repo bak/
cat /etc/yum.repos.d/local.repo EOF
[base]
nameNexus
baseurlhttp://10.10.200.20:8081/repository/yumHosted/
enabled1
gpgcheck0
EOFyum makecache fast
cd /root yum install -y zabbix-agent2-6.4.0-release1.el7.x86_64.rpm
systemctl start zabbix-agent2 systemctl start zabbix-agent2
systemctl status zabbix-agent2
if [ $? 0 ];thenecho zabbix has installed sucessfully!
elseecho zabbix is not running,please check it!exit 1
fi
sed -i s#Server127.0.0.1#Server10.10.80.101#g /etc/zabbix/zabbix_agent2.conf
sed -i s#ServerActive127.0.0.1#ServerActive10.10.80.101#g /etc/zabbix/zabbix_agent2.conf
sed -i s#HostnameZabbix server#Hostnamelocalhost#g /etc/zabbix/zabbix_agent2.conf
systemctl restart zabbix-agent2
if [ $? 0 ];thenecho zabbix has restarted sucessfully!
elseecho zabbix has restarted failed,please check it!exit 1
fi3、执行playbook
[rootoxidized ansible]# ansible-playbook zabbix.yml
查看执行结果0fails即成功。
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/915204.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!