As I mentioned before, Chef appears to work well on mostly Debian and Ubuntu. You will have to do a bit more work on the other OSes: In the case of FreeBSD, a lot more.
Here is one example: The recipe chef-clientis used to install startup scripts on the nodes (rc scripts for Red Hat, upstart for Ubuntu, etc). it works on most OSes - except for BSD systems. In fact, in the code, when it noticed it is on a BSD systems, it puts out the following:
when "bsd"
log "You specified service style 'bsd'. You will need to set up your rc.local file."
log "Hint: chef-client -i #{node["chef_client"]["client_interval"]} -s #{node["chef_client"]["client_splay"]}"
else
log "Could not determine service init style, manual intervention required to start up the chef-client service."
end
in other words, it doesn’t even bother.
I am not sure if it is out of laziness or just having limited resources that they didn’t create rc scripts for BSD (I could understand OpenBSD, but FreeBSD?), so I created the following rc script:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | |
Ordinarily, I shouldn’t have to create a separate function to kill a chef process, but for some reason, the rc functions within FreeBSD can’t find the PID.
Interestingly enough, during my debugging with the script, through the use oftruss I found an undocumented feature where instead of adding the entry to enable a service in /etc/rc.conf, you can put it in /etc/rc.conf.d - which is what I did:
freebsd82# pwd
/etc/rc.d
freebsd82# cd ../rc.conf.d
freebsd82# ls
chef
freebsd82# cat chef
chef_enable="YES"
Apparently it came from NetBSD.
With that, I got a working chef init script. Now to see if I can update the chef-client recipe and working on FreeBSD.