简体   繁体   中英

Need to disable chef-client on Windows Chef

I have a need to provision Windows VMs with knife and run the initial configuration once with Chef... but have the chef-client disabled after that. Unfortunately setting the interval and task variables to 0 in the default.rb attributes file in the chef-client cookbook do not seem to work:

# log_file has no effect when using runit
default['chef_client']['log_file']    = 'client.log'
default['chef_client']['interval']    = '0'
default['chef_client']['splay']       = '0'
default['chef_client']['conf_dir']    = '/etc/chef'
default['chef_client']['bin']         = '/usr/bin/chef-client'

...

# Configuration for Windows scheduled task
default['chef_client']['task']['frequency'] = 'minute'
default['chef_client']['task']['frequency_modifier'] = node['chef_client']      ['interval'].to_i / 0
default['chef_client']['task']['user'] = 'SYSTEM'
default['chef_client']['task']['password'] = nil # Password is only required for none system users

Any ideas on what I need to do?

只是根本不运行厨师-客户食谱。

What I ended up doing was altering the windows_service.rb recipe to disable the service:

service 'chef-client' do
action [:disable, :stop]
end

coderanger's answer is probably ok but this will allow an easier answer to events that might need the client to be easily ran in the future if needed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM