您好,登錄后才能下訂單哦!
這篇文章主要講解了“Ansible怎么部署Tomcat”,文中的講解內(nèi)容簡單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“Ansible怎么部署Tomcat”吧!
Ansible的特性:
ansible機(jī)器:192.168.52.34
目標(biāo)主機(jī):192.168.52.35
目標(biāo)主機(jī):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: 關(guān)閉防火墻 shell: systemctl stop firewalld - name: 關(guān)閉selinux shell: setenforce 0 - name: 推送jdk Java環(huán)境 copy: src=jdk-8u131-linux-x64_.rpm dest=/root - name: 創(chuàng)建文件夾 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: 啟動(dòng)tomcat shell: nohup /opt/tomcat/apache-tomcat-8.5.35/bin/startup.sh
[root@localhost ~]# ansible-playbook --syntax-check tomcat.yml#這個(gè)是警告的意思可以忽略[WARNING]: Could not match supplied host pattern, ignoring: tomcat playbook: tomcat.yml [root@localhost ~]#
[root@localhost ~]# ansible-playbook tomcat.yml
感謝各位的閱讀,以上就是“Ansible怎么部署Tomcat”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對(duì)Ansible怎么部署Tomcat這一問題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是億速云,小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。