Ansible Role: Tomcat
安裝tomcat應(yīng)用
要求
此角色僅在RHEL及其衍生產(chǎn)品上運(yùn)行雅宾。
測(cè)試環(huán)境
ansible 2.4.2.0
os Centos 7.2 X64
python 2.7.5
角色變量
software_files_path: "/opt/software"
software_install_path: "/usr/local"
java_home: "{{ ansible_env.JAVA_HOME | default('/usr/java/jdk1.7.0_80') }}"
tomcat_version: "7.0.85"
tomcat_file: "apache-tomcat-{{ tomcat_version }}.tar.gz"
tomcat_path: "{{ software_install_path }}/apache-tomcat-{{ tomcat_version }}"
tomcat_file_path: "{{ software_files_path }}/{{ tomcat_file }}"
tomcat_file_url: "http://archive.apache.org/dist/tomcat/tomcat-7/v{{ tomcat_version }}/bin/apache-tomcat-{{ tomcat_version }}.tar.gz"
tomcat_enabled: true
tomcat_server_active: false
tomcat_ajp_active: false
tomcat_hostname: localhost
tomcat_user: tomcat
tomcat_server_port: 8005
tomcat_catalina_port: 8080
tomcat_catalina_ajp_port: 8009
tomcat_catalina_redirect_port: 8443
tomcat_unpackWARs: true
tomcat_autoDeploy: true
tomcat_services_name: "tomcat{% if tomcat_catalina_port != 8080 %}{{ tomcat_catalina_port }}{% endif %}"
tomcat_work_path: "{{ software_install_path }}/{{ tomcat_services_name }}"
tomcat_daemon_native_path: "{{ tomcat_work_path }}/bin/commons-daemon-1.1.0-native-src"
tomcat_catalina_opts: "-server -Xms1024m -Xmx1024m -XX:PermSize=256M -XX:MaxNewSize=256m -XX:MaxPermSize=256m -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -Djava.awt.headless=true"
依賴
java
github地址
https://github.com/kuailemy123/Ansible-roles/tree/master/tomcat
Example Playbook
安裝tomcat7
- hosts: node1
roles:
- tomcat
- hosts: node1
roles:
- { role: tomcat, tomcat_catalina_port: 8081}
- { role: tomcat, tomcat_catalina_port: 8082}
安裝tomcat8
- hosts: node1
vars:
- java_version: "1.8"
- tomcat_version: "8.5.28"
roles:
- java
- tomcat
使用
centos 6
service tomcat
Usage: tomcat ( commands ... )
commands:
run Start Tomcat without detaching from console
start Start Tomcat
stop Stop Tomcat
version What version of commons daemon and Tomcat
are you running?
centos 7
systemctl start tomcat
systemctl status tomcat
systemctl stop tomcat