Saltstack Official Chrony Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.2KB

  1. # frozen_string_literal: true
  2. # Overide by OS
  3. keyfile = 'keyfile '
  4. driftfile = '/var/lib/chrony/'
  5. logdir = 'logdir /var/log/chrony'
  6. case platform[:name]
  7. when 'debian', 'ubuntu'
  8. config_file = '/etc/chrony/chrony.conf'
  9. keyfile += '/etc/chrony/chrony.keys'
  10. driftfile += 'chrony.drift'
  11. when 'gentoo'
  12. config_file = '/etc/chrony/chrony.conf'
  13. keyfile += '/etc/chrony.keys'
  14. driftfile += 'drift'
  15. else
  16. config_file = '/etc/chrony.conf'
  17. keyfile += '/etc/chrony.keys'
  18. driftfile += 'drift'
  19. end
  20. control 'Chrony configuration' do
  21. title 'should match desired lines'
  22. describe file(config_file) do
  23. it { should be_file }
  24. it { should be_owned_by 'root' }
  25. it { should be_grouped_into 'root' }
  26. its('mode') { should cmp '0644' }
  27. its('content') { should include keyfile }
  28. its('content') { should include driftfile }
  29. its('content') { should include logdir }
  30. its('content') { should include 'server 0.debian.pool.ntp.org iburst' }
  31. its('content') { should include 'server 1.centos.pool.ntp.org' }
  32. its('content') { should include 'pool 0.debian.pool.ntp.org iburst' }
  33. its('content') { should include 'pool 1.centos.pool.ntp.org' }
  34. end
  35. end