Skip to content

Instantly share code, notes, and snippets.

@big-samantha
Last active December 18, 2015 11:49
Show Gist options
  • Save big-samantha/5778395 to your computer and use it in GitHub Desktop.
Save big-samantha/5778395 to your computer and use it in GitHub Desktop.

Installing Oscar/insta-pe/insta-pants/soupkitchen

IF YOU NEED XCODE'S COMPILER, THIS WILL BREAK ALL THE THINGS!!!

  1. Install GCC for OSX.

    • The filename of the download for Mountain Lion is listed as GCC-10.7.pkg on the site, but downloads as GCC-10.7-v2.pkg
    • If you get a warning that the file can't be opened because it's from an unidentified developer, just control-click on it, and then click open.
  2. Install the Xcode command line tools from https://developer.apple.com/downloads

    • Register if you don't have an AppleID, and login.
    • In the left hand search bar, search for "command", and download the latest command line tools for your release of OSX.
      • At time of writing, the latest tools are the April release, for Mountain Lion.
  3. Install homebrew.

    • Scroll down to the bottom of the page for the ruby one-liner.
    • After running the one-liner, run brew doctor. It should print out Your system is ready to brew. If you get any errors, either follow the instructions to fix the problems, or ask somebody for help.
  4. Run brew install wget gnu-tar rbenv ruby-build.

    • We install wget because Mac OS X doesn't come with it.
    • We install gnu-tar because there is a bug in the way that PE 2.7.2 was packages, and you can't untar it with BSD-tar or the finder's archive utility. The gnu-tar package installs with the command gtar which does work.
  5. Set up your shell to work with rbenv and rbenv install/ruby-build.

    • BASH
      1. echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
      2. exec $SHELL -l
    • ZSH
      1. echo 'eval "$(rbenv init -)"' >> ~/.zshrc
      2. exec $SHELL -l
  6. Install the latest 1.9.3 ruby with rbenv.

    1. rbenv install -l |grep 1.9.3
      • At time of writing this was 1.9.3-p429
    2. rbenv install 1.9.3-p429 (or latest version of 1.9.3 listed)
  7. Set your new ruby as the rbenv global version.

    1. rbenv versions
    2. rbenv global 1.9.3-p429 (or latest version)
    3. ruby --version should report the version of ruby you just set as global.
  8. Set up oscar/insta-pe/insta-pants/soupkitchen/aka the rza/aka the jza/THE WU TANG CLAN.

    1. git clone https://github.com/adrienthebo/oscar.git ~/oscar
    2. cd ~/oscar
    3. git checkout a737af1
    4. Set the version of ruby used with oscar permanently.
      • rbenv local 1.9.3-p429 (or latest version)
    5. Install virtualbox.
    6. Install vagrant: gem install vagrant.
      • NB: Don't get clever here! Don't download vagrant from the website! Install the gem!
    7. Download my good config.yaml and stick it in ~/oscar.

Using Oscar

Oscar is basically just a fancy Vagrantfile. We don't really ever edit the Vagrantfile. All (almost) configuration is done via the config.yaml file, which has 4 sections.

config.yaml

WARNING: Yaml is super finnicky about syntax, so you'll want to make sure that indents and other things line up exactly when you edit your config file.

pe

This controls what version of PE we want to install, and where oscar should expect that file. As long as the structure of the puppet installer doesn't change, we don't really need to edit this. Just change the "version" line to reflect the version you want to install.

The version you want to install must be downloaded and untarred inside of ~/oscar/files.

profiles

These are just the vagrant boxes you want to use. You can add any sources you like. There are various fairly up-to-date boxes available at here. You do not need to download the boxes yourself - vagrant does that for you. Just create profiles for them in config.yaml.

nodes

The nodes section contains the list of vagrant boxes you want to spin up. They are a collection of attributes, and look like this:

  -
    name: master
    role: master
    profile: ubuntu
    address: 172.16.0.2
    forwards:
      443: 20443
  - 
    name: agent
    role: agent
    profile: ubuntu
    address: 172.16.0.2
  • name - This is the vagrant name and hostname of the node.
  • role - The role maps to an answers file in ~/oscar/answers, so master would result in the master.txt answers file being used.
  • profile - the vagrant box you want to use, as defined earlier.
  • address - By default, VirtualBox and Vagrant assign NAT interfaces to boxes, which can't communicate with each other. This makes master-agent puppet impossible. To work around this, oscar creates "host-only" interfaces on all the machines, with the private addresses that we specify in the address: field. Oscar then does some magic so that all of these addresses are in the /etc/hosts files of all the vagrant boxes, which gives us functional name resolution between the vagrant boxes. The natted addresses are also retained, so that the nodes can access the internet.
    • In theory you could work around this by using bridged networking, but it's probably a bad idea, given the limited number of available IPs on our network, and the large number of users spinning up VMs.
  • Forwards - Since vagrant boxes are natted, they can't be accessed directly. Therefore in order to access the console, we need to create a PAT forward. So in the example above, on the master node, localhost:20443 on our machine maps to 443 on the vagrant box. You can also forward other arbitrary ports, but there's mostly no reason to.

File and Directory Structure

NB: The entire ~oscar/ directory will be shared as /vagrant on your nodes.

answers

Contains various answer files, as mentioned above in the config.yaml section. Typically you will need at least two, one for the master and one for all your agents.

files

PE installers that you want to use should be untarred here.

modules

The puppet modulepath is automatically changed to /modules, and that directory is mapped to ~/oscar/modules on your host machine, using VirtualBox's built in shared directory functionality.

manifests

Same as modules. manifestdir is changed to /manifests and is mapped to ~oscar/manifests.

Spinning up boxes

The configuration provided by my config.yaml should be pretty reasonable.

  1. vagrant up master will spin up the node named master, which should be an Ubuntu 12.04 server, running PE installed with the master.txt answers file, assuming you used my config.yaml. This will take a few minutes.

  2. vagrant ssh master will SSH into the master node that you just spun up. You can use the system normally.

  3. To access the console, visit https://localhost:20443 in your browser. The username and password is set in the answers file. (master.txt)

That's pretty much it. The nodes behave like normal puppetized systems. You can spin up an agent node by editing config.yaml and uncommenting the client node, or adding your own nodes.

Caveats

  • CentOS has iptables enabled by default, which means if you try to spin up a master node and an agent node, they won't be able to talk. You need to disable iptables on the master, and then disable iptables on the agent before puppet installs. It's possible to build this into the vagrantfile, but I haven't figured it out yet.

todo

  • vagrant reload nodename --no-provision caveats (different on ubuntu and centos)
  • Solaris guide.
  • Sahara usage
  • Figure out how to add CentOS itpables fix to vagrantfile.
@dhgwilliam
Copy link

Is step 7 (set your global ruby to 1.9.3) necessary/desirable?

@big-samantha
Copy link
Author

@dhgwilliam definitely not - that was more for the sake of "this is how you get a viable global ruby". Most of the people I've helped use oscar have basically never used rbenv/rvm or touched ruby much at all. But doing the local ruby for ~oscar is definitely sufficient.

@Sharpie
Copy link

Sharpie commented Jun 17, 2013

In respect to the following notice:

IF YOU NEED XCODE'S COMPILER, THIS WILL BREAK ALL THE THINGS!!!

This arises from Step 1 which suggests installing Kenneth Reitz's OS-X-GCC-Installer. Using this package is always a bad idea on OS X 10.7 and newer as it clashes horribly with XCode and the Command Line Tools. Coming from the Homebrew project, our advice is to avoid this package like the plague now that the Command Line Tools are available.

The main drive behind using the OS-X-GCC-Installer is to get Apple's non-LLVM GCC 4.2 compilers which are required to build Ruby 1.8.7. Since this guide installs Ruby 1.9.3, there is no need to worry about GCC 4.2 and Step 1 can be omitted entirely.

For those who need to install Ruby 1.8.7, the best course of action is to follow the advice given by ruby-build it's self:

vagrant-osx-108:~ vagrant$ rbenv install 1.8.7-p371

ERROR: This package must be compiled with GCC, but ruby-build couldn't
find a suitable `gcc` executable on your system. Please install GCC
and try again.

DETAILS: Apple no longer includes the official GCC compiler with Xcode
as of version 4.2. Instead, the `gcc` executable is a symlink to
`llvm-gcc`, a modified version of GCC which outputs LLVM bytecode.

For most programs the `llvm-gcc` compiler works fine. However,
versions of Ruby older than 1.9.3-p125 are incompatible with
`llvm-gcc`. To build older versions of Ruby you must have the official
GCC compiler installed on your system.

TO FIX THE PROBLEM: Install Homebrew's apple-gcc42 package with this
command: brew tap homebrew/dupes ; brew install apple-gcc42

Using the apple-gcc42 package from homebrew/dupes installes the required compiler without also installing a bunch of outdated components that throw a wrench into XCode.

@Sharpie
Copy link

Sharpie commented Jun 17, 2013

For those who want to install Ruby 1.8.7, the exact steps to setup are:

  • brew tap homebrew/dupes
  • brew install apple-gcc42
  • Install XQuartz.
  • export CPPFLAGS=-I/opt/x11/include
  • Profit.

@Sharpie
Copy link

Sharpie commented Jun 17, 2013

An edited version that drops OS-X-GCC-Installer and incorporates the above steps can be found here:

https://gist.github.com/Sharpie/5801137

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment