DevOps Classroom notes 02/Nov/2026

Playbook

  • playbook is collection tasks. it will return in yaml format

  • first we need know manual steps for your task

  • every command will be invidual task

Keypoints:

  • playbook need name for you playbook
  • hosts – when we need perform action
  • sudo permission beacome: yes or no
    • define sudo permission on file level
    • task level sudo permissions
  • task- what activity need to do
    • asible buildin modules
    • Parameters – input to task module
    • Attributes – get information form os level
---
- name: apache2
  hosts: all
  become: yes
  tasks:
    - name: Install Apache2
      ansible.builtin.apt:
        name: apache2
        state: present
      update_cache: yes
    
    - name: start apache2 service
      ansible.builtin.service:
        name: apache2
        state: restarted
        enabled: yes
sudo apt update && sudo apt install apache2 -y 
sudo apt install wget unzip -y 
#  https://templatemo.com/
cd /temp
wget https://templatemo.com/tm-zip-files-2020/templatemo_586_scholar.zip
unzip templatemo_586_scholar.zip
cp -rf templatemo_586_scholar/* /var/www/html
sudo systemctl restart apache2 

Leave a comment

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
Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube