DevOps Classroom notes 11/Oct/2023

Ansible Contd

Activity 5: Install tomcat 10 server

  • Target environments:

    • ubuntu
    • redhat
  • References

  • Ubuntu Manual Steps:
sudo apt update
sudo apt install openjdk-11-jdk -y
sudo useradd -m -U -d /opt/tomcat -s /bin/false tomcat
# create user with following information
# username = tomcat
# group = tomcat
# homedir = /opt/tomcat
# shell = /bin/false
MAJOR_VERSION="10"
VERSION="10.1.14"
wget "https://dlcdn.apache.org/tomcat/tomcat-${MAJOR_VERSION}/v${VERSION}/bin/apache-tomcat-${VERSION}.tar.gz" -P /tmp
# download tomcat tar to /tmp
# file path: /tmp/apache-tomcat-10.1.14.tar.gz
sudo tar -xf /tmp/apache-tomcat-${VERSION}.tar.gz -C /opt/tomcat/
# extract tar file to /opt/tomcat
sudo ln -s /opt/tomcat/apache-tomcat-${VERSION} /opt/tomcat/latest
# Create a link for /opt/tomcat/apache-tomcat-10.1.14 to /opt/tomcat/latest
sudo chown -R tomcat: /opt/tomcat
# transfer of ownership to tomcat user
sudo sh -c 'chmod +x /opt/tomcat/latest/bin/*.sh'
# Add execute permissions to all scripts in bin directory
  • Creating service files will be done at a later point of time

Ansible implementations

  • Refer Here for the changes done to install java and create group and user
  • We ran into issue with quotes Refer Here for the fix
  • After checking syntax and dry run, execute the ansible playbook
    Preview
  • Refer Here for the changes to download the tomcat
  • Exercise:

    • Fail this playbook if it is executed on any os other than ubuntu
    • Add a debug statement showing inforamation
      Installed jdk 11 using package openjdk-11-jdk
      create a user tomcat
      create a group tomcat
      download the tomcat 10.1.14 to /tmp folder

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Customized Social Media Icons from Acurax Digital Marketing Agency

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube