FAQ Database Discussion Community

Chef-Solo user resource not accessing via SSH

I'm using Chef-Solo and after creating a new user, I can't connect via SSH. My resource: user 'myuser' do supports :manage_home => true gid "root" home '/home/myuser' system true shell '/bin/bash' password 'mypassword' end Command line: $ ssh [email protected] [email protected]'s password: Permission denied, please try again. But $ ssh [email protected]

Logging Java Exceptions in Chef

I am invoking a jar using chef like : execute "publish" do Chef::Log.info("About to published") command "java -jar myjar.jar" Chef::Log.info("Published") end Now in case while executing myjar, it throws an exception, the same is not visible on the console. Is there some way by which the same can be viewed...

Chef Vagrant, Can't Find Folder

Chef is really confusing me. Can you help me understand why it's not working? Cliff Notes I'm using Chef-Solo (not Berkshelf or anything else) Everything works when I set it up from scratch, I can vagrant provision But if I reboot the HOST (My main operating system) it breaks! It...

How can I run a cookbook with a specific version using chef-client?

I am having 2 cookbooks name as mycookbook and version 0.1.0 and 0.1.1 on chef server. Now I want to run only cookbook mycookbook version 0.1.1 using chef-client. How do I do this ?

Write users to .htpasswd in chef recipe

In a chef recipe invoked by chef-solo / vagrant I'm trying to write a .htpasswd file from an object of users. I specify the users in vagrantfile like this... chef.json = { :apache => { ... :my_users => { :john => "test", :matt => "test2" } ... My chef recipe...

Chef Looping Recipes and Passing Data?

In Chef Solo I am creating several virtual-hosts in a recipe called projects. I have three recipes which are used to compile 1 project: Recipes gunicorn::addsite nginx::addsite supervisor::addsite They only generate the needed templates. I am wondering: How can I run all three recipes in a loop to create several...

Syntax error on a Chef official recipe, provisioning Vagrant

I'm having a syntax error on an official recipe. When I tried to run this recipe from inside a vagrant box, it worked fine. I used: chef-client --local-mode --runlist [...] Now I'm trying to provision the box with chef-solo, as chef-client requires a server and keys. It should be equivalent....

Chef Knife not saving changes with editor

I want to create a role with knife. So I run: > knife role create beautifulprayer ERROR: RuntimeError: Please set EDITOR environment variable No problem! Just add the editor. Afterwards: > knife role create beautifulprayer This opens the editor that I have set (subl) and goes ahead once the editor...

Packer with chef-solo provisioning does nothing

I'm starting up with Packer using chef-solo to provision. I have a very simple recipe (default.rb) that contains the lines below: package "git" package "ruby" package "rubygems" I was able to provision an image using Vagrant with this successfully. I'm now trying to move this provision step to Packer but...

why is chef-client synchronization slow for local cookbooks

Background I'm running chef-client --local-mode with cookbook path set to ./berks-cookbooks these cookbooks where already downloaded by berkshelf before running chef. (chef sdk 4.0.0, berkshelf 3.2.3) Before running my scripts, chef has to run "Synchronizing Cookbooks" and this step takes 2 to 3 minutes. I understand that chef is downloading...

vagrant + chef setup trying to git clone into synced folder

I have a synced folder in my vagrant setup local.vm.synced_folder "../api", "/api" and I want to be able to git clone another repository into this folder like this: git "api" do destination "/api" repository "[email protected]:<user>/<repo>.git" revision "development" checkout_branch "development" action :sync end but I get an error saying: ==> local:...

Vagrant up chef provision fails on normal up

So I thought I had this all working, but it seems I'm still missing something. When I vagrant destroy --force && vagrant up, everything works just fine. It creates the box and chef provisioning works as intended. However, if I do a vagrant halt and then a vagrant up, I...

How to set delay between converge and verify on kitchen test?

I'm running Serverspec integration smoke tests with Test Kitchen on a system built with Vagrant+Chef Solo. When i run kitchen test then the tests are started right after successful converge, and some of my tests fail because it takes time for the system to fully start up for the first...

Pass a variable from bash into chef template

In my chef recipe, I have a bash ruby block. I need some value generated from it passed to my templates. For example, the joke variable in here: bash "create opal user" do code <<-EOH joke='my funny joke' echo $joke EOH end template '/joke.txt' do source 'joke.txt.erb' variable(joke:"#{joke}") end ...