Tag Info

Hot answers tagged

50

I am going to orient this answer as if the question was "what are the advantages of chef-solo" because that's the best way I know to cover the differences between the approaches. My summary recommendation is in line with others: use a chef-server if you need to manage a dynamic, virtualized environment where you will be adding and removing nodes often. A ...


21

Disclosure: I work for Opscode. The major benefit of Chef Server over Solo is the ability to use search with your infrastructure. The classic example is a load balancer with web servers. The load balancer can automatically update its configuration as web servers are added and removed to the infrastructure, simply by searching for them. Solo is just that, ...


21

Disclaimer: I am one of the developers of Puppet, another tool in the space. The advantages of using Chef on a single node are the same as using it on multiple nodes: you declare how the system should be, in a form that is easy to version control, backup, audit, and change. Chef will then go ahead and make sure your system stays that way: if something ...


9

This question seems subjective, but I'll try to approach this answer objectively. The Chef Server provides a publishing system and search index with a RESTful API. This means you can: Distribute cookbooks for nodes through a single location that has an API, and primitives for creating version constraints, retrieval, all the things you'd probably expect ...


8

Use the directory resource to create the directory before creating the template. The trick is to also specify the recursive attribute otherwise the action will fail unless all parts of the directory but the last exist already. config_dir = "#{node[:app][:deploy_to]}/#{node[:app][:name]}/shared/config" directory config_dir do owner node[:user][:username] ...


7

There are plenty of good reasons to use configuration management software. While there are many different tools, I'll focus on a few of the features of Puppet (the main concepts are largely the same). Note: While you could argue that writing your own scripts could achieve the same results, presumably you'd have to write and maintain a large codebase to ...


7

You might (also) look into Vagrant for this. A video is showing how to use the combo of Vagrant and Chef cookbooks. And there's a dedicated page to Vagrant and Chef on the Opscode site (update 2015-01-23: page has gone...).


6

I went on about in a blog post from January. Eventually, you'll have to migrate that machine, replace it, setup a new one, run a test build, etc. Also, everything is documented in one place, so anybody else who has to look at the machine can tell what is going on without having to hunt around the system. Like it says above: Every time I get another machine, ...


6

If you use chef-solo, you don't get to use knife. Knife is API client for the chef-server, with some extra utility sugar (like knife rackspace server create you've mentioned). To configure server with chef-solo, you should copy your chef repo to the server, and run chef-solo there over ssh. There is no ready-made script or knife plugin that I know of that ...


6

If all else fails, there's the old fashioned way - On Ubuntu or debian,use dpkg --get-selections to dump out a list of installed packages, and install them with dpkg --set-selections. The equivalent of this for red hat based distros is yum-debug-dump and yum-debug-restore (optionally with --install-latest). Create the same users as the source system if ...


6

Most Windows bootstrap resources are focused on Hosted Chef and using the knife-windows plugin. However this should be possible with Chef solo. If you're not building an AMI with chef-client on it then your first step is to get the Full Chef Windows installer on there. Fortunately, as I recall, winrm is enabled by default on the Windows Amazon AMIs. Take ...


5

If you just want to configure a virtual host via nginx, it's likely you want to use the nginx cookbook. The application_nginx cookbooks is not meant to be used directly; rather it is a dependency of the application cookbook. If you are just getting started with chef I would avoid the application cookbook for now, since its use is somewhat complex. The ...


5

The behaviour you're seeing can be explained by understanding the difference between two of the key stages in a Chef client run: compilation, and convergence. During the "compile" phase, the Chef client runs the code in your recipes to build a resource collection. This is a list of the Resources that you've told Chef to manage on your system, along with ...


5

Check out the knife-solo plugin, which can automatically install chef-solo on your remote server, upload your cookbooks onto it, and then run chef-solo. It basically automates what other folks who've answered this question have suggested doing.


5

