chef

Supervisor open file limit won't change when using Chef

独自空忆成欢 提交于 2019-12-03 16:53:08
I am modifying /etc/security/limits.conf on the machine, and then installing Supervisor in a Chef recipe. After the recipe run finishes, if I run cat /proc/<process id>/limits I see: Limit Soft Limit Hard Limit Units Max cpu time unlimited unlimited seconds Max open files 1024 4096 files If I log into the machine and run service supervisor restart , the max open files is then set correctly. However, if I run this command in the recipe (right after installing supervisor, at the very end of the recipe, anything) the limit does not change. It is not until I log in and manually run that command

Dynamic Role Attributes in Chef

ⅰ亾dé卋堺 提交于 2019-12-03 16:44:48
I would like the Chef cookbook network_interfaces to have dynamic values for ip addresses, netmasks and alike for each of my nodes. What works for me is the following: db_role.rb (block1): override_attributes( "network_interfaces" => { :device => 'eth0', :address => '123.123.123.123', } ) But that is not very dynamic. My idea was to submit the ip address(, netmask, etc.) to each node on knife bootstrap . The node would then look like so (block2): { "normal": { "network_interfaces" => { "device" : "eth0", "address" : "123.123.123.123" } }, "name": "foobar", "run_list": [ "recipe[zsh]", "role

download roles and cookbooks from ChefServer with knife

倖福魔咒の 提交于 2019-12-03 14:08:26
Given I started working with Chef using the Chef Server Management Console and I now want to start using a files and upload them via knife. Is there a way to retrive roles and environments that are stored on the ChefServer via knife, so I can them into git? You can use the knife environment list and knife environment show commands to download environments and replace "environment" with "role" to do the same for roles. mkdir environments for env in `knife environment list`; do knife environment show $env --format=json > environments/$env.json done You can then check these JSON files into git

Can't install chef, gem version conflict with net-ssh net-ssh-multi net-ssh-gateway

陌路散爱 提交于 2019-12-03 14:02:55
问题 Using rvm, and an empty gemset, I get this: $ gem install chef --no-ri --no-rdoc ERROR: While executing gem ... (Gem::DependencyError) Unable to resolve dependencies: chef requires net-ssh (~> 2.2.2); net-ssh-multi requires net-ssh (>= 2.6.5); net-ssh-gateway requires net-ssh (>= 2.6.5) I've tried resolving it by installing earlier versions of net-ssh-gateway and net-ssh-multi, but net-ssh-multi version 1.1 confounds me by installing 1.1.2. 回答1: This is due to an update of net-ssh-multi that

Stuck trying to bootstrap Windows server using Chef

巧了我就是萌 提交于 2019-12-03 13:50:58
I am a mac girl, working on connecting with knife-windows trough Opscode's managed Chef to my Rackspace Windows servers. (I know, it sounds exotic, but these Windows servers are a customer requirment). I tried to Chef for a spin but I am stuck in trying to bootstrap the Windows 2008 Server on Rackspace with the knife-windows command. I am working on OSX, using rvm, ruby 2.1.0 and a local gemset with chef + knife-windows. I was trying to follow the steps from: https://github.com/opscode/knife-windows I have configured the winrm service. I have set up a rule to allow inbound connections in my

Using a Chef recipe to append multiple lines to a config file

▼魔方 西西 提交于 2019-12-03 11:33:17
I'm trying to create a Chef recipe to append multiple lines (20-30) to a specific config file. I'm aware the recommended pattern is to change entire config files rather than just appending to a file, but I dislike this approach for multiple reasons. So far the only solution I found was to use a cookbook_file and then use a bash resource to do: cat lines_to_append >> /path/configfile Obviously this wouldn't work properly, as it'd append the file over and over, each time you run chef-client. I'd have to create a small bash script to check for a specific string first, and, if not found , append

How do I share code across Chef cookbooks in a chef-repo?

回眸只為那壹抹淺笑 提交于 2019-12-03 11:28:13
I would like to share a small handful of methods across recipes in a chef repo. I know that on a cookbook level I can put code in modules in the libraries directory (see related question ). What I'm looking for is something like that but available across all of the cookbooks in my Chef repo. I can think of a couple solutions: Create a gem, install the gem as part of the chef run. This seems like overkill. Put the file in some folder and add that folder to the $LOAD_PATH in the recipe file. I have a feeling that won't work with actual deployment because the chef server doesn't know anything

specify exact cookbook version in node run_list still possible?

 ̄綄美尐妖づ 提交于 2019-12-03 10:32:46
I have this in my notes that {"run_list":["recipe[nginx@1.2.3]"]} is possible to explicitly specify a cookbook version to use in a nodes run_list but i can't get it to work and can't find any documentation to say if this is still supported or if it's been deprecated. This is using chef 11.18.0. Can anyone confirm if this is still OK to use and where this should be configured. In the node run_list or role run_list ? thanks w25r You can specify a version of a cookbook exactly as you stated. The format is recipe[cookbook_name::recipe_name@cookbook_version] . You do not need to include the recipe

How to query cookbook versions on a node?

橙三吉。 提交于 2019-12-03 10:18:44
Usage case: The DevOps team launched a node sometime ago, and my team would like to know what's the version(s) of one/several cookbook(s) being used in the run_list. Our DevOps team is firefighting so we'd like to find a way to be self-sufficient. Commands Tried: knife cookbook show COOKBOOK give all possible versions, but does not specify which one being used. knife node show NODE shows all cookbooks, but there's no version info attached. Question: Is there a command (something similar to knife search , ohai ) to query the chef-server for the versions deployed on the node? Tejay Cardon If you

How do I check if a folder exists in Chef?

北城余情 提交于 2019-12-03 10:12:26
问题 This is my code: if !::File.exist?("#{node['iis']['home']}\\backup\\BkpB4Chef") windows_batch "Backup IIS Config" do code <<-EOH "#{node['iis']['home']}"\\appcmd add backup BkpB4Chef EOH end end It always says file exists and executes the loop. 回答1: You should use Chef guards here. Guards specify conditional execution, but still insert the resource into the resource collection. In your example and jtblin answer, the resource is never added to the collection (which I'll explain a bit further