Chef works every 30 minutes

I understand that the chef works in the sense that he detects any changes in the recipes and uses the chef's client to set the changes. We use chefs to invoke EC2 instances, but a chef who runs as a daemon every 30 minutes and starts all recipes, again causing unwanted changes for some services. I would like to know what options exist to change this and run the chef-client on demand.

Below are the options I've been thinking about so far,

  • Change the interval time in the chef's cookbook to a very high period so that the demon does not execute frequently.
  • After deploying an EC2 instance, kill the ssh chef demon, or perhaps even a chef recipe.

I also think that the chef has a log rotation scheduled on a weekly basis, this will restart the chef-client again. Any ideas on how to avoid this craving based behavior?

+5
source share
3 answers

Primarily:

Your chef recipes should set your node to 1 in the same configuration, no matter how many times the chef starts. You should also never restart any services yourself. This behavior should be notified by configuration files if they are changed. For instance:

service 'apache2' do
  action [:enable, :start]
end

template '/etc/apache2/httpd.conf' do
  action :create
  [...]
  notifies, :restart, 'service[apache2]' #this notification will launch, only if the file has changed
end

You can also disable the chef-client daemon by running chef-client --once. This way the chef will provide node and remove itself from cron. Thus, in the future it will only be launched manually on demand.

, chef-client . .

+10

, , - 30 , chef-client:: service , . chef-client README.

0

Chef, , . , Apache, .

, chef- . .

0
source

All Articles