Reputation: 803
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?
Upvotes: 0
Views: 1250
Reputation: 803
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.
Upvotes: 0