这篇文章主要讲解了“Ansible怎么部署Tomcat”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“Ansible怎么部署Tomcat”吧!
Ansible的特性:
ansible机器:192.168.52.34
目标主机:192.168.52.35
目标主机:192.168.52.36
[root@localhost ~]# systemctl stop firewalld[root@localhost ~]# setenforce 0
yum -y install ansible
vim /etc/ansible/hosts## [webservers]## alpha.example.org## beta.example.org## 192.168.1.100## 192.168.1.110[tomcat] 192.168.52.35 192.168.52.36# If you have multiple hosts following a pattern you can specify# them like this:## www[001:006].example.com
[root@localhost ~]# rz[root@localhost ~]# rz[root@localhost ~]# lsanaconda-ks.cfg apache-tomcat-8.5.35.tar.gz jdk-8u131-linux-x64_.rpm original-ks.cfg [root@localhost ~]#
[root@localhost ~]# vim tomcat.yml--- - hosts: tomcat tasks: - name: 关闭防火墙 shell: systemctl stop firewalld - name: 关闭selinux shell: setenforce 0 - name: 推送jdk Java环境 copy: src=jdk-8u131-linux-x64_.rpm dest=/root - name: 创建文件夹 file: path=/opt/tomcat state=directory - name: 推送tomcat的压缩包 unarchive: src=apache-tomcat-8.5.35.tar.gz dest=/opt/tomcat - name: 安装jdk yum: name=jdk-8u131-linux-x64_.rpm state=installed - name: 启动tomcat shell: nohup /opt/tomcat/apache-tomcat-8.5.35/bin/startup.sh
[root@localhost ~]# ansible-playbook --syntax-check tomcat.yml#这个是警告的意思可以忽略[WARNING]: Could not match supplied host pattern, ignoring: tomcat playbook: tomcat.yml [root@localhost ~]#
[root@localhost ~]# ansible-playbook tomcat.yml
感谢各位的阅读,以上就是“Ansible怎么部署Tomcat”的内容了,经过本文的学习后,相信大家对Ansible怎么部署Tomcat这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是亿速云,小编将为大家推送更多相关知识点的文章,欢迎关注!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。