DevOps classroom notes 10/July/2024

Ansible Playbook

  • Fact: This represents some information about a node Refer Here
  • Ansible has a module called as setup which can collect all the facts fo a node Refer Here

Gathering facts using setup module

  • create a inventory file called as hosts
node-2
  • lets execute this command ansible -i hosts -m setup all
  • you can also user regular expressions ansible -i hosts -m setup -a "filter=*os*" all

Activity: Installing tomcat on ubuntu 22.04

sudo apt update
# install java 11
sudo apt install openjdk-11-jdk -y
  • Refer Here for the changes in playbook
  • Lets perform syntax check
ansible-playbook -i hosts ubuntu.yaml --syntax-check
  • We can perform dry run i.e. approximately what happens when you execute playbook
ansible-playbook -i hosts ubuntu.yaml --check
  • Now execute the playbook
ansible-playbook -i hosts ubuntu.yaml
  • Now test by executing java -version on the node
  • Verbosity levels in ansible Refer Here
  • Exercise: How many v’s can i add
  • Creating a system user Refer Here
  • Manual steps
sudo useradd -m -U -d /opt/tomcat -s /bin/false tomcat
  • This is equivalent to
    • create a group called tomcat
    • create a user called as tomcat
    • home directory /opt/tomcat
    • shell is /bin/false
  • Refer Here for the changes done to the playbook
  • Downloading tomcat: Refer Here for manual steps
VERSION=10.1.25
wget https://www-eu.apache.org/dist/tomcat/tomcat-10/v${VERSION}/bin/apache-tomcat-${VERSION}.tar.gz -P /tmp
Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a comment

Turn on JavaScript to leave a comment.

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

Please turn AdBlock off
Social Network Integration by Acurax Social Media Branding Company
Exit mobile version
%%footer%%