User Tools

Site Tools


devops:chef

Table of Contents

Chef

Implements Structure As a Service.

For Chef to work it requires three main elements:

  1. Ordered List Itema Chef Server,
  2. one (or more) nodes,
  3. and at least one workstation.
ReceiptsChef relies on reusable definitions known as recipes to automate infrastructure tasks. Examples of recipes are instructions for configuring web servers, databases and load balancers. Together, recipes describe what your infrastructure consists of and how each part of your infrastructure should be deployed, configured and managed.
RessourcesRecipes use building blocks called resources. A resource describes some piece of infrastructure, such as a file, a template, or a package to be installed.
Chef-ServerThe Chef server stores your recipes as well as other configuration data. The Chef server acts as a hub that is available to every node in the organization to make use of recipes and configuration data.
NodeA node can be a physical server, a virtual server or a cloud instance. Nodes are managed by Chef-Server, according to associated receipts.
Chef ClientOnce the node is connected to a Chef Server it periodically polls the Chef Server using a tool called Chef Client for the latest recipes and checks to see if the node is in compliance with the policy defined by these recipes. If the node is out of date, the Chef Client runs them on the node to bring it up to date. The Chef Client is installed on each node in your network requiring automated configuration.
BootstrappingThe nodes are connected to a Chef Server through a process called bootstrapping. The bootstrapping is just an installation of chef-node-software on a PC from a Workstation, using Knife-Tool
Work stationUsed for Administrations of receipts. The work station, usually a laptop, is the location from which recipes and other chef configuration files are authored and synchronized with a git repository known as Chef-Repo that stores the files. The work station can also be used to bootstrap nodes to the Chef Server.
Knife

knife is a command-line tool that provides an interface between a Workstation, local chef-repo and the Chef server. knife helps users to manage:

  • Nodes
  • Cookbooks and recipes
  • Roles
  • Stores of JSON data (data bags), including encrypted data
  • Environments
  • Cloud resources, including provisioning
  • The installation of the chef-client on management workstations
  • Searching of indexed data on the Chef server
CookBook A collection of receipts. E.g. “everything for the DB Server” or “Cloud Setup”
RolesRole can be assigned to a node.
A role is a way to define certain patterns and processes that exist across nodes in an organization as belonging to a single job function.
When a chef-client runs, it merges its own attributes and run-lists with those contained within each assigned role.
Databag

A data bag is a global variable that is stored as JSON data and is accessible from a Chef server.

A data bag is a container of related data bag items, where each individual data bag item is a JSON file. knife can load a data bag item by specifying the name of the data bag to which the item belongs and then the filename of the data bag item.

When the chef-repo is cloned from GitHub, the following occurs:

  • A directory named data_bags is created.
  • For each data bag, a sub-directory is created that has the same name as the data bag.
  • For each data bag item, a JSON file is created and placed in the appropriate sub-directory.
devops/chef.txt · Last modified: 2023/11/01 07:15 by skipidar