DevOps Classroomnotes 24/Mar/2022

Ansible Contd

  • Lets try to install tomcat 9 with open jdk 11
  • We have two linux distributions
    • ubuntu 20.04
    • Redhat 7.x
  • Ubuntu Tomcat manual implementation Refer Here
  • Useradd: sudo useradd -m -U -d /opt/tomcat -s /bin/false tomcat
    • -m create home directory
    • -U create a group with the same name as the user
    • -d home directory (/opt/tomcat)
    • -s login shell for the user /bin/false
    • tomcat => username
  • Lets find a ansible module for useradd Refer Here
  • Refer Here for examples of user module
  • Refer Here
  • We got the following failure group doesnot exists
    Preview
  • We have two options, create a group or donot pass group parameter. Refer Here for the changeset
    Preview
  • Now lets login and check the user details on the ubuntu node by executing cat /etc/passwd
    Preview
  • Download the tomcat to the /tmp directory
VERSION=9.0.60
wget https://dlcdn.apache.org/tomcat/tomcat-9/v${VERSION}/bin/apache-tomcat-${VERSION}.tar.gz -P /tmp

Preview
* The module for downloading from web is get_url Refer Here
* Refer Here for the changes done
Preview
* Now lets manually verify this
Preview

  • Extract the tar file
sudo tar -xf /tmp/apache-tomcat-${VERSION}.tar.gz -C /opt/tomcat/
  • Create a link to the new folder
sudo ln -s /opt/tomcat/apache-tomcat-${VERSION} /opt/tomcat/latest

Preview
* Now change the folder permissions

sudo chown -R tomcat: /opt/tomcat
sudo sh -c 'chmod +x /opt/tomcat/latest/bin/*.sh'

Leave a Reply

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

About continuous learner

devops & cloud enthusiastic learner