DevOps Classroom Series – 29/Oct/2021

Chef-Client

  • Lets login into the chef nodes and understand what has installed Preview

Chef-Workstation

  • One or more workstations are configured to allows users to work with chef
  • The users in chef develop
    • cookbooks:
      • Has recipes, which in turn has chef resources placed in some order.
  • The Chef infra language is based on Ruby, chef has its own DSL (Domain specific language) to express our desired state.
  • Step 1: Create a cookbook Preview Preview Preview
  • Step 2: Examine the contents of the cookbook folder Preview
  • Step 3: Configure Visual Studio Code with Chef Extension Preview Preview
  • Step 4: Find a resource to create a file on the node Refer Here Preview
  • Step 5: Understand Resource Syntax
<resource type> '<name>' do
    <property>  <value>
    ...
    <action>
end
  • Step 6: Lets create a file in /tmp/fromchef & for this lets write the following in recipes\default.rb
file '/tmp/fromchef' do
    action :touch
end
  • Step 7: Lets upload our cookbook to chef server:
berks install
berks upload

Preview

  • Step 8: Verify whether cookbooks are uploaded or not Preview
  • Step 9: Configuring this cookbook to be executed on our nodes
    • Every node has a run_list which specifies the recipes to be executed when the node communicates (asks) the server
    • Now lets change run_list for the azure node Preview Preview Preview Preview
    • Whenever azure node tries to speak with chef server, our recipe will be executed. In this cases rather than waiting for azure node to communicate with chef server, lets manually try to do this by logging into azure node.
    • when node wants to speak with chef-server the following command is executed sudo chef-client Preview Preview
  • Step 10: Do the same for aws node Preview

Leave a Reply

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

Please turn AdBlock off
Social Media Icons Powered by Acurax Web Design 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