chef

How do I check if Chef's version mets a gem requirement from inside a recipe?

拜拜、爱过 提交于 2019-12-04 09:24:16
Chef::Version contains the version number of the Chef gem, and I want to check that it meets the gem requirement of ~> 10.14 inside a recipe. Alternatively, you can use Chef’s built-in version comparison mechanisms (available since at least Chef 12): Chef::VersionConstraint.new('>= 14.0.0').include? Chef::VERSION Use Gem::Requirement and Gem::Version : Gem::Requirement.new("~> 10.14").satisfied_by?(Gem::Version.new(Chef::VERSION)) This returns a boolean value - true if Chef::VERSION satisfies ~> 10.14 . 来源: https://stackoverflow.com/questions/19516077/how-do-i-check-if-chefs-version-mets-a-gem

Including a Chef LWRP from another cookbook

别来无恙 提交于 2019-12-04 08:51:24
问题 I wrote a small LWRP my app cookbook ( trim_log ), and it works. However, now I am trying to move this particular LWRP in to the commons cookbook so that my other cookbooks can also use it. The problem is that I cannot figure out how to load in the trim_log resource/provider in to any of the cookbooks, including my app cookbook. ├── app │ ├── recipes │ └── default.rb ├── commons ├── providers │ └── trim_log.rb └── resources └── trim_log.rb I have defined the trim_log provider/resource in the

Vagrant - how to print Chef's command output to stdout?

大兔子大兔子 提交于 2019-12-04 08:40:51
If we have in Chef cookbook code like: if !File.exists?('/vagrant/project/target/project/WEB-INF") || node[:compile_project] bash "build project" do user "vagrant" cwd "/vagrant/project" code <<-EOH mvn clean mvn db-migration:migrate mvn package EOH end end When run vagrant up we can see only brief information that 'build project' is executed. However wen we run 'mvn package' command from terminal we can see full command output. How to tell Vagrant/Chef to show full output? EDIT: I've tried this but nothing has changed in output. config.vm.provision :chef_solo do |chef| chef.log_level = :debug

How to change chef nginx default http port 80?

僤鯓⒐⒋嵵緔 提交于 2019-12-04 08:20:02
I tried to install apache on a machine that chef-server was installed. Apache could not start up due to the occupation of port 80 by chef nginx. If I want to let apache use port 80 as default, is it possible to change chef nginx default http port to another one? I found a solution on the Internet to set virtual host on both apache and nginx, but they need a different FQDN as server name. My machine uses an IP instead of FQDN, so I need to change the default HTTP port for chef nginx. I tried to add /etc/chef-server/chef-server.rb with the following content: nginx['non_ssl_port'] = 9898 Then I

Chef: Why are resources in an “include_recipe” step being skipped?

一个人想着一个人 提交于 2019-12-04 07:50:11
问题 Chef seems to be processing resources in a strange order, causing my build to fail. My main recipe ( mytardis-chef/site-cookbooks/recipes/default.rb ) starts like this: include_recipe "build-essential" include_recipe "mytardis::deps" include_recipe "mytardis::nginx" include_recipe "mytardis::postgresql" mytardis-chef/cookbooks/build-essential/recipes/default.rb looks like this: case node['platform'] when "ubuntu","debian" %w{build-essential binutils-doc}.each do |pkg| package pkg do action

Vagrant + Chef: Error in provision “Shared folders that Chef requires are missing on the virtual machine.”

亡梦爱人 提交于 2019-12-04 07:39:21
问题 I've installed a Vagrant + Virtualbox using Chef (+library chef). When I do vagrant up first time, cookbooks get loaded correctly. However, when I do provision afterwards (be it vagrant provision , vagrant reload --provision or vagrant up --provision I get this error: Shared folders that Chef requires are missing on the virtual machine. This is usually due to configuration changing after already booting the machine. The fix is to run a `vagrant reload` so that the proper shared folders will

Installing a gem after native extension packages during chef execution

天大地大妈咪最大 提交于 2019-12-04 07:25:50
I am trying to install the fog gem in a chef recipe though the gem installation occurs before the native packages are being installed so the gem installation fails package "libxslt-dev" package "libxml2-dev" chef_gem "fog" This is the output [Thu, 14 Mar 2013 13:04:30 +0000] INFO: Processing chef_gem[fog] action install (ebs4000::update_volumes line 23) [Thu, 14 Mar 2013 13:04:52 +0000] ERROR: Running exception handlers [Thu, 14 Mar 2013 13:04:52 +0000] FATAL: Saving node information to /var/cache/chef/failed-run-data.json [Thu, 14 Mar 2013 13:04:52 +0000] ERROR: Exception handlers complete

Vagrant & Chef - Cookbook *** not found

牧云@^-^@ 提交于 2019-12-04 06:22:42
问题 I am trying to set up a simple development VM using vagrant and Chef as a provisioner. I am able to install chef using shell provisioner but it seems to me that the folder with chef recipes does not get mounted to the VM. It keeps complaining that cookbook *** not found. Here is my vagrant file and output I am getting # -*- mode: ruby -*- # vi: set ft=ruby : Vagrant::Config.run do |config| # This strange method defines the name of the Vagrant Machine config.vm.define "SubscriptionAPI" do

Chef mysql opscode-cookbooks desn't work: “could not find recipe ruby for cookbook mysql”

一世执手 提交于 2019-12-04 05:39:47
I'm tring to use https://github.com/opscode-cookbooks/mysql but when I run vagrant provision could not find recipe ruby for cookbook mysql it returns like this. [2014-04-23T10:13:06+00:00] ERROR: Running exception handlers [2014-04-23T10:13:06+00:00] ERROR: Exception handlers complete [2014-04-23T10:13:06+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out [2014-04-23T10:13:06+00:00] ERROR: could not find recipe ruby for cookbook mysql ================================================================================ Recipe Compile Error =======================================

Chef - How to run a cookbook locally

五迷三道 提交于 2019-12-04 05:29:30
问题 I'm just getting started with Chef and have gone through the tutorials on their site, however everything seems to assume you'd be configuring a chef server etc. for the deploy I'm currently in the process of setting up a site on AWS opsworks so I wanted to use Chef for the configuration and installing dependencies. As such I believe I just supply a path to my cookbook. Now before I launch into Opsworks I was trying to create my cookbook on an ubuntu VM and test that it installs everything