Hi there,
The -c
option requires an argument (the path to the desired config
file). I seem to remember this having a better error >message in the past,
I'll look into it.
That's an awesome tip! Thanks and I appreciate you looking into this as
well as getting me a bit further down the road of actually using chef as
opposed to puppet. I'm fairly used to using puppet at this point but I'm
excited to learn chef!
So what I've done is cook up (excuse the pun) a little test where I would
remove the 'vim-enhanced' package via yum and see if I could get chef to
install it.
So the run went like this:
[root@cloud:/opt] #/usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/chef-solo
-c /var/chef/cookbooks/jf-beta/recipes/default.rb
[2012-09-06T21:01:21-04:00] INFO: *** Chef 10.12.0 ***
[2012-09-06T21:01:23-04:00] INFO: Run List is
[2012-09-06T21:01:23-04:00] INFO: Run List expands to
[2012-09-06T21:01:23-04:00] INFO: Starting Chef Run for cloud.jokefire.com
[2012-09-06T21:01:23-04:00] INFO: Running start handlers
[2012-09-06T21:01:23-04:00] INFO: Start handlers complete.
[2012-09-06T21:01:23-04:00] INFO: Chef Run complete in 0.005195 seconds
[2012-09-06T21:01:23-04:00] INFO: Running report handlers
[2012-09-06T21:01:23-04:00] INFO: Report handlers complete
And this is the simple recipe I tried:
[root@cloud:/opt] #cat /var/chef/cookbooks/jf-beta/recipes/default.rb
package("vim-enhanced")
Sadly, I had a look afterward to realize that 'vim-enhanced' had not
actually been installed.
[root@cloud:/opt] #rpm -qa | grep vim
vim-common-7.0.109-7.el5
vim-minimal-7.0.109-7.el5
I also tried creating a mysql database this way:
[root@cloud:/opt] #/usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/chef-solo
-c /var/chef/cookbooks/create_mysql_db/recipes/default.rb
[2012-09-06T23:37:13-04:00] INFO: *** Chef 10.12.0 ***
[2012-09-06T23:37:14-04:00] INFO: Run List is
[2012-09-06T23:37:14-04:00] INFO: Run List expands to
[2012-09-06T23:37:14-04:00] INFO: Starting Chef Run for cloud.jokefire.com
[2012-09-06T23:37:14-04:00] INFO: Running start handlers
[2012-09-06T23:37:14-04:00] INFO: Start handlers complete.
[2012-09-06T23:37:14-04:00] INFO: Chef Run complete in 0.005601 seconds
[2012-09-06T23:37:14-04:00] INFO: Running report handlers
[2012-09-06T23:37:14-04:00] INFO: Report handlers complete
This is the recipe that tries to do that:
[root@cloud:/opt] #cat
/var/chef/cookbooks/create_mysql_db/recipes/default.rb
bash "really awesome way to create a mysql database from chef using the
bash method" do
dont if the db already exists
not_if("/usr/bin/mysql -uroot -psecretsauce -e'show databases' | grep
#{node[:create_mysql_db][chef_test]}", :user => 'bluethundr')
run as my user
user "bluethundr"
a heredoc of the code to execute, note the node hash is created from
the JSON file
code <<-HEY_BRO_EOM
mysql -uroot --psecretsauce -e 'create database
#{node[:create_mysql_db][:chef_test]}'
HEY_BRO_EOM
end
Result:
mysql> show databases like 'chef%';
Empty set (0.00 sec)
I was just wondering if there might be some docs to get me past this stage
or even just some basic advice.
Thanks
Tim
On Wed, Sep 5, 2012 at 5:00 PM, Daniel DeLeo dan@kallistec.com wrote:
On Wednesday, September 5, 2012 at 1:11 PM, Tim Dunphy wrote:
Hello,
I come from using puppet to manage our conf files and am very new to
chef, but looking forward to diving in here since it seems like a great
tool.
I've just installed Chef 10.12 on centos 5.6 using a gem install.
/usr/bin/gem install chef ohai --no-rdoc --no-ri
When I go to run chef-solo for the first time I am running into a ruby
error with the following output:
[root@cloud:~] #/usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/chef-solo -c
/usr/lib/ruby/1.8/optparse.rb:451:in parse': missing argument: -c (OptionParser::MissingArgument) from /usr/lib/ruby/1.8/optparse.rb:1295:in
parse_in_order'
from /usr/lib/ruby/1.8/optparse.rb:1254:in catch' from /usr/lib/ruby/1.8/optparse.rb:1254:in
parse_in_order'
from /usr/lib/ruby/1.8/optparse.rb:1248:in order!' from /usr/lib/ruby/1.8/optparse.rb:1339:in
permute!'
from /usr/lib/ruby/1.8/optparse.rb:1360:in parse!' from /usr/lib/ruby/gems/1.8/gems/mixlib-cli-1.2.2/lib/mixlib/cli.rb:154:in
parse_options'
from
/usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/../lib/chef/application.rb:75:in
configure_chef' from /usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/../lib/chef/application.rb:62:in
reconfigure'
from
/usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/../lib/chef/application/solo.rb:134:in
reconfigure' from /usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/../lib/chef/application.rb:68:in
run'
from /usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/chef-solo:25
I tried doing a : gem install OptionParser
But that hasn't changed the output.
I was just wondering if I might be missing a ruby module and/or what I
would need to install to get chef running in this host for the first time.
Thanks
Tim
--
GPG me!!
gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B
The -c
option requires an argument (the path to the desired config
file). I seem to remember this having a better error message in the past,
I'll look into it.
--
Daniel DeLeo
--
GPG me!!
gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B