EC2 AMI with chef-server installed


#1

Is there a public EC2 AMI with chef-server installed? This would give people
a working server in under 5 minutes that they can play with.

I spent over an hour tonight and am going to bed without it working yet. A
lot of people would give up at this point if they were just checking out a
bit of software.

thanks,

Mike


#2

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


#3

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 john@merrells.com 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


#4

On Apr 3, 2010, at 7:29 AM, Mike Bailey wrote:

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.

I tried that too…

How did you fix the ‘lost admin password’ problem?

I did ‘gem uninstall chef;gem install chef’ a couple of times… then i was very careful when changing the admin password… and the first thing i did was create some extra admin users just to be on the safe side :slight_smile:

I still don’t know why this happens.

Now that I’m up and running I’m not actually using the webui very much. The command line utility ‘knife’ is really good.

John


John Merrells
http://johnmerrells.com
+1.415.244.5808


#5

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?

-Sidney

On Sat, Apr 3, 2010 at 4:29 PM, Mike Bailey mike@bailey.net.au 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 john@merrells.com 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


#6

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 sid137@gmail.com 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 mike@bailey.net.au 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 john@merrells.com 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


#7

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== john@merrells.com
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 sid137@gmail.com 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 mike@bailey.net.au 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 john@merrells.com 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


#8

How did you fix the ‘lost admin password’ problem?

I did ‘gem uninstall chef;gem install chef’ a couple of times… then i was
very careful when changing the admin password… and the first thing i did
was create some extra admin users just to be on the safe side :slight_smile:

Did you login using the password in /etc/chef/server.rb?

I still don’t know why this happens.

I just ran your install script (from previous email) on a fresh EC2 instance
(ubuntu 9.10 i386 ami-fd5100b8) and then ran:

gem uninstall chef;gem install chef

a couple of times.

I still get ‘Could not complete logging in.’

I’m trying to use chef-0.8.10. Should I try an older release?

  • Mike

Now that I’m up and running I’m not actually using the webui very much. The

command line utility ‘knife’ is really good.

John


John Merrells
http://johnmerrells.com
+1.415.244.5808


#9

I just rebooted the server and login worked!

  • Mike

On Sun, Apr 4, 2010 at 11:47 PM, Mike Bailey mike@bailey.net.au wrote:

How did you fix the ‘lost admin password’ problem?

I did ‘gem uninstall chef;gem install chef’ a couple of times… then i
was very careful when changing the admin password… and the first thing i
did was create some extra admin users just to be on the safe side :slight_smile:

Did you login using the password in /etc/chef/server.rb?

I still don’t know why this happens.

I just ran your install script (from previous email) on a fresh EC2
instance (ubuntu 9.10 i386 ami-fd5100b8) and then ran:

gem uninstall chef;gem install chef

a couple of times.

I still get ‘Could not complete logging in.’

I’m trying to use chef-0.8.10. Should I try an older release?

  • Mike

Now that I’m up and running I’m not actually using the webui very much. The

command line utility ‘knife’ is really good.

John


John Merrells
http://johnmerrells.com
+1.415.244.5808


#10

John,

Thank you for posting your script. This saved me considerable time.

However, I do want to post the issues I still encountered:

  1. when running chef-solo, I got this error:

[Tue, 13 Apr 2010 15:00:27 +0200] INFO:
template[/etc/sv/chef-solr/run] sending restart action to
service[chef-solr] (delayed)
[Tue, 13 Apr 2010 15:00:27 +0200] INFO:
template[/etc/sv/chef-solr/log/run] sending restart action to
service[chef-solr] (delayed)
/usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/…/lib/chef/mixin/command.rb:179:in
handle_command_failures': /etc/init.d/chef-solr restart returned 1, expected 0 (Chef::Exceptions::Exec) from /usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/../lib/chef/mixin/command.rb:122:inrun_command’
from /usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/…/lib/chef/provider/service/init.rb:53:in
restart_service' from /usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/../lib/chef/provider/service.rb:87:inaction_restart’
from /usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/…/lib/chef/runner.rb:60:in
send' from /usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/../lib/chef/runner.rb:60:inrun_action’
from /usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/…/lib/chef/runner.rb:126:in
converge' from /usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/../lib/chef/runner.rb:123:ineach’
from /usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/…/lib/chef/runner.rb:123:in
converge' from /usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/../lib/chef/client.rb:319:inconverge’
from /usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/…/lib/chef/client.rb:110:in
run_solo' from /usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/../lib/chef/application/solo.rb:198:inrun_application’
from /usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/…/lib/chef/application/solo.rb:190:in
loop' from /usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/../lib/chef/application/solo.rb:190:inrun_application’
from /usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/…/lib/chef/application.rb:57:in
run' from /usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/chef-solo:26 from /usr/bin/chef-solo:19:inload’
from /usr/bin/chef-solo:19

