1. First you need to install git as your version control system.[TERMINAL]
OSX: In OSX can install this with xcode .
2. Install wget to download the chef-repo template from the Opscode page[TERMINAL]
curl -O http://ftp.gnu.org/gnu/wget/wget-1.15.tar.gz
tar -zxvf wget-1.15.tar.gz
sudo make install
rm -rf ~/Downloads/wget*
3. Set up up Github to store and manage your chef-repo and share it with others[TERMINAL]
ssh-keygen -t rsa -C "email@example.com" #press just enter and when ask give type you passphrase
eval "$(ssh-agent -s)"
pbcopy < ~/.ssh/id_rsa.pub #copies the key to your clipboard go to github.com and set the key up there
ssh -T firstname.lastname@example.org #test it
4. Set up chef-repo, download template from Obscode and upload it to github[TERMINAL]
cd ~/ #go to home directory
tar zvf master -x
mv opscode-chef-repo-f9d4b0c/ chef-repo
git init .
git remote add origin email@example.com:den53/chef-repo.git
git add .
git commit -m "initial commit"
git push -u origin master
For a deep introduction to git and github I suggest https://www.udacity.com/course/ud775
￼5. Install Chef on your terminal/workstation[TERMINAL]
This will download Ruby and all the required Ruby gems into /opt/chef/ embedded. By adding the /opt/chef/embedded/bin directory to your .bash_profile, the Chef command-line tools will be available in your shell.
curl -L https://www.opscode.com/chef/install.sh | sudo bash
echo 'export PATH="/opt/chef/embedded/bin:$PATH"'>> ~/.bash_profile && source ~/.bash_profile
￼6. Setup a Chef Server on Obscode (alternatively you can set up your private hosted Chef server)[SERVER]
Go to Hosted Chef (https://www.getchef.com/chef/choose-your-version/) and sign up. After registering your account, it is time to prepare your organization to be used with your chef-repo repository.
Go to http://manage.opscode.com/organizations login and download the validation key and configuration file. Now regenerate the validation key for your organization and save it as <your- organization-short-name>.pem in the .chef directory inside your chef-repo repository. Also regenerate your user pulic key and save it in the .chef directory.
￼7. Create your cookbook[TERMINAL]
knife cookbook create my_cookbook
￼8. Upload your new cookbook to the Chef Server[TERMINAL]
knife cookbook upload my_cookbook
You can set up a node[NODE] via Vagrant here my example Vegrantfile:
Vagrant.configure("2") do |config|
config.vm.box = "opscode-centos-7.0"
config.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-7.0_chef-provisionerless.box"
config.omnibus.chef_version = :latest
config.vm.provision :chef_client do |chef|
chef.provisioning_path = "/etc/chef"
chef.chef_server_url = "https://api.opscode.com/organizations/dennisseidel"
chef.validation_key_path = "~/chef-repo/.chef/dennisseidel-validator.pem"
chef.validation_client_name = "dennisseidel-validator"
chef.node_name = "server"
￼9. Add the cookbook to your node’s (here: server1) run list[TERMINAL]:
knife node run_list add server1 recipe[my_cookbook]
10. Run Chef Client on your node [NODE]
11. Install a community cookbook (iptables) [TERMINAL]
knife cookbook site install iptables
11. Upload cookbooks to chef server [TERMINAL]
knife cookbook upload --all
12. Manage cookbook dependencies with Berkshelf
Edit your cookbook’s metadata:
Edit your cookbook’s default recipe:
Create your Berksfile:
Since I switch from my architect position designing smart systems to it specialist developing this solution myself. My learning is that I need several environment that I can adapt very flexible. In the following post I will describe what tools I use to create this adaptive Setup.
The foundation of all developer setup is the hardware. I currently use an 11 inch macbook air. But I am no advocate of Apple even though my employer has a close partnership with the green fruit 🙂 There I advice to search a portable devices with a long battery life and enough power to run at least one virtual machine with out performance issues. I actually advice to use a Windows devices because there is better support for Office and Productivity products that you will need in the business life.
The development environment are several virtual machines one for mobile development where I use a hackingtosh as my OS. For my connectivity/internet of things and smart industry development environment I use a set of Unix (centOS) based machine. Most of them I start in headless mode via vagrant. This way I can set up a complete DevOps system and mirror the environment of my customers on my machine.
The configuration and installation of all machine includes chef and the scripts for chef (cookbooks) are under source control with git on jazz.net.
I will extend this post with further details and the topics like my editor vim, my terminal configuration with dotfiles and zsh as well as my keybinding management. To be continued …