ansible
6 years, 5 months ago
---
- name: install apache
hosts: XXX
sudo: yes
tasks:
- name: add repo for java 8
sudo: yes
apt_repository: repo='ppa:webupd8team/java' state=present
- name: set licence selected
shell: /bin/echo debconf shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
sudo: yes
- name: set licence seen
shell: /bin/echo debconf shared/accepted-oracle-license-v1-1 seen true | /usr/bin/debconf-set-selections
sudo: yes
- name: install java 8
apt: name=oracle-java8-installer state=latest update-cache=yes force=yes
sudo: yes
- name: Download Tomcat
sudo: yes
get_url: url=http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.61/bin/apache-tomcat-7.0.61.tar.gz dest=/opt/apache-tomcat-7.0.61.tar.gz
- name: Extract archive
command: chdir=/usr/share /bin/tar xvf /opt/apache-tomcat-7.0.61.tar.gz -C /opt/ creates=/opt/apache-tomcat-7.0.61
- name: Symlink install directory
file: src=/opt/apache-tomcat-7.0.61 path=/usr/share/tomcat state=link
- name: install tomcat
apt: name=apache2 state=latest update-cache=yes force=yes
- name: Configure Tomcat server
template: src=server.xml dest=/usr/share/tomcat/conf/
- name: Change ownership of Tomcat installation
file: path=/usr/share/tomcat/ state=directory recurse=yes
- name: Configure Tomcat users
template: src=tomcat-users.xml dest=/usr/share/tomcat/conf/
- name: Install Tomcat init script
copy: src=tomcat-initscript.sh dest=/etc/init.d/tomcat mode=0755
- name: Start Tomcat
service: name=tomcat state=started enabled=yes
0 Comments
Please Login to Comment Here