Tag Info

Hot answers tagged

41

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

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 ...


17

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, ...


8

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 ...


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 ...


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 ...


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

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 ...


4

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.


4

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 ...


4

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

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 ...


4

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] ...


3

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

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

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

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

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 ...


3

Put "runit" cookbook on top of your runlist and try again.


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

It's a bit strange but Sudo does change environment variables so maybe chef-solo is thrown off by that. As root run: env and then run sudo env You'll see that the variables are completely different. Other toughts Here is some info form the man page: If sudo is run by root and the SUDO_USER environment variable is set, sudo will use this ...


2

Although, amazon is based of Fedora/EL, the problem is that the platform is known as "amazon". The cookbooks are hardcoded to run on "centos", "redhat", "fedora" or "ubuntu", etc. The solution is to host a custom version of the bootstrap.tar.gz somewhere, which has 'amazon' as the list of the supported platforms inside the metadata.rb of all cookbooks. ...


2

Before each chef-solo run, the cookbooks should be present on that target machine, either by transferring it (via ftp/scp) or pointing the cookbook_path to a network share . If you want the cookbooks to be automatically downloaded, you would need to run a Chef Server. Whether you want to run your own chef server, or use a hosted one from OpsCode is up to ...


2

This problem is usually caused by not having the right private key PEM file added to your local ssh agent. Doing something like: $ ssh-add pk-XXXX Where the argument is the private part of the key pair used to create the EC2 instance.


2

Hmm. There should be chef output that indicates what's wrong. Looking at the cookbook, I see that it's trying to download maven 3 as: http://www.apache.org/dist/maven/binaries/apache-maven-3.0.3-bin.tar.gz (as specified in maven/attributes/default.rb, as the maven.3.url attribute). If you try to wget that URL, you'll get a 404. So, the cookbook is broken ...


2

You should set the attributes you want on the node object(s) on the Chef Server. You can do this through a variety of methods. Add the attributes to the role you've applied to the nodes - this probably the best for systems that are all in a single role. Modify the node(s) directly, with knife node edit, or script it with knife exec. Set the attributes in ...



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