DevOps Classroom notes 03/Feb/2026

Ways of Working – Ansible

  1. Ensure you have list of all the steps (commands) which are working.
  2. Take each command find equivelent module in Ansible
  3. Write a playbook (yaml) where we list the modules in a specific structure.

Summary

  • We need to know the playbook format i.e. YAML
  • Expressing modules in YAML form

Finding equivelent modules for commands in Ansible

  • Ansible has a very large set of modules
  • In addition to these modules ansible has a larger community of third party reusable assets
  • To find the right module lets do the exercise

Lets look at website installation steps

  • steps to install nginx
sudo apt update
sudo apt install nginx -y
sudo systemctl enable nginx.service
sudo systemctl start nginx.service
  • Now download the website
sudo apt install unzip
cd /tmp
wget https://templatemo.com/tm-zip-files-2020/templatemo_589_lugx_gaming.zip
unzip templatemo_589_lugx_gaming.zip
cd templatemo_589_lugx_gaming/
sudo cp --recursive . /var/www/html/
  • Google for <command> in ansible will work for 90% of the cases.
sudo apt update => apt update => command is apt  action is update
sudo apt install nginx -y => apt => command install is action
  • Any command
ping google.com
systemctl restart nginx
command <args>

Preview

  • Module name
    Preview
  • Parameters
    Preview
  • Examples: Will give basic usage
  • Prompt to understand command
You are linux expert, i will give you the command and explain what it does breifly

Lets list out command, equivelent module and necessary parameters

Command Module Parameters
apt update ansible.builtin.apt update_cache => true
apt install nginx ansible.builtin.apt state => present, name => nginx
systemctl enable nginx.service ansible.builtin.systemd_service enabled => true, name => nginx.service
sudo systemctl start nginx.service ansible.builtin.systemd_service name => nginx.service, state => started
apt install unzip
wget https://templatemo.com/tm-zip-files-2020/templatemo_589_lugx_gaming.zip ansible.builtin.get_url url, dest => /tmp/templatemo_589_lugx_gaming.zip.zip
unzip templatemo_589_lugx_gaming.zip ansible.builtin.unarchive src => url, remote_src => true, dest => /var/www/html/
  • Exercise: Findout steps to install tomcat 10 with openjdk 21 on ubuntu server and comeup with this table.

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
Animated Social Media Icons by Acurax Responsive Web Designing Company

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