Lets Use Ansible to deploy a Java application on Tomcat server (Contd…)
sudo apt update
sudo apt install openjdk-8-jdk -y
sudo apt install tomcat9 -y
wget https://referenceapplicationskhaja.s3.us-west-2.amazonaws.com/gameoflife.war
sudo cp gameoflife.war /var/lib/tomcat9/webapps/
sudo systemctl restart tomcat9.service
---
- name: deploy game of life
become: yes
hosts: all
tasks:
- name: update ubuntu packages
ansible.builtin.apt:
name: openjdk-8-jdk
update_cache: yes
state: present
- The modules used to acheive the tomcat9 installation and game of life configuration:
- Refer Here for the changes done.
- Syntax check:

- Run the playbook

- Issue: When we run this playbook the java 11 is getting installed and gameof life is not working


- Exercise -1: The issue observed in the class is due to ubuntu 22.04. Can you try executing the playbook on ubuntu 20.04
- Try writing the ansible playbook for the following manual steps
$ sudo apt update
$ sudo apt install apache2 -y
# echo '<h1> Hello </h1>' > /var/www/html/info.html
=> http://<public-ip>
=> http://<public-ip>/info.html