DevOps Classroom notes 03/Nov/2024

Ansible contd

Activity 1

  • Write an ansible playbook to deploy a website
  • manual steps for ubuntu
sudo apt update
sudo apt install nginx -y
cd /tmp
wget https://www.free-css.com/assets/files/free-css-templates/download/page295/antique-cafe.zip
sudo apt install unzip -y
unzip antique-cafe.zip
sudo mv 2126_antique_cafe/ /var/www/html/cafe
  • Ansible Playbook
  • To execute Ansible playbook the command will be ansible-playbook -i hosts <playbook.yaml>
  • Ansible output will contain
    • play info
    • an additional task called as gather_facts
    • task info
  • The info will contain
    • ok
    • changed
    • unreachable
    • failed
    • skipped
    • rescued
    • ignored
  • We have written the playbook where we got the website deployed at url http://<publicip>/cafe/2126_antique_cafe

  • Ansible verbosity

Exercise:

  • Try installing apache and php
sudo apt update
sudo apt install apache2 -y
sudo apt install php libapache2-mod-php php-mysql

WOW (Ways of Working) – Playbook writing

  • Ensure you have working manual steps
  • Find a module for each step an represent as task

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