Chef developer training - Part 5 (draft)

The purpose of this series of tutorials is to take web app developers through the basic knowledge necessary to create and maintain the cookbooks used to deploy web applications.

The prerequisites for Part 5 are to complete part 4, and to have available the configuration values for both "class01" and your own organization e.g. "tomsorg".

The purpose of this part of the tutorial is to make it super easy to switch between different chef-servers, and organizations. The developer workflow will be to typically have a dev or test organization, and some other production target chef-server.



Part 5


The purpose of Part 5 is to allow you to switch between your organization, or class01 with least confusion.

1) begin by opening git bash, and run these commands;

$ cd

$ notepad .bashrc







2) paste into the new file in notepad  the following contents; you will then need to inspect the file and change the “tomhodder” and “tomhodder.pem” as appropriate to your pem and usernames.

#!/bin/bash

setcloud()
{

case "$1" in

class01)
export client_key="/home/tomhodder/Development/chef-repo/.chef/tomhodder.pem"
export node_name="tomhodder"
export chef_server_url="https://api.opscode.com/organizations/class01"    
export cookbook_copyright="Internal Only"
export cookbook_email="xxx@yyy.com"
export cookbook_license="Not released"
;;
  
tomhodder)
export client_key="/home/tomhodder/Development/chef-repo/.chef/tomhodder.pem"
export node_name="tomhodder"
export chef_server_url="https://api.opscode.com/organizations/tomhodder"    
export cookbook_copyright="
Internal Only"
export cookbook_email="xxx@hp.com"
export cookbook_license="
Not released"
;;
*)
echo "did not match a configuration"

;;

esac
}

setcloud class01 &> /dev/null
 





No comments:

Post a Comment

Don't be nasty. Being rude is fine.