DevOps Classroom Series – 20/Jan/2021

Scenario: Configure LAMP Server

  • Linux Apache Server and mysql (LAMP Stack)
  • Generate a cookbook
  • Now lets generate a recipe for installing lamp in ubuntu server
  • Now lets configure kitchen.yaml file to create an ubuntu instance in aws
  • Refer Here for the change set
  • Now lets execute kitchen create
  • Now lets write down manual linux commands to be executed to configure lamp server
sudo apt update
sudo apt install apache2
sudo apt install php libapache2-mod-php php-mysql php-cli
sudo systemctl restart apache2
# Create a file in /var/www/html/info.php with the following content
<?php
phpinfo();
?>
  • In Chef to perform steps we have resource. Resource is a statement of configuration that describes the desired state
  • Resource Syntax
type 'name' do
   attribute 'value'
   action :type_of_action
end
  • Refer Here for chef resource documentation
  • Refer Here for the Resources reference
  • We can find resource for manual command
    • by searching in resources section
    • by searching in google
  • Ensure Chef Extension to Visual studio code is installed
  • To install visual studio and other softwares required Refer Here
  • Refer Here for the first step automation & now lets converge using kitchen converge
  • Now lets move to the next step Refer Here for the changeset. Now lets converge
  • Now lets verify if apache is installed or not
  • Now lets try to configure for the step sudo apt install php libapache2-mod-php php-mysql php-cli -y
  • Refer Here for the changes and perform convergence
  • Refer Here for the changes and perform convergence
  • We were able to perform lamp installation on ubuntu and verify it manually using test kitchen
  • Our cookbook might not be effective at this point of time
    • Our recipe has to use loops to become effective
    • Our cookbook is restarting apache during every convergane which is not a good sign
  • So in our next session we will learn how to overcome this and also learn more about chef resources
  • Exercise: Create a new recipe lamp_centos and try to automate the steps mentioned Refer Here
    • AMI ID for centos 7 in us-west-2 is ami-0bc06212a56393ee1

Leave a ReplyCancel reply

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

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%%