12/1/2021

Ansible Tomcat

Aim

Get your hands dirty with Ansible installation and setup.
Use it to restart Tomcat to get upto speed.

Environment
Local box – MacOS (Ansible will be installed here)
Target box – kochi (192.168.2.5 – Laptop running Ubuntu)
Tomcat on kochi /home/jeljo/tomcat8A

Installation on MacOS

Ansible playbook to install java and tomcat in a remote host.Join our DevOps hands-on series to get hands-on experience in creating a fully automated assembl. Ansible ad hoc commands are one-liners designed to achieve a very specific task they are like quick snippets and your compact swiss army knife when you want to do a quick task across multiple machines. To put simply, Ansible ad hoc commands are one-liner Linux shell commands and playbooks are.

Local box :

Ansible Tomcat

Setup the Public key

Copy the public key to target box

Test by logging into the Target box.

Inventory Setup

Configure the hosts to be managed.

Local box

Testing

Output :

Ansible Tomcat Start

A verbose view for troubleshooting in case of issues :

Ansible Tomcat

Playbook Setup

Ansible Tomcat

Using Ansible with Tomcat

Creating the playbook

Note:

If you get an error related to JAVA_HOME path

Ansible Tomcat Deploy War

just update the catalina.sh script with the path to you java location.
For Example :
JAVA_HOME=/opt/java

References :
http://docs.ansible.com/ansible/latest/intro_getting_started.html
http://docs.ansible.com/ansible/latest/YAMLSyntax.html
http://www.thegeekstuff.com/2008/11/3-steps-to-perform-ssh-login-without-password-using-ssh-keygen-ssh-copy-id
http://docs.ansible.com/ansible/latest/service_module.html
https://groups.google.com/forum/#!topic/ansible-project/wf-UOtPOuKk
https://stackoverflow.com/questions/40310064/how-to-run-tomcat-using-ansible