Skip to content

Instantly share code, notes, and snippets.

@bmannix
Forked from cmaitchison/chef_solo_bootstrap.sh
Last active December 18, 2015 12:39
Show Gist options
  • Save bmannix/5784537 to your computer and use it in GitHub Desktop.
Save bmannix/5784537 to your computer and use it in GitHub Desktop.
#!/bin/bash -xe
#THIS SCRIPT MUST BE RUN AS ROOT
ADMIN_USER=admin
ADMIN_GROUP=admin
#add admin group
(cat /etc/group | grep -E '\b$ADMIN_GROUP\b') || sudo groupadd $ADMIN_GROUP
#add admin user
(cat /etc/passwd | grep -E "\b$ADMIN_USER\b:x") || useradd -m -s /bin/bash $ADMIN_USER -g $ADMIN_GROUP
#sudoless access for admin user
(cat /etc/sudoers | grep -E "^$ADMIN_USER\b.*NOPASSWD") || echo "$ADMIN_USER ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
yum update -y
yum install -y gcc automake autoconf libtool make
yum install -y ruby
yum install -y ruby-devel ruby-docs ruby-ri ruby-rdoc
yum install -y rubygems
#install chef
gem install chef ruby-shadow --no-ri --no-rdoc
mkdir -p /var/chef
chown $ADMIN_USER:$ADMIN_GROUP /var/chef/
#init git
yum install -y git-core
#init capistrano deploy directories
mkdir -p /var/www/shared/
mkdir -p /var/www/releases/
chown $ADMIN_USER:$ADMIN_GROUP -R /var/www
#turn sshd on at boot
chkconfig sshd on
reboot now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment