DevOps Classroomnotes 28/May/2023

Ansible contd..

Activity 2: Installing lamp server on ubuntu

  • Note: we will skip mysql installation for now
  • Manual steps are
sudo apt update
sudo apt install apache2 -y
sudo apt install php libapache2-mod-php php-mysql -y
# Create a file called as /var/www/html/info.php with below content
# <?php phpinfo(); ?>
sudo -i
echo '<?php phpinfo(); ?>' > /var/www/html/info.php
exit
sudo systemctl restart apache2
  • Refer Here for the changset containing playbook, inventory and file
  • Check for syntax of playbook
ansible-playbook -i <inventory-path> --syntax-check <playbook-path>
  • Now lets run the playbook ansible-playbook -i <inventory-path> <playbook-path>
  • Verify the installation
  • Problems to be addressed
    • during every playbook execution the apache service is getting restarted

Activity 3: Install lamp stack on Redhat 9

  • Manual steps
sudo yum install httpd -y
sudo systemctl enable httpd
sudo systemctl start httpd
sudo yum install php -y
sudo -i
echo '<?php phpinfo(); ?>' > /var/www/html/info.php
exit
sudo systemctl restart httpd
  • Refer Here for the changeset for redhat
  • Execute playbook
  • Problems
    • during every playbook execution the apache service is getting restarted
    • Why should we have two inventory files one for ubuntu and one for redhat
    • Can we have one playbook for both redhat and ubuntu
    • Bailout with proper failure message for unsupported operating systems

Exercies

  • Write playbooks to install the following on ubuntu 22.04
    • java 17
    • .net 7
    • nginx
Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a ReplyCancel reply

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

Please turn AdBlock off
Customized Social Media Icons from Acurax Digital Marketing Agency

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Exit mobile version
%%footer%%