批量安装一个tomcat
- hosts: all
tasks:
- name: 01-create jdk dir
file: path=/opt/jdk state=directory
- name: 02-create tomcat dir
file: path=/opt/tomcat state=directory
- name: 03-decom jdk to remote hosts
unarchive: src=../ansible-file/jdk-8u161-linux-x64.tar.gz dest=/opt/jdk
- name: 04-decom tomcat to remote hosts
unarchive: src=../ansible-file/apache-tomcat-8.5.43.tar.gz dest=/opt/tomcat
- name: 05-create jdk path
lineinfile: path=/etc/profile regexp='^export JAVA_HOME=' line='export JAVA_HOME=/opt/jdk/jdk1.8.0_161'
- name: 06-create jdk path2
lineinfile: path=/etc/profile regexp='^export export PATH=' line='export PATH=$JAVA_HOME/bin:$PATH'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14