When i type knife solo init . command, cookbook folder is not created in the basic structure.
I cannot find any reason why it is doing this.
my chef and knife are the latest version so far.
Your help will be highly appreciated!
You can see the code here: https://github.com/matschaffer/knife-solo/blob/v0.5.1/lib/chef/knife/solo_init.rb#L35
The only thing that would prevent it from making the cookbooks/ folder is if a file of the same name exists.
Related
When I try to run a simple unzip recipe on windows environment I am getting the below error:
No resource or method named `windows_zipfile' for `Chef::Recipe "default"'
Please let me know how to fix this.
This resource is defined in the windows cookbook, not in Chef core itself.
Thus, in order to use it, you have to declare the windows cookbook as a dependency of your cookbook and upload it to the Chef server (or your cookbooks directory when running with chef solo).
I am using Vagrant to create a EC2 VM. My provisioner is CHEF.
My current challenge is to how to retrieve the VM public name while provisioning.
I've found that Ohai is capturing EC2 metadata and it is available during the provisioning. This is great. But, I can't seem to make Ohai capture the metadata.
According to this article, I need to create the ec2 hint file.
Added the command to my CHEF recipe but it didn't work.
What is the right timing to create the hint file? A code snippet will be appreciated.
Tensibai comment was helpful. It answered my question:
Use the shell provisionner of vagrant to create the file as per the documentation, before the the chef provisionner block, so it will be done before chef start...
I feel silly asking this question as it seems to work flawlessly for most people but I couldn't solve the following problem I encountered after setting up a Chef server 12 on RHEL 6 and the ChefDK 0.6.0 on my mac.
The chef server setup went through like charm as describeb on the documentation, no errors at all. When I wanted to use my machine as workstation to push cookbooks to the server I always get the error "The object you are looking for could not be found". According to other stackoverlfow posts (0, 1, 2) this is likely due to a configuration issue in knife.rb. Nevertheless, I used "knife configure" to setup the knife.rb file and double checked for any typos in the path. In addition, according to the knife.rb documentation page I used the attributes properly.
Anyone have an idea what could cause the problem?
log_level :info
log_location STDOUT
node_name "nodermatt"
client_key "/Users/odermatt/chef-repo/.chef/nodermatt.pem"
validation_client_name "Adobe-validator.pem"
validation_key "/Users/odermatt/chef-repo/.chef/Adobe-validator.pem"
chef_server_url "https://sj1010005158157.corp.adobe.com:443/organizations/Adobe"
syntax_check_cache_path "/Users/odermatt/chef-repo/.chef/syntax_check_cache"
cookbook_path [ "/Users/odermatt/chef-repo/cookbooks" ]
You need to do perform knife commands under .chef directory. I too had same problem for change I tried under .chef directory, it was working. Try "knife client check" and "knife cookbook upload yourcookbook".
In knife.rb file, give chef_server_url as with your orgs name means which org you need to upload the cookbook. Typically be like "https://api.chef.io/organizations/orgname" and give path to your cookbooks directory.
I had this same issue, could not run
knife node run_list add nodename 'recipe[cron-delvalidate::default]' - cron-delvalidator recipe to the node named: chefnode
I found out, after reading this that it's Chefnode, not chefnode, capital "C". This solved my issue.
The response was:
Chefnode:
run_list: recipe[cron-delvalidate::default]
I am a new to chef cookbooks and currently working on a task. I have already completed the tutorial on chef.io but i am struggling to understand how can i install a cookbook provided at chef-io.
So as of now, I have downloaded the cookbook. Its .tar file and i extracted it. I can see respective default.rb and other files but i am unable to get that how can i add this cookbook to my existing cookbooks which are creating a vm image.
Is there any guide or tutorial that i can follow ?
In addition to Josh's answer it sounds to me like want to add it to your chef-repo after downloading it and extracting the gzip file?
Just add the maven directory to your cookbooks directory. Or you could just do knife cookbook site install maven from within your chef-repo directory.
Or maybe you want to upload it to your Chef Server?
knife cookbook upload maven See: https://docs.chef.io/knife_cookbook.html#upload
If I'm understanding your question correctly, then what you need to do is create a Chef role, and then list all of the recipes that you want to execute in your role's run_list. As for documentation, check out Chef's documentation on roles: Chef Roles
Firstly if i get your question right, you are trying to download an already existing cookbook from the community. If so, you can follow these steps :
1) Download the cookbook which is in the .tar format as you specified, extract it and place that particular cookbook within your chef-repo path from where you want to upload it.
2) Once done, do a "knife cookbook upload cookbook-name"
Now the main part is, if you are trying to upload this cookbook and make it part of your already existing run-list. You need to add this within the run-list.
Else if you are doing it via role, you will need to add this cookbook recipe within your role's run-list.
But keep in mind, whatever cookbook's you download from the community might have dependencies on other cookbook's so choose wisely. The lesser cookbook's the better as this makes your run-list converge faster for a faster chef-client run.
Hope this helps.
Regards,
Akshay
I have downloaded a Vagrantfile, but when i run vagrant up in terminal the following message appears:
Bringing machine 'default' up with 'virtualbox' provider... There are
errors in the configuration of this machine. Please fix the following
errors and try again:
vm:
* The host path of the shared folder is missing: ~/Sync
OBS.: Using Ubuntu 14.10
I created a folder named Sync in my home.
According to Vagrant docs host path must be either absolute (i.e. /home/user/Sync) or relative to project root (place where your Vagrantfile is).
Relative to project root means if your Vagrantfile resides in /home/user/MyProject then setting up path as "Sync" will create share from /home/user/MyProject/Sync.
Ref: http://docs.vagrantup.com/v2/synced-folders/basic_usage.html
I assumed you are in linux or mac. Type in "pwd" and enter in the terminal where Homestead.yml is.
Mine is "/home/idhamhafidz/Code/opp190-ama"
Then go to your Homestead.yml and edit the folders section like in the image below:
Then quit edit Homesteady.yml and re-run vagrant up again.
In my case it was a space at the end of the path in config.yaml:
source: '/Users/h/Packt/Code '
I've deleted this space and it's working now.
If you are using Vagrant and Windows Subsystem for Linux then you can solve the issue creating a symlink
ln -s /mnt/c/Users/user/project ~/project
/mnt/c/Users/user/project should match the Vagrant project in your Windows machine.
~/project should match the path that is missing.
Note, that you may need to create any intermediary directories.
I know this is an old question, but for anyone just encountering this issue and having a hard time finding a conclusion the answer by #megawebmaster would be the correct approach in giving the relative path to the folder: "/home/(your-pc-username)/Sync/".
Also with a Vagrantfile being ruby-based I personally use ruby's ENV object:
#{ENV["HOME"]}/Sync should resolve the issue.
I came across the same problem and
mkdir ~/Sync help me solve it.