Skip to content

Instantly share code, notes, and snippets.

@cmaitchison
Created November 15, 2012 05:16
Show Gist options
  • Save cmaitchison/4076788 to your computer and use it in GitHub Desktop.
Save cmaitchison/4076788 to your computer and use it in GitHub Desktop.

Revisions

  1. cmaitchison revised this gist Nov 15, 2012. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions chef_server_bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -45,5 +45,7 @@ mkdir -p /home/ubuntu/.chef
    cp /etc/chef/validation.pem /etc/chef/webui.pem /home/ubuntu/.chef
    chown -R ubuntu /home/ubuntu/.chef

    apt-get install git-core -y

    #exit root console and
    #knife configure -i
  2. cmaitchison revised this gist Nov 15, 2012. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion chef_server_bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -43,4 +43,7 @@ apt-get install chef chef-server -y

    mkdir -p /home/ubuntu/.chef
    cp /etc/chef/validation.pem /etc/chef/webui.pem /home/ubuntu/.chef
    chown -R ubuntu /home/ubuntu/.chef
    chown -R ubuntu /home/ubuntu/.chef

    #exit root console and
    #knife configure -i
  3. cmaitchison revised this gist Nov 15, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion chef_server_bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -22,7 +22,7 @@ gpg --keyserver keys.gnupg.net --recv-keys 83EF826A
    gpg --export [email protected] | tee /etc/apt/trusted.gpg.d/opscode-keyring.gpg > /dev/null
    apt-get update
    apt-get install opscode-keyring -y
    apt-get upgrade -y --force-yes
    apt-get upgrade -y

    #synchronise time
    ntpdate ntp.ubuntu.com
  4. cmaitchison revised this gist Nov 15, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion chef_server_bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -16,7 +16,7 @@ locale-gen en_AU.UTF-8
    dpkg-reconfigure locales

    #update packages
    echo "deb http://apt.opscode.com/ precise-0.10 main" | sudo tee /etc/apt/sources.list.d/opscode.list
    echo "deb http://apt.opscode.com/ precise-0.10 main" | tee /etc/apt/sources.list.d/opscode.list
    mkdir -p /etc/apt/trusted.gpg.d
    gpg --keyserver keys.gnupg.net --recv-keys 83EF826A
    gpg --export [email protected] | tee /etc/apt/trusted.gpg.d/opscode-keyring.gpg > /dev/null
  5. cmaitchison created this gist Nov 15, 2012.
    46 changes: 46 additions & 0 deletions chef_server_bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,46 @@
    #!/bin/bash -xe

    #THIS SCRIPT MUST BE RUN AS ROOT

    #configure SSH
    SSH_KEY="ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAuwaDITgrsmxVvSJ+HEir4iW2eBb8XqB3wIxCWJwmhiB2S6MkdX1CFcj8boHL2RIYgKN0yiTCVlOdQFjhyRpnd8NbS0RW7753SE1hzkgOg+2e1B15lf1PCSD5OPWAtpb1eYlLcs6hns+yFhYCFeQrKLBL2/si8D8OcQcTR7BjjFQEWdhjl4cYiT68cr57yFT+c/f32ZTynEWukC2YIGMjJ1nACUOYF8CSp6RUrD2kY3C1Pb1Q5V3jwi0lhay4aF5AWp28hPVtYASBe2BrYXp8uErhnmWxgXNV19P0NSHE7TBXd9nXz/njI2SDP/p2N/vHquz/Ybxs4F+kGGXknUFitQ== [email protected]"
    echo $SSH_KEY >> /home/ubuntu/.ssh/authorized_keys

    #configure locale
    echo "export LANGUAGE=en_AU.UTF-8" > /tmp/locale
    echo "export LANG=en_AU.UTF-8" >> /tmp/locale
    echo "export LC_ALL=en_AU.UTF-8" >> /tmp/locale
    cat /etc/bash.bashrc >> /tmp/locale
    cp /tmp/locale /etc/bash.bashrc
    locale-gen en_AU.UTF-8
    dpkg-reconfigure locales

    #update packages
    echo "deb http://apt.opscode.com/ precise-0.10 main" | sudo tee /etc/apt/sources.list.d/opscode.list
    mkdir -p /etc/apt/trusted.gpg.d
    gpg --keyserver keys.gnupg.net --recv-keys 83EF826A
    gpg --export [email protected] | tee /etc/apt/trusted.gpg.d/opscode-keyring.gpg > /dev/null
    apt-get update
    apt-get install opscode-keyring -y
    apt-get upgrade -y --force-yes

    #synchronise time
    ntpdate ntp.ubuntu.com

    #install ruby
    RUBY_PATCH=p327
    apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-dev libyaml-dev libcurl4-openssl-dev
    cd /tmp
    wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-$RUBY_PATCH.tar.gz
    tar -xvzf ruby-1.9.3-$RUBY_PATCH.tar.gz
    cd ruby-1.9.3-$RUBY_PATCH/
    ./configure --prefix=/usr/local
    make
    make install

    #install chef
    apt-get install chef chef-server -y

    mkdir -p /home/ubuntu/.chef
    cp /etc/chef/validation.pem /etc/chef/webui.pem /home/ubuntu/.chef
    chown -R ubuntu /home/ubuntu/.chef