Skip to content

Instantly share code, notes, and snippets.

@viglesiasce
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save viglesiasce/9734682 to your computer and use it in GitHub Desktop.

Select an option

Save viglesiasce/9734682 to your computer and use it in GitHub Desktop.
Install Motherbrain for use with the Eucalyptus repsoitory
#!/bin/bash -xe
echo "Enter this machines IP address."
echo
ifconfig | grep 'inet '
echo
read -p "Address: " CHEF_IP
read -s -p "Enter SSH password for Eucalyptus components: " SSH_PASSWORD
echo
echo
### Install RVM and Ruby 2.0.0
curl -sSL https://get.rvm.io | bash -s stable
if which yum 1> /dev/null; then
yum install -y libxml2-devel libxslt-devel git
source /etc/profile.d/rvm.sh
else
source ~/.rvm/scripts/rvm
fi
rvm install 2.0.0
rvm use 2.0.0
### Install chef, motherbrain and chef-zero
gem install chef
gem install motherbrain
gem install chef-zero
### Create chef-repo
mkdir -p chef-repo/cookbooks
pushd chef-repo
git clone https://github.com/eucalyptus/eucalyptus-cookbook cookbooks/eucalyptus
git clone https://github.com/opscode-cookbooks/yum.git cookbooks/yum
git clone https://github.com/opscode-cookbooks/selinux.git cookbooks/selinux
git clone https://github.com/opscode-cookbooks/ntp.git cookbooks/ntp
chef-zero -d -H 0.0.0.0
mv cookbooks/eucalyptus/environments/ .
### Configure knife
CHEF_REPO=`pwd`
mkdir ~/.chef
cat > ~/.chef/knife.rb <<EOF
node_name 'euca-installer'
client_key '~/.chef/euca-installer.pem'
chef_server_url 'http://$CHEF_IP:8889'
cookbook_path [ "$CHEF_REPO/cookbooks" ]
EOF
openssl genrsa -out ~/.chef/euca-installer.pem 4096
knife upload cookbooks
### Configure MotherBrain
mkdir -p ~/.mb
cat > ~/.mb/config.json <<EOF
{
"berkshelf": {
"path": "~/.berkshelf"
},
"chef": {
"api_url": "http://$CHEF_IP:8889",
"api_client": "euca-installer",
"api_key": "~/.chef/euca-installer.pem",
"validator_client": "euca-installer",
"validator_path": "~/.chef/euca-installer.pem",
"bootstrap_proxy": null,
"encrypted_data_bag_secret_path": null
},
"ssh": {
"user": "root",
"password": "$SSH_PASSWORD",
"keys": null,
"sudo": true,
"timeout": 10.0,
"verbose": null
},
"winrm": {
"user": null,
"password": null,
"port": 5985
},
"ssl": {
"verify": false
},
"log": {
"level": "INFO",
"location": "STDOUT"
},
"server": {
"daemonize": false,
"pid": "/var/run/motherbrain/mb.pid"
},
"rest_gateway": {
"enable": false,
"host": "0.0.0.0",
"port": 0
},
"plugin_manager": {
"eager_loading": false,
"eager_load_interval": 300,
"async_loading": false
},
"ef": {
"api_url": null,
"api_key": null
},
"aws": {
"access_key": null,
"secret_key": null,
"endpoint": null
},
"bootstrap": {
"default_template": null
}
}
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment