chef-solo

CHEF commands help ,

泄露秘密 提交于 2019-12-25 16:34:27
问题 How can I write this command in chef ? /home/vagrant$ source ~/.rvm/scripts/rvm (->enter) I tried... execute "foo" do command "source ~/.rvm/scripts/rvm" action :run end in short, how can I write a simple command in chef? not installing something. thanks!!! 回答1: This isn't something Chef supports. source is a shell builtin, not a command, and it would have no effect on Ruby anyway has that isn't a Ruby script, it is a shell script. You can use a bash resource like this: bash 'do the needful'

CHEF commands help ,

不打扰是莪最后的温柔 提交于 2019-12-25 16:33:12
问题 How can I write this command in chef ? /home/vagrant$ source ~/.rvm/scripts/rvm (->enter) I tried... execute "foo" do command "source ~/.rvm/scripts/rvm" action :run end in short, how can I write a simple command in chef? not installing something. thanks!!! 回答1: This isn't something Chef supports. source is a shell builtin, not a command, and it would have no effect on Ruby anyway has that isn't a Ruby script, it is a shell script. You can use a bash resource like this: bash 'do the needful'

Resolve valid image value error

和自甴很熟 提交于 2019-12-25 07:00:12
问题 I'm trying to create and deploy a PostgreSQL server to AWS using the knife-ec2 gem and chef. In my .chef repository of my project I have the knife.rb file. Here are the contents of that file. cookbook_path [ 'Users/Petesta/Git/ringbase/chef/cookbooks' ] knife[:aws_access_key_id] = "randomString" knife[:aws_secret_access_key] = "randomString" knife[:aws_ssh_key_id] = "default" knife[:flavor] = "t1.micro" knife[:image] = "ami-6aad335a" knife[:region] = "us-west-1" knife[:availability_zone] =

How do I get chef cookbooks to be downloaded in Unix format on Windows?

心已入冬 提交于 2019-12-25 06:59:06
问题 I'm using Vagrant, Chef solo and berkshelf to run up a Linux VM on Windows 7 using VirtualBox. Cookbooks are downloaded from git and arrive with windows line endings. One of these is a Perl script, which is then uploaded to the vm and executed. However it fails because the first line is #!/usr/bin/perl and the Linux VM sees this as the command #!/usr/bin/perl^M How can I configure whichever tool needs it (probably Chef?) to download .pl files in Unix format? 回答1: Well, it seems it's too late

chef-solo getting logs from a bash script

戏子无情 提交于 2019-12-25 02:21:54
问题 I am executing a shell script via chef like below execute 'Run postgres data migration' do command '/home/ubuntu/build-target/infra-base/psql10_migration.sh' live_stream true action :run only_if { ::File.exist?('/home/ubuntu/build-target/infra-base/psql10_migration.sh') } end My chef logs are directed to a file ( log_location '/var/log/arkin/chef-run.log' ) Right now I am not getting any logs from the bash script psql10_migration.sh . Can someone let me know how can I get the logs from the

cookbook_name in recipe- TypeError: no implicit conversion of Symbol into String

心已入冬 提交于 2019-12-22 16:01:13
问题 I have the following code in my recipe but it errors. log "###" + cookbook_name + "::" + recipe_name + " " + Time.now.inspect + ": Starting execution phase" puts "###" + cookbook_name + "::" + recipe_name + " " + Time.now.inspect + ": Starting compile phase" The error is: TypeError: no implicit conversion of Symbol into String /test/chef/cookbooks/cookbook-server/recipes/setup_server.rb:10:in `+' The issue seems to be with the cookbook_name , recipe_name etc.(the ones which are not hardcoded)

Why does the LWRP custom definition gives me undefined method for nil:NilClass

蹲街弑〆低调 提交于 2019-12-22 08:40:11
问题 I have problem with my custom definition of this LWRP. resources : user_postgresql. actions :create, :alter default_action :create attribute :username, :kind_of => String attribute :password, :kind_of => String attribute :database_name, :kind_of => String providers : user_postgresql. def whyrun_supported? true end action :create do converge_by "Create [#{new_resource}]" do USER_NAME = new_resource.username USER_PASSWORD = new_resource.password unless (new_resource.password.nil? || new

Chef Solo error: Cookbook apt not found

こ雲淡風輕ζ 提交于 2019-12-22 05:15:22
问题 Hy I'm trying to run a MongoDB recipe with Chef Solo on an Amazon EC2 Linux AMI. I've installed Omnibus, set the cookbook path in the .rb file, and the runlist in the .json file. I've copied the content of the mongodb recipe zip from github to to cookbook folder, and ran the chef-solo command. The result is below: FATAL: Chef::Exceptions::CookbookNotFound: Cookbook apt not found. If you're loading apt from another cookbook, make sure you configure the dependency in your metadata I'm pretty

“include_recipe” vs. Vagrantfile “chef.add_recipe”. What's the difference?

我的梦境 提交于 2019-12-21 02:00:13
问题 Just ran nginx::source recipe on my vagrant box, and I have very unusual behaviour. When I include a recipe from the Vagrantfile (as below), everything works like a charm, chef.add_recipe("project::nginx") chef.add_recipe("nginx::source") ( project::nginx recipe is very simple. Using it to override default attributes of the nginx cookbook) but if I include a recipe at the very end of project::nginx (mentioned up), everything falls apart: node.default['nginx']['server_names_hash_bucket_size']