Notifications are the right way to handle this. Suppose you want to do the following: Conditionally download a file If the file is downloaded Stop apache immediately Process the file (e.g. unzip it or move it) Start apache again You would do it like this: # Define the apache service but don't do anything with it service "apache" do action :nothing ...


5

I just encountered this exact issue myself with chef+vagrant and found the following worked for me: sudo dpkg-reconfigure -plow grub-pc This allows you to reconfigure grub-pc and select the device (if any) you want grub installed on. Setting a device as default here should allow an upgrade that includes grub to not prompt for a device selection. At this ...


4

One thing to point out - if node['environment'] hasn't been set at all, your example would fail as it is. Here's the output I got: [Tue, 16 Oct 2012 02:40:31 +0000] INFO: Starting Chef Run for vagrant.int.housepub.org [Tue, 16 Oct 2012 02:40:31 +0000] INFO: Running start handlers [Tue, 16 Oct 2012 02:40:31 +0000] INFO: Start handlers complete. [Tue, 16 Oct ...


3

This will do the trick: yml_string = YAML::dump(node['cfn']['environment'].to_hash)


3

The problem is that your resources have the same name. service "apache" is not unique, so chef is de-duplicating them. Your options are to give them separate names like this service "apache stop" do service_name "apache" action :stop end # Do something service "apache start" do service_name "apache" action :start end you could also use a ...


3

The proper approach wrt chef/puppet et al is to package that software in your distro(')s native packaging format yourself and include it in your repositories and then to pull that package.


3

All users on the system are automatically detected by ohai when Chef runs, and available in the node['etc'] attribute space. Users are node['etc']['passwd']. You can iterate over this like a hash. You can exclude "system" or "precreated by packages" by comparing whether a user's numeric ID is over whatever is defined in your systems /etc/login.defs UID_MIN. ...


3

There's the cucumber-chef ruby gem and a recently released book Nelson-Smith et al - "Test-driven Infrastructure with Chef" that makes use of that gem - http://www.cucumber-chef.org/ Just remembered this from my github watchlist: https://github.com/gregretkowski/vmth/ The VMTH (Virtual Machine Test Harness) provides a mechanism to unit-test your ...


3

I'm not aware of any other way than using the directory resource before the template resource: directory "#{node[:app][:deploy_to]}/#{node[:app][:name]}/shared/config/ owner node[:user][:username] group node[:user][:username] end


3

The purpose of that command is to feed your password through a one-way hashing algorithm (-1 outputs MD5). What that gets you is a string that's derived from your password cryptographically, but cannot be used to find your password on its own if an attacker gets their hands on the hashed version (theoretically - there's a salt included which helps against ...


2

After some chat on the #chef IRC channel, here's what I ultimately needed to know. Most of it is actually peripheral info, rather than openssl passwd specific, but anyway... Chef users the standard adduser command (http://linux.die.net/man/8/adduser) for adding users. That command accepts the password already encrypted - Hence why you need to store an ...


2

I finally managed to solve this (at least on Ubuntu) by using the cookbook 'ruby_build', '>= 0.8.0' with this simple recipe: include_recipe 'ruby_build' ruby_build_ruby '1.9.3-p484' do prefix_path '/usr/local' action :install end Note the prefix_path i used worked perfectly fine on Ubuntu 12.04 since /usr/local/bin is already in system $PATH ...


2

Solved by adding the following to my service in chef: "provider Chef::Provider::Service::Upstart" This is really going to start getting annoying when some services let you use init.d and others force you to use upstart.


2

Make the bash resource name unique, by e.g. the following code: bash "populate-create_alarms-#{metric}" do .. end


2

Putting this in custom JSON did the job - { "deploy": { "my_app_name": { "delete_cached_copy": false } } }


2

You can't share variables between recipes, but there are two ways to share data between recipes. The preferred route would be to externalize static and django as attributes in attributes/default.rb. This means they'll become available on the node object and accessible from each recipe. attributes/default.rb default["server"]["static"] = [] ...



Only top voted, non community-wiki answers of a minimum length are eligible