DevOps Classroom Series – 20/Jan/2021

Scenario: Configure LAMP Server

  • Linux Apache Server and mysql (LAMP Stack)
  • Generate a cookbook Preview
  • Now lets generate a recipe for installing lamp in ubuntu server Preview Preview Preview Preview
  • Now lets configure kitchen.yaml file to create an ubuntu instance in aws
  • Refer Here for the change set
  • Now lets execute kitchen create Preview
  • 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
  • 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
  • Refer Here for chef resource documentation
  • Refer Here for the Resources reference
  • We can find resource for manual command
    • by searching in resources section Preview
    • by searching in google Preview
  • Ensure Chef Extension to Visual studio code is installed Preview
  • To install visual studio and other softwares required Refer Here
  • Refer Here for the first step automation & now lets converge using kitchen converge Preview
  • Now lets move to the next step Refer Here for the changeset. Now lets converge Preview
  • Now lets verify if apache is installed or not Preview Preview
  • 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 Preview
  • Refer Here for the changes and perform convergence Preview Preview
  • 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 Preview
  • 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 Reply

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

About learningthoughtsadmin