chef

How do I use roles in test kitchen?

孤街醉人 提交于 2019-12-24 06:51:21
问题 I can't figure out how to run roles in a run list in test kitchen. I did a knife download roles to my chef repo ( C:\.chef\roles ). I also did a knife download cookbooks to c:\.chef\cookbooks Here is the .kitchen.yml for a cookbook I want to test which I plan to run with a particular role ( C:\.chef\cookbooks\mybook\.kitchen.yml ): --- driver: name: hyperv parent_vhd_folder: c:\HyperV\VHDs\ parent_vhd_name: 2012R2_Fresh_Gen1.vhdx vm_switch: NAT memory_startup_bytes: 2GB provisioner: name:

How do I use roles in test kitchen?

陌路散爱 提交于 2019-12-24 06:51:09
问题 I can't figure out how to run roles in a run list in test kitchen. I did a knife download roles to my chef repo ( C:\.chef\roles ). I also did a knife download cookbooks to c:\.chef\cookbooks Here is the .kitchen.yml for a cookbook I want to test which I plan to run with a particular role ( C:\.chef\cookbooks\mybook\.kitchen.yml ): --- driver: name: hyperv parent_vhd_folder: c:\HyperV\VHDs\ parent_vhd_name: 2012R2_Fresh_Gen1.vhdx vm_switch: NAT memory_startup_bytes: 2GB provisioner: name:

Connection to pypi.python.org timed out

爱⌒轻易说出口 提交于 2019-12-24 05:28:27
问题 i am managing a rhel server 6.x which have the Python-2.7.8 installed for an application. When the below chef resource is executed by the chef-client. execute "/usr/local/bin/python2.7 #{node[:base_dir]}/get-pip.py" I see the below error in the chef-client log. [2015-02-24T17:42:27+00:00] ERROR: execute[/usr/local/bin/python2.7 /opt/mount/get-pip.py] (python_app::default line 105) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1' ----

Win 8.1, Vagrant, Chef, Ubuntu, Ember-cli, ember new “npm ERR! tar.unpack untar error /home/vagrant/.npm/”

安稳与你 提交于 2019-12-24 04:12:47
问题 I'm on Windows 8.1, with vagrant, Cheffile and everything works. Now I'm doing: npm install -g ember-cli and it's ok. But when I do this: ember new sample in vagrant folder (the same folder I can view in Windows) I receive this error: version: 1.13.8 Could not find watchman, falling back to NodeWatcher for file system events. Visit http://www.ember-cli.com/user-guide/#watchman for more info. installing app create .bowerrc create .editorconfig create .ember-cli create .jshintrc create .travis

Deleting all files matching a regular expression in chef

岁酱吖の 提交于 2019-12-24 03:29:47
问题 I would like my chef recipe to delete all files that match a certain regex. What would be the way to go about this? 回答1: You could use an execute resource in your recipe: execute "Deleting files ... " do command "find . -regex 'REGEX' -delete" cwd "/path/to/folder" action :run end The command expects a target system having the find command. 回答2: Depending on your use case, the previous answers may work. However, using bash's native delete functionality is not cross-platform. Additionally,

Chef - how to write a custom resource containing DSL for “execute”

↘锁芯ラ 提交于 2019-12-24 03:14:38
问题 I have written a chef definition that posts to our chat server. Since definitions are not recommended any more, how can I rewrite this as a resource? I'm particularly interested in how to use "event" ways to trigger the code. File chat\definitions\post.rb : define :chat_post do chat_url = 'https://chat.our.company/hooks/abcdef1234567890' message = params[:name] execute "echo" do command "curl -m 5 -i -X POST -d \"payload={"text": "#{message}"\" #{chat_url}" ignore_failure true end end Calling

what's the purpose of chef repository?

╄→尐↘猪︶ㄣ 提交于 2019-12-24 03:13:06
问题 I am a newbie for Chef. After installing, the document prompt me to clone a chef repository from git. I am wondering what's the purpose of chef repository. If I only need to use it as a chef client. 回答1: The chef repository gives structure to organizing all the artifacts (cookbooks, recipes, roles, etc.) that are used with chef to describe and ultimately configure your infrastructure. The repository is needed at development time when you create your own cookbooks, modify existing ones and

Chef creating a comma separated string from template and knife search

拜拜、爱过 提交于 2019-12-23 22:54:47
问题 I'm trying to create a dynamically created comma separated list of Splunk indexers (with the data port appended to each host name) from a knife query that supplies the returned list of hosts to a template and corresponding erb. However the string in the conf file never gets created although no errors are thrown when I converge on my test Docker instance. Here's the knife query, the attribute it's referencing, and the template resource attribute file entry: default['forwarder']['indexer_role']

Java JDK silent installation with specified path

随声附和 提交于 2019-12-23 16:28:50
问题 I want to install in silent mode (in fact, using Chef) JDK in specified version. My problem is, when I add INSTALLDIR parameter, Java JDK installation fails. Without it JDK will install in default directory ( C:/Program Files/Java/ or C:/Program Files (x86)/Java/ ). I am running command jdk-7u79-windows-i586.exe /s INSTALLDIR="C:/java" and also tried jdk-7u79-windows-i586.exe /s INSTALLDIR:"C:/java" what makes Java installation show pop-up window with parameters I can use in MSI installer. C:

Possible to change gem sources for chef-client?

孤街浪徒 提交于 2019-12-23 11:00:15
问题 Is any one aware of a way to change the gem sources for a chef-client run? My node of concern is behind a firewall, so I want to replace rubygems.org with an internal Nexus repo (https://github.com/sonatype/nexus-ruby-support). I tried updating the source list for 'chef embedded gem', but the offending chef_gem calls seem to be using a different source list that still refers to rubygems.org. 回答1: You can override the source URLs in /root/.gemrc The format is as follows: :sources: - http:/