Chef MasterClass
Chef - Configuration Management
Imperative vs Declarative Approach
- Imperative == Shell Script
- Declarative == Chef
Push based vs Pull Based Deployments
Push Based = Ansible, SaltStack
- Master server pushes the configurations and softwares to the individual servers
Pull Based = Chef, Puppet
- Individual servers establishes connection with the master server and downloads, installs their required updates whenever needed.
- Configuration pull is initiated by agent at regular intervals
Chef - Ruby based IT automation tool
Chef Deployment Model
Server-Client - Production use cases
- Master Server can only be Linux
- Client/Nodes can be Windows or Linux
Chef Zero - Development, Testing, POC
user 'username' do
action: create
end
Install and configure httpd webserver
### Web Server Installation
package 'httpd' do
action :install
end
### Web Server File Confirguration
file '/var/www/html/index.html' do
content "Getting started with Chef\n"
action :create
end
### Web Server Service Startup
service 'httpd' do
action :start
end
Chef Components
- Chef-Workstation
- Chef Server
- Chef-Client/Node
Chef Workstation
- Local Development Platform used to create, test and apply chef codes.
- Can be a local desktop or laptop with Chef DK (or) Chef Development Kit installed on it.
- Can be used as Chef Zero for developing, testing and validating chef codes before promoting to production.
Chef Server
- It is a node which has Chef server installed and configured.
- It manages chef code in a centralized location.
- Chef Workstation pushes the cookbooks to the Chef Server.
Chef Client
- The client node connects to the chef server and pulls the required configuration files and configures them locally.