Where do you find the runlist (Vagrant)? - vagrant

According to this link
Chef Solo error: Cookbook apt not found
it says, i have to add apt cookbook in runlist.
I downloaded the apt-cookbook but I don't know where the runlist is.
Help.

Where are you configuring this setup? If you are doing it on AWS Opswork then in that respective layer setup you can mention the runlist under its Recipe section.
One thing to note is that the sequence in runlist also matter, you should have to specify 'apt::default' first then other recipe.

Related

'cookbook' is missing in the structure of knife solo init

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.

No resource or method named `windows_zipfile' for `Chef::Recipe "default"'

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).

Vagrant CHEF and EC2

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...

Chef knife configuration

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]

How to add cookbooks from chef documentation

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

Resources