chef

Chef cookbook - reload PATH

梦想与她 提交于 2019-12-01 07:12:35
问题 I just installed java using chef cookbook and updated PATH environment variable for all users (added new file to /etc/profile.d/). Is it possible to tell chef to reload PATH variable? When I do something like this: execute "java_check" do command "java -version" end Is says that java could not be found. It works fine when I log out, log in again and then run chef recipe. 回答1: I'm not 100% sure you can update the PATH variable for future chef runs, but you can set it up manually using the

Vagrant: how to set owner to synced/shared folders when this owner is created in the provisioning phase

天大地大妈咪最大 提交于 2019-12-01 03:53:02
问题 Vagrantfile (relevant parts) config.vm.provision :chef_solo do |chef| chef.add_recipe "yum" # various recipes.. # in one of these i create the 'localuser' user end config.vm.synced_folder "./site/frontend", "/var/www/vhosts/site/frontend", :owner=> 'localuser', :group=>'apache', :extra => 'dmode=755,fmode=755' When i do the first vagrant up i get an erroring on mounting because it can't find localuser (mounting of shared folders comes before the provisioning) What can i do to have a shared

Resolve recursive git cookbook dependencies with Berkshelf

送分小仙女□ 提交于 2019-12-01 03:04:19
问题 tl;dr version: Is Berkshelf able to resolve recursive dependencies within Git-based cookbooks and if yes - how? I try to manage my Chef cookbook dependencies with Berkshelf. The cookbooks are all stored in internal Git repositories. The dependencies are as follows: env_dockerhub_dev >>depends on>> app_dockerhub >>depends on>> app_docker The main Berksfile in my project looks like this: source "https://supermarket.chef.io" cookbook "env_dockerhub_dev", git: "git@URL_TO_GIT_SERVER/chef_env

Chef wrapper cookbook best practices

限于喜欢 提交于 2019-11-30 20:32:20
In learning chef, I see conflicting patterns for wrapper cookbooks. For example. Some cookbooks use default.rb and others use customize.rb for overrides. attributes/default.rb attributes/customize.rb Which is best practice? Also, some wrapper cookbooks have parameters like this, in the recipes/default.rb file : normal['foo']['bar'] = 42 Whereas others have default['foo']['bar'] = 42 And some have node.set['foo']['bar'] = 42 Additionally some cookbooks use symbols, and other strings ['foo']['bar'] [:foo][:bar] Which style should I use? Update Looks like chef has released an official style guide

Chef chef-validator.pem security

*爱你&永不变心* 提交于 2019-11-30 20:07:45
Hi I am setting up a cluster of machines using chef at offsite locations. If one of these machines was stolen, what damage can the attacker do to my chef-server or other nodes by having possession of chef-validator.pem ? What other things can they access through chef? Thanks! This was one of the items discussed at a recent Foodfight episode on managing "secrets" in chef. Highly recommended watching: http://foodfightshow.org/2013/07/secret-chef.html The knife bootstrap operation uploads this key when initializing new chef clients. Possession of this key enables the client to register itself

Adding Attributes to Test Kitchen

两盒软妹~` 提交于 2019-11-30 20:04:02
I'm trying to override attributes in the java cookbook with test-kitchen . When I try run kitchen converge default-centos-64 , a bad YAML error shows up. --- driver: name: vagrant customize: memory: 1024 cpuexecutioncap: 50 provisioner: name: chef_solo platforms: - name: centos-6.4 suites: - name: default run_list: - recipe[java::default] - recipe[maven::default] attributes: { java.install_flavor: "oracle", java.jdk_version: "7" } I pasted the above into http://yamllint.com/ . When I hit "Go," it removes all lines beginning at "attributes", and then shows a Green "Valid YAML". Attributes are

How to specify cookbook path in .kitchen.yml file?

坚强是说给别人听的谎言 提交于 2019-11-30 18:12:14
I have my Chef cookbooks stored in chef/cookbooks/ folder. When running kitchen converge I am still getting notice Berksfile, Cheffile, cookbooks/, or metadata.rb not found so Chef will run with effectively no cookbooks. Is this intended? I tried many options, for example: suites: - name: default run_list: recipe[git] cookbook_path: "chef/cookbooks" but I can't find the proper solution. How to specify the cookbooks' and roles' paths? You'll want to put the path in your berksfile, which will likely end up looking like so.. source 'https://supermarket.chef.io' cookbook 'cookbookname', path:

Access the registry of another user with Chef

元气小坏坏 提交于 2019-11-30 15:56:13
Is it possible to access the registry of another user with Chef? I have the chef-client running as System and I want to modify the registry of User1? Is there a way to do this? The registry_key resource provides a way to access HKEY_Users but I see no way to map the username to the SID. Kenny Evitt This ended up being mildly convoluted and looking at it makes me cringe. But it seems to work! I wanted to modify another user's environment variables via the registry, as described in this Server Fault answer , but I also wanted to create the user with Chef. The problem then is that Windows doesn't

undefined method “cheffish” for nil:NilClass, when provisioning chef with vagrant

我只是一个虾纸丫 提交于 2019-11-30 15:06:15
问题 I'm trying to run a django-server in a Vagrant box using Chef, but I've been stuck on this for a few hours and can't find anything online. The relevant bit of my vagrantfile looks like this: (sorry for the poor indentation) Also, the box is running centos7. config.vm.provision :chef_solo do |chef| chef.cookbooks_path = "cookbooks" chef.add_recipe "apache2" chef.add_recipe "apt" chef.add_recipe "bluepill" chef.add_recipe "build-essential" chef.add_recipe "chef-sugar" chef.add_recipe "chef

Testing Chef roles and environments

人走茶凉 提交于 2019-11-30 15:05:56
问题 I'm new to Chef and have been using Test Kitchen to test the validity of my cookbooks, which works great. Now I'm trying to ensure that environment-specific attributes are correct on production nodes prior to running Chef initially. These would be defined in a role. For example, I may have recipes that converge using a Vagrant box with dev settings, which validates the cookbook. I want to be able to test that a production node's role. I think I want these tests as the source of truth