DevOps Classroom Series – 29/Oct/2021

Chef-Client

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

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
  • Step 2: Examine the contents of the cookbook folder
  • Step 3: Configure Visual Studio Code with Chef Extension
  • Step 4: Find a resource to create a file on the node Refer Here
  • 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

  • Step 8: Verify whether cookbooks are uploaded or not
  • 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
    • 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
  • Step 10: Do the same for aws node

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