Saltstack Official Chrony Formula
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

84 行
2.8KB

  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': 'chrony',
  62. 'config': '/etc/chrony.conf',
  63. 'config_src': 'salt://chrony/files/chrony_config',
  64. 'options': 'iburst',
  65. 'logdir': '/var/log/chrony',
  66. 'keyfile': '/etc/chrony.keys',
  67. 'driftfile': '/var/lib/chrony/drift',
  68. 'otherparams': [
  69. 'rtconutc',
  70. 'rtcsync',
  71. ],
  72. }
  73. },
  74. grain='os_family',
  75. merge=salt['pillar.get']('chrony:config'))
  76. %}
  77. {# Debian distros check /etc/default/rcS to determine UTC setting #}
  78. {% if grains['os_family'] == "Debian" %}
  79. {% if salt['cmd.run']('grep UTC=no /etc/default/rcS') %}
  80. {% do chrony['otherparams'].remove('rtconutc') %}
  81. {% endif %}
  82. {% endif %}