Saltstack Official Chrony Formula
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

89 lines
3.0KB

  1. {% set chrony = salt['grains.filter_by']({
  2. 'Debian': {
  3. 'package': 'chrony',
  4. 'service': 'chrony',
  5. 'config': '/etc/chrony/chrony.conf',
  6. 'config_src': 'salt://chrony/files/chrony_config',
  7. 'ntpservers': [
  8. '0.debian.pool.ntp.org',
  9. '1.debian.pool.ntp.org',
  10. '2.debian.pool.ntp.org',
  11. '3.debian.pool.ntp.org'
  12. ],
  13. 'options': 'offline minpoll 8',
  14. 'allow': [
  15. '10/8',
  16. '192.168/16',
  17. '172.16/12'
  18. ],
  19. 'logdir': '/var/log/chrony',
  20. 'keyfile': '/etc/chrony/chrony.keys',
  21. 'driftfile': '/var/lib/chrony/chrony.drift',
  22. 'otherparams': [
  23. 'log tracking measurements statistics',
  24. 'maxupdateskew 100.0',
  25. 'dumponexit',
  26. 'dumpdir /var/lib/chrony',
  27. 'commandkey 1',
  28. 'local stratum 10',
  29. 'rtconutc'
  30. ],
  31. },
  32. 'RedHat': {
  33. 'package': 'chrony',
  34. 'service': 'chronyd',
  35. 'config': '/etc/chrony.conf',
  36. 'config_src': 'salt://chrony/files/chrony_config',
  37. 'ntpservers': [
  38. '0.centos.pool.ntp.org',
  39. '1.centos.pool.ntp.org',
  40. '2.centos.pool.ntp.org',
  41. '3.centos.pool.ntp.org'
  42. ],
  43. 'options': 'iburst',
  44. 'logdir': '/var/log/chrony',
  45. 'keyfile': '/etc/chrony.keys',
  46. 'driftfile': '/var/lib/chrony/drift',
  47. 'otherparams': [
  48. 'rtcsync',
  49. 'makestep 10 3',
  50. 'stratumweight 0',
  51. 'bindcmdaddress 127.0.0.1',
  52. 'bindcmdaddress ::1',
  53. 'commandkey 1',
  54. 'generatecommandkey',
  55. 'noclientlog',
  56. 'logchange 0.5',
  57. ],
  58. },
  59. 'Arch': {
  60. 'package': 'chrony',
  61. 'service': 'chronyd',
  62. 'config': '/etc/chrony.conf',
  63. 'config_src': 'salt://chrony/files/chrony_config',
  64. 'ntpservers': [
  65. '0.arch.pool.ntp.org',
  66. '1.arch.pool.ntp.org',
  67. '2.arch.pool.ntp.org'
  68. ],
  69. 'options': 'iburst',
  70. 'logdir': '/var/log/chrony',
  71. 'keyfile': '/etc/chrony.keys',
  72. 'driftfile': '/var/lib/chrony/drift',
  73. 'otherparams': [
  74. 'rtconutc',
  75. 'rtcsync',
  76. ],
  77. }
  78. },
  79. grain='os_family',
  80. merge=salt['pillar.get']('chrony:config'))
  81. %}
  82. {# Debian distros check /etc/default/rcS to determine UTC setting #}
  83. {% if grains['os_family'] == "Debian" %}
  84. {% if salt['cmd.run']('grep UTC=no /etc/default/rcS') %}
  85. {% do chrony['otherparams'].remove('rtconutc') %}
  86. {% endif %}
  87. {% endif %}