- From: John Merrells <
>
- To:
- Subject: [chef] Re: Re: Re: Re: Re: EC2 AMI with chef-server installed
- Date: Sat, 3 Apr 2010 11:14:03 -0700
This is how I set up the chef client.... on ubuntu 9.10... you'll need to
edit some of this for your host and domain name....
#!/bin/bash
MY_HOSTNAME=is8 # EDIT ME
logfile="/root/log.txt"
echo "-----" >> $logfile
# New sources.list
cat > /etc/apt/sources.list << EOF
deb
http://gb.archive.ubuntu.com/ubuntu/ karmic main restricted
deb-src
http://gb.archive.ubuntu.com/ubuntu/ karmic main restricted
deb
http://gb.archive.ubuntu.com/ubuntu/ karmic-updates main restricted
deb-src
http://gb.archive.ubuntu.com/ubuntu/ karmic-updates main restricted
deb
http://gb.archive.ubuntu.com/ubuntu/ karmic universe
deb-src
http://gb.archive.ubuntu.com/ubuntu/ karmic universe
deb
http://gb.archive.ubuntu.com/ubuntu/ karmic-updates universe
deb-src
http://gb.archive.ubuntu.com/ubuntu/ karmic-updates universe
deb
http://gb.archive.ubuntu.com/ubuntu/ karmic multiverse
deb-src
http://gb.archive.ubuntu.com/ubuntu/ karmic multiverse
deb
http://gb.archive.ubuntu.com/ubuntu/ karmic-updates multiverse
deb-src
http://gb.archive.ubuntu.com/ubuntu/ karmic-updates multiverse
deb
http://security.ubuntu.com/ubuntu karmic-security main restricted
deb-src
http://security.ubuntu.com/ubuntu karmic-security main restricted
deb
http://security.ubuntu.com/ubuntu karmic-security universe
deb-src
http://security.ubuntu.com/ubuntu karmic-security universe
deb
http://security.ubuntu.com/ubuntu karmic-security multiverse
deb-src
http://security.ubuntu.com/ubuntu karmic-security multiverse
EOF
# Update System
apt-get -y update
#installing john's public key
cat /root/.ssh/authorized_keys <<EOF
ssh-rsa
AAAAB3NzaC1yc2EAAAABIwAAAQEAwLCaFHWmITU89rkywlDQBsGtcy+ABNz+kofq2OQh/UjscS79g58cba7lNj8hwqbSzLzypeX2QEkPrG1IAH/QKL4dXcWFzMXQ0912wEQDHf0PbhV+b0ZgjjU7vPJRl+uAZ2rTe0g4KP0arZouSt+7Bw5454YBpDpJe1ktidO8SlDGoj8U04lPALmCYk7mv0DcFlP1M9YviRkmAIagY5s6weMvc73eLEn9V5eUxzQdnXt9cRxrAVp8czV9mVT2U0vYBvEYHew7o9pUabYUAiqdBD/jSECROwFBEoQzaFWW1r4sqa8x7hMAk5pVfts+fuqbjj/H71GW3FqXUbaBhbhiFQ==
EOF
#installing ruby
apt-get -y install build-essential >> $logfile
apt-get -y install ruby >> $logfile
apt-get -y install ruby-dev >> $logfile
apt-get -y install libzlib-ruby >> $logfile
apt-get -y install libyaml-ruby >> $logfile
apt-get -y install libopenssl-ruby >> $logfile
apt-get -y install runit >> $logfile
#installing rubygems
wget
http://rubyforge.org/frs/download.php/69365/rubygems-1.3.6.tgz
tar xzvf rubygems-1.3.6.tgz >> $logfile
cd rubygems-1.3.6
ruby setup.rb >> $logfile
ln -s /usr/bin/gem1.8 /usr/bin/gem
gem update --no-ri --no-rdoc --system >> $logfile
#installing chef client
gem install --no-ri --no-rdoc mixlib-log >> $logfile
gem install --no-ri --no-rdoc ohai >> $logfile
gem install --no-ri --no-rdoc chef >> $logfile
#chef client directories
mkdir /etc/chef
chown root:root /etc/chef
chmod 755 /etc/chef
#install the validation key so that the chef-client can register with the
chef-server
cat > /etc/chef/validation.pem <<EOF
-----BEGIN RSA PRIVATE KEY-----
XXXXXX # EDIT ME
-----END RSA PRIVATE KEY-----
EOF
cat > ~/solo.rb <<EOF
file_cache_path "/tmp/chef-solo"
cookbook_path "/tmp/chef-solo/cookbooks"
EOF
# EDIT ME
cat > ~/chef.json <<EOF
{
"bootstrap": {
"chef": {
"url_type": "http",
"init_style": "runit",
"path": "/srv/chef",
"serve_path": "/srv/chef",
"server_fqdn": "chef.reflectornetwork.com"
}
},
"run_list": [ "recipe[bootstrap::client]" ]
}
EOF
hostname $MY_HOSTNAME
# /etc/hostname
echo $MY_HOSTNAME > /etc/hostname
# /etc/hosts
echo 127.0.0.1 $MY_HOSTNAME.reflectornetwork.com $MY_HOSTNAME >> /etc/hosts #
EDIT ME
#bootstrap chef-client
chef-solo -c ~/solo.rb -j ~/chef.json -r
http://s3.amazonaws.com/chef-solo/bootstrap-latest.tar.gz
# /etc/chef/client.rb
echo node_name \"$MY_HOSTNAME\" >> /etc/chef/client.rb
#register the chef-client with the chef-server
/etc/init.d/chef-client restart
On Apr 3, 2010, at 10:40 AM, Daniel DeLeo wrote:
>
Ohai!
>
>
You'll want to make sure you have a domain name set in /etc/hosts,
>
even it it's just 'localdomain'
>
>
http://wiki.opscode.com/display/chef/Bootstrap+Chef+RubyGems+Installation#BootstrapChefRubyGemsInstallation-FullyQualifiedDomainNames
>
>
HTH,
>
Dan DeLeo
>
>
On Sat, Apr 3, 2010 at 10:31 AM, Sidney Burks
>
<
>
>
wrote:
>
> I tried this script on my local machine at home (Ubuntu 9.10) but it seems
>
> to fail because Ohai sets 'null' for a domain. I'm trying this on my home
>
> computer, which i'd like to access from a dyndns.org address. Anyone have a
>
> workaround?
>
>
>
> http://gist.github.com/354705
>
>
>
> -Sidney
>
>
>
>
>
>
>
> On Sat, Apr 3, 2010 at 4:29 PM, Mike Bailey
>
> <
>
>
> wrote:
>
>>
>
>> Thanks for the script. It's nice to have an automated (and human readable)
>
>> script to install chef.
>
>> My initial password is still not working for the webui so I'm stuck. I've
>
>> changed it in /etc/chef/server.rb and restarted the webui to no avail.
>
>> How did you fix the 'lost admin password' problem?
>
>> thanks,
>
>> Mike
>
>>
>
>>
>
>>
>
>>
>
>>
>
>> On Sat, Apr 3, 2010 at 4:32 AM, John Merrells
>
>> <
>
>
>> wrote:
>
>>>
>
>>> It took me a few hours to get my first chef server up and running.
>
>>>
>
>>> (I found the wiki to be quite confusing. Fewer links and a diagram would
>
>>> have helped.)
>
>>>
>
>>> This is what I did for ubuntu 9.10. Even then I had to contend with the
>
>>> 'lost admin password' a couple of times.
>
>>>
>
>>> I'm in a pretty happy place now, with server, client and knife
>
>>> working.... trying to get to grips with the cookbooks now... apache2
>
>>> openid
>
>>> doesn't seem to work for me.
>
>>>
>
>>> John
>
>>>
>
>>>
>
>>> logfile="/root/log.txt"
>
>>> echo "-----" >> $logfile
>
>>>
>
>>> # New sources.list
>
>>> cat > /etc/apt/sources.list << EOF
>
>>> deb http://gb.archive.ubuntu.com/ubuntu/ karmic main restricted
>
>>> deb-src http://gb.archive.ubuntu.com/ubuntu/ karmic main restricted
>
>>> deb http://gb.archive.ubuntu.com/ubuntu/ karmic-updates main restricted
>
>>> deb-src http://gb.archive.ubuntu.com/ubuntu/ karmic-updates main
>
>>> restricted
>
>>> deb http://gb.archive.ubuntu.com/ubuntu/ karmic universe
>
>>> deb-src http://gb.archive.ubuntu.com/ubuntu/ karmic universe
>
>>> deb http://gb.archive.ubuntu.com/ubuntu/ karmic-updates universe
>
>>> deb-src http://gb.archive.ubuntu.com/ubuntu/ karmic-updates universe
>
>>> deb http://gb.archive.ubuntu.com/ubuntu/ karmic multiverse
>
>>> deb-src http://gb.archive.ubuntu.com/ubuntu/ karmic multiverse
>
>>> deb http://gb.archive.ubuntu.com/ubuntu/ karmic-updates multiverse
>
>>> deb-src http://gb.archive.ubuntu.com/ubuntu/ karmic-updates multiverse
>
>>> deb http://security.ubuntu.com/ubuntu karmic-security main restricted
>
>>> deb-src http://security.ubuntu.com/ubuntu karmic-security main restricted
>
>>> deb http://security.ubuntu.com/ubuntu karmic-security universe
>
>>> deb-src http://security.ubuntu.com/ubuntu karmic-security universe
>
>>> deb http://security.ubuntu.com/ubuntu karmic-security multiverse
>
>>> deb-src http://security.ubuntu.com/ubuntu karmic-security multiverse
>
>>> EOF
>
>>>
>
>>> # Update System
>
>>> apt-get -y update
>
>>>
>
>>> #installing ruby
>
>>> apt-get -y install build-essential >> $logfile
>
>>> apt-get -y install ruby >> $logfile
>
>>> apt-get -y install ruby-dev >> $logfile
>
>>> apt-get -y install libzlib-ruby >> $logfile
>
>>> apt-get -y install libyaml-ruby >> $logfile
>
>>> apt-get -y install libopenssl-ruby >> $logfile
>
>>> apt-get -y install runit >> $logfile
>
>>>
>
>>> #installing rubygems
>
>>> wget http://rubyforge.org/frs/download.php/69365/rubygems-1.3.6.tgz
>
>>> tar xzvf rubygems-1.3.6.tgz >> $logfile
>
>>> cd rubygems-1.3.6
>
>>> ruby setup.rb >> $logfile
>
>>> ln -s /usr/bin/gem1.8 /usr/bin/gem
>
>>> gem update --no-ri --no-rdoc --system >> $logfile
>
>>>
>
>>> #SEE
>
>>> http://wiki.opscode.com/display/chef/Preparing+Debian+and+Ubuntu+for+RubyGems
>
>>>
>
>>> apt-get -y install ruby ruby1.8-dev libopenssl-ruby1.8 rdoc ri irb
>
>>> build-essential wget ssl-cert
>
>>> gem install --no-ri --no-rdoc chef
>
>>>
>
>>> #SEE
>
>>>
>
>>> http://wiki.opscode.com/display/chef/Bootstrap+Chef+RubyGems+Installation
>
>>>
>
>>> cat > ~/solo.rb <<EOF
>
>>> file_cache_path "/tmp/chef-solo"
>
>>> cookbook_path "/tmp/chef-solo/cookbooks"
>
>>> recipe_url "http://s3.amazonaws.com/chef-solo/bootstrap-latest.tar.gz"
>
>>> EOF
>
>>>
>
>>> cat > ~/chef.json <<EOF
>
>>> {
>
>>> "bootstrap": {
>
>>> "chef": {
>
>>> "url_type": "http",
>
>>> "init_style": "runit",
>
>>> "path": "/srv/chef",
>
>>> "serve_path": "/srv/chef",
>
>>> "server_fqdn": "chef.reflectornetwork.com",
>
>>> "webui_enabled": true
>
>>> }
>
>>> },
>
>>> "run_list": [ "recipe[bootstrap::server]" ]
>
>>> }
>
>>> EOF
>
>>>
>
>>> chef-solo -c ~/solo.rb -j ~/chef.json
>
>>>
>
>>>
>
>>>
>
>>> --
>
>>> John Merrells
>
>>> http://johnmerrells.com
>
>>> +1.415.244.5808
>
>>>
>
>>>
>
>>>
>
>>>
>
>>>
>
>>>
>
>>
>
>
>
>
--
John Merrells
http://johnmerrells.com
+1.415.244.5808
Archive powered by MHonArc 2.6.16.