说明:
先下载好对应版本的tomcat放到本地目录,然后通过playbook传输进行远程安装
playbook如下,要注意格式问题,这个playbook远程部署了3个 tomcat一样实例,
项目可以根据需要,去启动1-3个实例,并更改下端口
- hosts: 10.10.84.5
tasks:
- name: install-jdk1.8
yum: name=java-1.8.0-openjdk state=present
- name: copytomcat
copy: src=/root/apache-tomcat-8.5.51.tar.gz dest=/usr/local mode=0755
- name: unarchive-tomcat.tar.gz
unarchive: src=/usr/local/apache-tomcat-8.5.51.tar.gz dest=/usr/local copy=no mode=0755
- name: cp tomcat
shell: cd /usr/local && cp -r apache-tomcat-8.5.51 tomcat1 && cp -r apache-tomcat-8.5.51 tomcat2 && cp -r apache-tomcat-8.5.51 tomcat3