diff --git a/attributes/default.rb b/attributes/default.rb index 87bee218..5075bfac 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -36,6 +36,7 @@ default['chef_client']['log_file'] = 'client.log' default['chef_client']['interval'] = '1800' default['chef_client']['splay'] = '300' +default['chef_client']['delay_after_boot'] = '60' default['chef_client']['conf_dir'] = '/etc/chef' default['chef_client']['bin'] = '/opt/chef/bin/chef-client' diff --git a/recipes/systemd_service.rb b/recipes/systemd_service.rb index b7fb5710..ca117b50 100644 --- a/recipes/systemd_service.rb +++ b/recipes/systemd_service.rb @@ -81,7 +81,7 @@ class ::Chef::Recipe 'Unit' => { 'Description' => 'chef-client periodic run' }, 'Install' => { 'WantedBy' => 'timers.target' }, 'Timer' => { - 'OnBootSec' => '1min', + 'OnBootSec' => "#{node['chef_client']['delay_after_boot']}sec", 'OnUnitInactiveSec' => "#{node['chef_client']['interval']}sec", 'RandomizedDelaySec' => "#{node['chef_client']['splay']}sec", } diff --git a/resources/systemd_timer.rb b/resources/systemd_timer.rb index 70b8b0cd..5c6439f7 100644 --- a/resources/systemd_timer.rb +++ b/resources/systemd_timer.rb @@ -27,7 +27,7 @@ property :user, String, default: 'root' -property :delay_after_boot, String, default: '1min' +property :delay_after_boot, String, default: '60sec' property :interval, String, default: '30min' property :splay, [Integer, String], default: 300, coerce: proc { |x| Integer(x) }, diff --git a/test/integration/timer_systemd/timer_systemd_spec.rb b/test/integration/timer_systemd/timer_systemd_spec.rb index a6ef5a78..b7a87baa 100644 --- a/test/integration/timer_systemd/timer_systemd_spec.rb +++ b/test/integration/timer_systemd/timer_systemd_spec.rb @@ -7,7 +7,7 @@ control 'has expected unit content' do describe file('/etc/systemd/system/chef-client.timer') do - its('content') { should match 'OnBootSec = 1min' } + its('content') { should match 'OnBootSec = 60sec' } its('content') { should match 'OnUnitInactiveSec = 1800sec' } its('content') { should match 'RandomizedDelaySec = 300sec' } end