- Chef - Chef-Client Run
- Chef - Nodes
- Testing Cookbook with Test Kitchen
- Chef - ChefSpec
- Chef - Foodcritic
- Chef - Testing Cookbooks
- Chef - Chef-Shell
- Chef - Chef-Client as Daemon
- Chef - Environment
- Chef - Roles
- Chef - Cookbook Dependencies
- Chef - Cookbooks
- Chef - Solo Setup
- Chef - Knife Setup
- Chef - Test Kitchen Setup
- Chef - Client Setup
- Chef - Workstation Setup
- Chef - Version Control System Setup
- Chef - Architecture
- Chef - Overview
- Chef - Home
Advanced Chef
- Chef - Community Cookbooks
- Chef - Files & Packages
- Chef - Blueprints
- Lightweight Resource Provider
- Chef - Resources
- Chef - Cross-Platform Cookbooks
- Chef - Scripts for Data Bags
- Chef - Data Bags
- Chef - Environment Variable
- Chef - Definition
- Chef - Libraries
- Chef - Ruby Gems with Recipes
- Chef - Plain Ruby with Chef DSL
- Chef - Templates
- Dynamically Configuring Recipes
Chef Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Chef - Files & Packages
In Chef, creating configuration files and moving packages are the key components. There are multiple ways how Chef manages the same. There are multiple ways how Chef supports in deapng with the files and software packages.
Instalpng Packages from Third-Party Repo
Step 1 − Edit the default recipe of the cookbook.
vipin@laptop:~/chef-repo $ subl cookbooks/test_cookbook/recipes/default.rb include_recipe "apt" apt_repository "s3tools" do uri "http://s3tools.org/repo/deb-all" components ["stable/"] key "http://s3tools.org/repo/deb-all/stable/s3tools.key" action :add end package "s3cmd"
Step 2 − Edit the metadata to add dependency on the apt cookbook.
vipin@laptop:~/chef-repo $ subl cookbooks/my_cookbook/metadata.rb ... depends "apt"
Step 3 − Upload the modified cookbook to the Chef server.
Step 4 − Vapdate that the package you are trying to install, is not yet installed.
Step 5 − Vapdate the default repo.
Step 6 − Run Chef-Cpent on the node.
Step 7 − Vapdate that the required package is installed.
Instalpng Software from Source
If one needs to install a piece of software that is not available as a package for a given platform, one needs to compile it oneself. In Chef, we can do this by using the script resource.
Step 1 − Edit the default recipe.
vipin@laptop:~/chef-repo $ subl cookbooks/my_cookbook/recipes/ default.rb version = "1.3.9" bash "install_nginx_from_source" do cwd Chef::Config[ file_cache_path ] code ≪-EOH wget http://nginx.org/download/nginx-#{version}.tar.gz tar zxf nginx-#{version}.tar.gz && cd nginx-#{version} && ./configure && make && make install EOH
Step 2 − Upload the modified cookbook to the Chef server.
Step 3 − Run the Chef-Cpent on the node.
Step 4 − Vapdate that the nginx is installed.
Advertisements