Tuesday, April 08, 2014

Chef - my journey with the Infrastructure tool - Part 1 of hopefully many more...



Chef is a Infrastructure in Code service, which allows you to define your infrastructure in different files (recipes, Cookbooks, resources etc) and by using Chef - you can build all your servers the exact same way.  The advantage I see with Chef is - it has inbuilt knowledge on how to work with a number of different OS's - so Solaris could have pkgadd, RHEL yum or CentOS apt-get and these would automatically be determined by Chef.

Chef is written in Ruby, and you need to know just some basics of Ruby to get started with Chef.  However, even if you dont know it - you can keep following along - or you can learn what you need for Chef here.

I highly recommend going through the screencasts available at OpsCode - here.

So - here's where I am - I got my workstation (a Mac) setup for Chef. I decided if I was going to learn it, the best spot to try things out is the Amazon cloud - it'll cost me some money, but considering a lot of organizations are moving there, might as well get experience with that as well :)

Amazon does offer a Micro instance for free for 750 hrs - and yes thats what I'm trying to use.

So to get Started, I picked an UBUNTU image which is available on the Amazon Market place.

I played around with Chef - and got Chef talking between Amazon and my desktop +  Enterprise Hosted Chef (free for less than 5 nodes).

Yes - I am getting to the meat now :).

My next target is to be able to Deploy an OS on the Amazon cloud using just Chef.

There's probably a ton of blogs out there with this - so I am adding to it. I'm hoping to detail any issues that I've run into as well as use this blog as my own documentation :)

One of the things to note is that : chef always installs in "/opt/chef" on *nix flavors.  There are too many dependencies, and its not supported if its not there.

First : Install knife-ec2 plugin for Chef.  This is assuming that has already been installed.

/opt/chef/embedded/bin/gem install knife-ec2

Next, get the Amazon EC2 key and access code - its available under your Amazon Account, "Security Credentials" & Access Keys.

You'll also need your Amazon key pair - you can create a new one, or use the existing one you have already.  Its under "Network Security"&  Key Pairs

this is what you'll need to put in the knife.rb file.

### The Key pair with .pem file name. (without the .pem)
knife[:aws_ssh_key_id] = 'KEY_ID' 
#### The Access key id and access key from Amazon account. knife[:aws_access_key_id] = 'ACCESS_KEY_ID' 
knife[:aws_secret_access_key] = 'SECRET_ACCESS_KEY'

Make sure the .pem file has permissions of 400.  Otherwise, the ssh-user wont allow the use of the .pem file.

Monday, April 07, 2014

Solaris 10 x86 - Grub not loading



I have a Solaris 10x86 install which failed all attempts after a reboot with ZFS

After a lot of trial and error, I finally did the below from the Grub menu and it worked.

grub> find /sbin/init
grub> root (hd1,0,a)  <<---this a="" command.="" find="" hd1="" is="" of="" output="" p="" the="">grub> kernel$ /platform/i86pc/multiboot -B $ZFS-BOOTFS
grub>module /platform/i86pc/boot_archive
grub> boot

An example of the menu.lst at /rpool/boot/grub/menu.lst

#---------- ADDED BY BOOTADM - DO NOT EDIT ----------
title Solaris 10 10/09 s10x_u8wos_08a X86
findroot (pool_rpool,0,a)
kernel$ /platform/i86pc/multiboot -B $ZFS-BOOTFS
module /platform/i86pc/boot_archive
#---------------------END BOOTADM--------------------
#---------- ADDED BY BOOTADM - DO NOT EDIT ----------
title Solaris failsafe
findroot (pool_rpool,0,a)
kernel /boot/multiboot -s
module /boot/amd64/x86.miniroot-safe
#---------------------END BOOTADM--------------------