chef

Is there any way to delay a resource's attribute resolution until the “execute” phase?

坚强是说给别人听的谎言 提交于 2019-12-21 07:40:10
问题 I have two LWRPs. The first deals with creating a disk volume, formatting it, and mounting it on a virtual machine, we'll call this resource cloud_volume . The second resource (not really important what it does) needs a UUID for the newly formatted volume which is a required attribute, we'll call this resource foobar . The resources cloud_volume and foobar are used in a recipe something like the following. volumes.each do |mount_point, volume| cloud_volume "#{mount_point}" do size volume[

Supervisor open file limit won't change when using Chef

倾然丶 夕夏残阳落幕 提交于 2019-12-21 05:15:14
问题 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

specify exact cookbook version in node run_list still possible?

让人想犯罪 __ 提交于 2019-12-21 03:30:31
问题 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 回答1: You can specify a version of a cookbook exactly as you stated. The

Importing Mysql database using Ruby/Chef Recipe for Vagrant

别等时光非礼了梦想. 提交于 2019-12-20 10:11:08
问题 I am writing a chef script to automate setting dev environments. I can get a database created and grant privileges but I am trying to find out a way to import a mysql dump file into the database that has just been created. My code for granting the access is ruby_block "Execute grants" do block do require 'rubygems' Gem.clear_paths require 'mysql' m = Mysql.new('localhost', "root", node[:mysql][:server_root_password]) m.query("GRANT ALL ON *.* TO 'root'@'10.0.0.1' IDENTIFIED BY '#{node[:mysql]

Change Vagrant port forwarding on a running system

社会主义新天地 提交于 2019-12-20 09:48:36
问题 I have a Vagrant system up and running and I want to apply a change to it which is as little as changing one of the forwarding rules. From this page: Forwarded ports are applied during vagrant up like any other configuration. But if you already have a running system, calling vagrant reload will apply them without re-importing and re-building everything. Note that forwarding ports requires a virtual machine restart since VirtualBox won’t pick up on the forwarded ports until it is completely

How are people testing opsworks cookbooks?

孤人 提交于 2019-12-20 08:59:33
问题 I have a fairly complex deployment of dynamically configured instances of a rail apps on nginx using passenger that I currently use Capistrano for. I am trying to automate the entire process on Opsworks from creating the stack, layers, instances and dynamic app deployment. None of the existing Opsworks recipes come close to what I need so I started my own custom cookbooks. I am trying to test them using test-kitchen and vagrant but the Opsworks cookbooks have too many custom dependancies to

Add custom Chef push job to Windows whitelist

倖福魔咒の 提交于 2019-12-20 04:12:38
问题 I am trying to add a push job to the Windows whitelist for the pushy-client. When I do a search with knife it shows the custom job in the whitelist for the Windows node. When I try to run it, the job immediately fails and on the Windows side it says the command is NOT in the whitelist. I found this issue in GitHub: Windows push service can't load whitelist I was wondering if anyone has a workaround, suggestion on how to fix it, or knows where in the code this lives that I could monkey-patch.

How to set Node Attributes on a Chef Client?

ぃ、小莉子 提交于 2019-12-20 01:59:13
问题 I'm using the chef-client cookbook to configure a machine as a chef client . How do I configure node attributes when this client is created ? I do not want to do knife node edit . My aim is to set some node attributes when creating this node, probably by adding something to a JSON file. UPDATE: I am creating hundreds of nodes which will use this script (see the gist) to bootstrap chef-clients. Node_name which is in the script will be different for each node. Similarly I want to set a custom

Using a variable inside a Chef recipe

一曲冷凌霜 提交于 2019-12-19 10:27:08
问题 I'm using chef-cookbook-hostname cookbook to setup node's hostname. I don't want my hostname to be hard coded in the attribute file (default['set_fqdn']). Instead the hostname will be read from a VM definition XML file. I come up with the following default recipe but apparently the variable fqdn is not given value. Is there any idea why this happens or any better to achieve my task? ruby_block "Find-VM-Hostname" do block do require 'rexml/document' require 'net/http' url = 'http://chef

chef cookbook fails on ohai undefined method `[]' for nil:NilClass

倖福魔咒の 提交于 2019-12-19 08:05:14
问题 I'm working on a chef cookbook to set up a vanilla ubuntu 12.04.2 with nginx postgresql and unicorn on my vagrant box, but I'm getting into troubles with nginx, there's an exception undefined method `[]' for nil:NilClass when installing it that seem to relate to ohai configuration. I've posted all I have here: https://github.com/DonGiulio/mychef here's the output from chef-solo: Starting Chef Client, version 11.4.0 Compiling Cookbooks... =======================================================