Chef/knife command to update clients after changing role
After I boot up a server using Chef, if I've forgotten to include a recipe in a role (eg apache2::mod_ssl) is there a way to simply update the client without having to delete it and "knife server create" again?
Even better, the servers are all registered with my Chef server (Opscode platform), so in theory they should be able to receive updates from Opscode after I push role changes to the platform. Is this possible? Or is it possible to have my se开发者_如何学运维rver check the Chef server for changes on a regular interval, perhaps every 10 minutes?
This comes 2 years later, but I hope it helps somebody else :)
On the client node ( the server where you want to run the new recipe ), run :
sudo chef-client -i 600
"-i 600
" : to keep polling chef-server for changes at an interval of 600 seconds .
knife ssh SEARCH 'sudo chef-client'
For example:
knife ssh 'role:webserver' 'sudo chef-client'
or
knife ssh 'name:mynode' 'sudo chef-client'
Check out the documentation for more details on the SEARCH options.
Note: depending on your settings, you may or may not need to sudo
.
Found my own answer: simply run chef-client
on the server.
精彩评论