Running “/etc/init.d/chef-solr restart” manually did work, so I
restarted the chef-solo process. It now ended with success.

  1. After that, I did a restart of 2 chef processes to workaround the
    initial login problem:

/etc/init.d/chef-server restart
/etc/init.d/chef-server-webui restart

Login is now possible with the admin password listed in /etc/chef/server.rb.

That was it for me.

Ringo


#11

I’m using John’s script to install chef-server on Ubuntu 9.10:

curl -O failmode.com/install_chef_server.sh && sh install_chef_server.sh

Thanks Ringo, I’ve replaced the reboot with your restart commands.

  • Mike

On Wed, Apr 14, 2010 at 12:00 AM, Ringo De Smet ringo.desmet@gmail.comwrote:

John,

Thank you for posting your script. This saved me considerable time.

However, I do want to post the issues I still encountered:

  1. when running chef-solo, I got this error:

[Tue, 13 Apr 2010 15:00:27 +0200] INFO:
template[/etc/sv/chef-solr/run] sending restart action to
service[chef-solr] (delayed)
[Tue, 13 Apr 2010 15:00:27 +0200] INFO:
template[/etc/sv/chef-solr/log/run] sending restart action to
service[chef-solr] (delayed)

/usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/…/lib/chef/mixin/command.rb:179:in
handle_command_failures': /etc/init.d/chef-solr restart returned 1, expected 0 (Chef::Exceptions::Exec) from /usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/../lib/chef/mixin/command.rb:122:inrun_command’
from
/usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/…/lib/chef/provider/service/init.rb:53:in
restart_service' from /usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/../lib/chef/provider/service.rb:87:inaction_restart’
from
/usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/…/lib/chef/runner.rb:60:in
send' from /usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/../lib/chef/runner.rb:60:inrun_action’
from
/usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/…/lib/chef/runner.rb:126:in
converge' from /usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/../lib/chef/runner.rb:123:ineach’
from
/usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/…/lib/chef/runner.rb:123:in
converge' from /usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/../lib/chef/client.rb:319:inconverge’
from
/usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/…/lib/chef/client.rb:110:in
run_solo' from /usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/../lib/chef/application/solo.rb:198:inrun_application’
from
/usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/…/lib/chef/application/solo.rb:190:in
loop' from /usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/../lib/chef/application/solo.rb:190:inrun_application’
from
/usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/…/lib/chef/application.rb:57:in
run' from /usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/chef-solo:26 from /usr/bin/chef-solo:19:inload’
from /usr/bin/chef-solo:19

Running “/etc/init.d/chef-solr restart” manually did work, so I
restarted the chef-solo process. It now ended with success.

  1. After that, I did a restart of 2 chef processes to workaround the
    initial login problem:

/etc/init.d/chef-server restart
/etc/init.d/chef-server-webui restart

Login is now possible with the admin password listed in
/etc/chef/server.rb.

That was it for me.

Ringo


#12

On Apr 13, 2010, at 7:00 AM, Ringo De Smet wrote:

However, I do want to post the issues I still encountered:

  1. when running chef-solo, I got this error:

[Tue, 13 Apr 2010 15:00:27 +0200] INFO:
template[/etc/sv/chef-solr/log/run] sending restart action to
service[chef-solr] (delayed)
/usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/…/lib/chef/mixin/command.rb:179:in
handle_command_failures': /etc/init.d/chef-solr restart returned 1, expected 0 (Chef::Exceptions::Exec) from /usr/lib/ruby/gems/1.8/gems/chef-0.8.10/bin/../lib/chef/mixin/command.rb:122:inrun_command’

Running “/etc/init.d/chef-solr restart” manually did work, so I
restarted the chef-solo process. It now ended with success.

I’ve never seen that one myself. The only thought I have around that
is that I’ve only been working with totally fresh installs of ubuntu 9.10.

  1. After that, I did a restart of 2 chef processes to workaround the
    initial login problem:

/etc/init.d/chef-server restart
/etc/init.d/chef-server-webui restart

Login is now possible with the admin password listed in /etc/chef/server.rb.

That’s good news that you’ve narrowed that down.

John


John Merrells
http://johnmerrells.com
+1.415.244.5808