Specify run list in unattended bootstrap?

Okay, so my PXE boot/kickstart installation of Ubuntu server with the chef client is working. The last thing that I need to happen to make me really happy is to be able to specify a run list in the unattended bootstrap. However, after much Googling and link-clicking, I haven’t found a solution to this problem.

My ideal scenario is that I plug a new server into the network, turn it on, and press F12 to get it to PXE boot, and an hour later it’s all configured for its production role. I don’t want to have to go into knife and use the command line every time I put a new server into production.

How can this be accomplished? (My server is a physical server, so many of the AWS solutions don’t appear to be appropriate for my scenario.)

The easiest way I’ve found is to do chef-client -r <recipe> to specify
the run list. You can alternatively use -j and provide a json file with
the run list provided there.

Thanks,
Ameir

Thanks, Ameir. Building off your suggestion, I was able to get a client to install from bare metal and run a run list.

However, I can’t figure out a way for the client to modify its run list on the server, which is ultimately what I want.

I’m surprised that this is so difficult to do. I can’t imagine that I’m the only Chef user that wants a fully automated method to deploy client machines. Is every Chef user out there really running knife for every new node that is put into the environment? That seems counterproductive to me. Why force users to add a manual step to an otherwise automated process?

Surely there’s a solution to this problem, isn’t there? Am I the oddball for wanting new machines in my environment to automatically enroll in configuration management?

Sure, not a problem. At my company, we use an internal fork of https://github.com/ameir/chef-initstrap that looks up AWS tags and creates the full chef-client command with the run list, environment, and other options specified. We do not touch the servers at all; they come and go without any human intervention.

Ultimately, you just need to figure out a process to get the right params passed to chef-client; if all of your servers are homogenous, then that’s easily just done within PXE as you’re doing it; otherwise, you need to figure out how to target specific sets of nodes differently.

Hope that helps!
-Ameir

After a successful client run, the chef-client will write the node data back to the server, including the run list. As long as you set up whatever scripting you need to pass the correct run list in via either the -j JSON or --runlist RUNLIST options, and your chef-client run succeeds, you should end up with the correct node data on the server eventually.