Chef ~ Fuck You Puppet

echelon-quick-start/Vagrantfile at master · hornos/echelon-quick-start · GitHub myplanetdigital/vagrant-ariadne · GitHub

Chef ~ Fuck You Puppet

Move away, puppet: Configuration Management for Windows Converting Puppet Modules to Chef Cookbooks - redbluemagenta

Learning Chef - Part 1 - Nathen Harvey Learning Chef - Part 2 - Nathen Harvey Learning Chef - Part 3 - Nathen Harvey Learning Chef - Part 4 - Nathen Harvey

Undestand basics

Writing Your First Chef Recipe Sample chef-solo config for vagrant prototyping — Gist

Structure

Quick deploy with Chef-Solo and Git / unfoldthat.com An empty Chef recipe: opscode/chef-repo

Learn more

Provision your laptop with Chef: Part 1 - EngineerInk Provision your laptop with Chef: Part 2 - EngineerInk

DevOps Toolbox: Customizing Recipes for Our Application

Chef Style Guide

Foodcritic - A lint tool for your Opscode Chef cookbooks ampledata/cookbook-style-guide · GitHub secondmarket/chef-style-guide · GitHub Ironfan + Chef Style Guide · infochimps-labs/ironfan Wiki

Chef Recipes: Opscode Community

Interesting

Chef in Windows Windows - How I got git working with chef on windows — Gist Chef on Windows HTPC - jtimberman’s Code Blog

Restart Chef run (and node, and shell) site-cookbooks/restart at master · dreamcat4/site-cookbooks

Update to the latest Chef: Using Multiple Provisioners in Vagrant - jtimberman’s Code Blog

Encrypted Data Bags Encrypted Data Bag for Postfix SASL Authentication - jtimberman’s code blog

Local File Copy @ Execution

Stick this in a library file… How do I declare a Chef file resource whose contents depend on cookbook files? - Stack Overflow Configuration Based on Partial Convergence - Chef - Opscode Open Source Wiki

In the future, they will probably extend File resource, or create a new one: Discussion on the Chef configuration management suite ()

Apt and third party PPA’s

chef-xhprof/recipes/default.rb at master · msonnabaum/chef-xhprof · GitHub handle google-chrome repos · Issue #5 · cookbooks/apt

Solved problems

Checkout Git repository

How to Generate Git ssh wrapper to be used with Chef

Problem with SSH identity: carlo/chef-keys · GitHub fnichol/chef-user · GitHub opscode-cookbooks/users · GitHub

SSH Wrapper (for Git as $GIT_SSH) Simpler: mccraigmccraig/chef-ssh-wrapper · GitHub cwjohnston/chef-deploy_wrapper · GitHub Using deploy_wrapper to set the stage for deployments via Chef - rooted - a code blog

But, at the end, I decided to do it manually deploy — Chef Docs opscode-cookbooks/application · GitHub

Timezone

Timezone · jamesotron/cookbooks

Edit Config Files

Chef::Util::FileEdit Chef: How to insert or append a line to a file | TheLastMile cookbooks/dynect/recipes/ec2.rb at master · opscode/cookbooks · GitHub Getting a little crazy with FileEdit – Jason’s postings and stuff Cookbook based on FileEdit: gecos-team/cookbook-conf · GitHub

With bash: How-to Write a Chef Recipe for Editing Config Files | LZone Easy way to edit configuration file with Chef

And maybe I could include Gem at runtime, and use Ruby Gem inifile Cool Chef Tricks: Install and Use RubyGems in a Chef Run

PHP & LAMP

inviqa/chef-php-extra · GitHub

r8/vagrant-lamp · GitHub daveWid/Lamp-Chef-Cookbooks · GitHub

Lighttpd

webpy.github.com/cookbook/fastcgi-lighttpd.md at master · webpy/webpy.github.com · GitHub

Editing /ets/hosts file

The best one: customink-webops/hostsfile · GitHub /etc/hosts Management with Chef - EngineerInk

Dynamic hosts file using Chef | powdahound.com

Others: spheromak/hosts-cookbook · GitHub hw-cookbooks/hosts_file · GitHub shared-cookbooks/hosts at master · automatedlabs/shared-cookbooks · GitHub

Thrift

Chef Recipe: opscode-cookbooks/thrift cookbooks/thrift · GitHub

Zookeeper

Loop though key value pairs - Stack Overflow

Mail

MailCatcher doesn’t care what the addresses are, it just grabs the email and shows it to you.

Test sending mail:

echo ‘Message text’ | mail -s “Automatic mail sending from terminal” cvladan@gmail.com

MailCatcher sj26/mailcatcher · GitHub Mailcatcher for Drupal and other PHP-applications - The simple version Chef Recipe - r8/vagrant-lamp · GitHub

Percona MySQL Tools

This one I like more: phlipper/chef-percona · GitHub customink-webops/percona-install · GitHub

Mount Windows shares

Very good example how to make vagrant plugin for CIFS: psi/vagrant-zfs · GitHub

You need mount “/srv/vagrant-on-windows” do device “//192.168.7.1/vagrant-on-windows” fstype “cifs” options “guest,rw,exec,noperm,nocase,noserverino,uid=1000,gid=1000” action :mount end

Mount options used: rw: mount read-write guest: don’t prompt for a password noperm: Client does not do permission checks nocase: Case insensitive path name matching noserverino: Client generates inode numbers (rather than using the actual one from the server) uid, gid: Files and dirs will appear to be owned by vagrant user

mount.cifs

Chef Improvements ~ Enhancements

Spatula

gem install spatula
spatula search lighttpd

But on spatula install breaks on spaces in username.

LittleChef

apt-get install python-pip python-dev
pip install littlechef
fix new_kitchen
  • config.cfg: Configuration, including authentication and run-time options.
  • nodes/: After recipes are run on Nodes, their configuration is stored here in JSON format. You can manually edit them or even add new ones. The name of a node should be its FQDN
  • cookbooks/: This will be your Cookbooks repository
  • site-cookbooks/: Here you can override upstream cookbooks (Opscode’s, for example)
  • roles/: Where Chef Roles are defined in JSON
  • data_bags/: Chef Data Bags. JSON databag items. Search is supported
  • plugins/: Your plugin tasks

knife-solo

knife solo init

Problem of reusable cookbooks

How to Write Reusable Chef Cookbooks, Gangnam Style bryanwb/chef-rewind · GitHub

DevOps Notes: How to write a good Chef cookbook

Deep Merge — Chef Docs

Cookbook Shadowing Feature is officially deprecated.

But you could achieve the similar with…

bryanwb/chef-rewind · GitHub

Or the same idea, only specific:

#CHEF-2308 - shadowing feature officially deprecated

Directory structures

A blank Chef repository

opscode/chef-repo · GitHub doitian/chef-solo-repo · GitHub FLOSolutions/fga-chef-repo · GitHub

Nice tutorial on chef

https://github.com/opscode/chef-fundamentals/tree/master/slides

date 01. Jan 0001 | modified 28. May 2021
filename: Chef - Fuck You Puppet