ansible部署Tomcat
首先要准备的环境就是免密登录
这是要在ansible-playbook中所写的内容
---
- hosts: tomcat
tasks:
- name: 关闭防火墙
service: name=iptables state=stopped
- name: 关闭selinux
shell: setenforce 0
- name: 安装所需的软件
yum: name=tar,libselinux-python state=latest
- 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 &