{"id":17260,"date":"2025-04-18T23:42:23","date_gmt":"2025-04-18T15:42:23","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/17260.html"},"modified":"2025-04-18T23:42:23","modified_gmt":"2025-04-18T15:42:23","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8%e6%88%90%e7%99%be%e4%b8%8a%e5%8d%83%e5%8f%b0%e6%9c%8d%e5%8a%a1%e5%99%a8%e4%b8%8a%e8%bd%bb%e6%9d%be%e9%83%a8%e7%bd%b2%e6%97%b6%e9%97%b4%e5%90%8c%e6%ad%a5%e6%9c%8d%e5%8a%a1","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/17260.html","title":{"rendered":"\u5982\u4f55\u5728\u6210\u767e\u4e0a\u5343\u53f0\u670d\u52a1\u5668\u4e0a\u8f7b\u677e\u90e8\u7f72\u65f6\u95f4\u540c\u6b65\u670d\u52a1\uff1f\u53ea\u9700\u8fd9\u4efdAnsible Playbook\uff01"},"content":{"rendered":"<p>\u5728\u5927\u89c4\u6a21\u7684\u751f\u4ea7\u73af\u5883\u4e2d&#xff0c;\u65f6\u95f4\u540c\u6b65\u4e00\u76f4\u662f\u4e00\u4e2a\u770b\u4f3c\u7b80\u5355\u5374\u81f3\u5173\u91cd\u8981\u7684\u4efb\u52a1\u3002\u60f3\u8c61\u4e00\u4e0b&#xff0c;\u5f53\u4f60\u7684\u670d\u52a1\u5668\u7fa4\u4e2d\u6709\u4e0a\u767e\u53f0\u673a\u5668&#xff0c;\u6bcf\u53f0\u673a\u5668\u7684\u65f6\u95f4\u53ef\u80fd\u56e0\u4e0d\u540c\u7684\u539f\u56e0\u7565\u5fae\u504f\u79bb&#xff0c;\u6700\u7ec8\u5f71\u54cd\u5230\u65e5\u5fd7\u8bb0\u5f55\u3001\u6570\u636e\u5e93\u540c\u6b65\u3001\u751a\u81f3\u81ea\u52a8\u5316\u4efb\u52a1\u7684\u6267\u884c&#xff0c;\u7ed3\u679c\u53ef\u80fd\u5bfc\u81f4\u6570\u636e\u4e22\u5931\u6216\u4e25\u91cd\u7684\u4e1a\u52a1\u4e2d\u65ad\u3002<\/p>\n<p>\u95ee\u9898\u6765\u4e86?<\/p>\n<p>\u4f60\u662f\u5426\u66fe\u9047\u5230\u8fc7&#xff0c;\u67d0\u4e2a\u670d\u52a1\u56e0\u4e3a\u65f6\u95f4\u4e0d\u4e00\u81f4\u800c\u51fa\u73b0\u65e0\u6cd5\u9884\u6599\u7684\u9519\u8bef&#xff1f;\u6216\u8bb8\u4f60\u7684\u65e5\u5fd7\u6587\u4ef6\u65e5\u671f\u6df7\u4e71&#xff0c;\u6570\u636e\u5e93\u540c\u6b65\u65f6\u51fa\u73b0\u65f6\u95f4\u6233\u4e0d\u4e00\u81f4\u7684\u95ee\u9898&#xff1f;\u8fd9\u4e9b\u90fd\u53ef\u80fd\u662f\u56e0\u4e3a\u670d\u52a1\u5668\u65f6\u95f4\u6ca1\u6709\u5f97\u5230\u7cbe\u786e\u540c\u6b65&#xff0c;\u6216\u8005\u540c\u6b65\u914d\u7f6e\u51fa\u73b0\u4e86\u95ee\u9898\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418154217-680272d95ac4d.jpg\" alt=\"\" \/><\/p>\n<p>\u90a3\u4e48&#xff0c;\u5982\u4f55\u786e\u4fdd\u6240\u6709\u670d\u52a1\u5668\u7684\u65f6\u95f4\u7cbe\u786e\u4e00\u81f4&#xff1f;<\/p>\n<p>\u5982\u4f55\u5728\u4e00\u4e2a\u5e9e\u5927\u7684\u96c6\u7fa4\u4e2d&#xff0c;\u5feb\u901f\u3001\u53ef\u9760\u5730\u90e8\u7f72\u65f6\u95f4\u540c\u6b65\u670d\u52a1&#xff1f;<\/p>\n<p>\u7ee7\u7eed\u5f80\u4e0b\u770b\u5427&#xff0c;\u4f60\u5c06\u4f1a\u53d1\u73b0\u5982\u4f55\u901a\u8fc7Ansible\u6765\u8f7b\u677e\u5b9e\u73b0Chrony\u65f6\u95f4\u540c\u6b65\u670d\u52a1\u5668\u7684\u81ea\u52a8\u5316\u90e8\u7f72\u54e6&#xff01;<\/p>\n<h3>\u65f6\u95f4\u540c\u6b65\u7684\u91cd\u8981\u6027<\/h3>\n<p>\u5728\u4f01\u4e1a\u7ea7IT\u73af\u5883\u4e2d&#xff0c;\u65f6\u95f4\u540c\u6b65\u770b\u4f3c\u662f\u4e2a\u4e0d\u8d77\u773c\u7684\u95ee\u9898&#xff0c;\u4f46\u5176\u5b9e\u5b83\u5bf9\u6574\u4e2a\u7cfb\u7edf\u7684\u7a33\u5b9a\u6027\u3001\u6570\u636e\u4e00\u81f4\u6027\u548c\u6545\u969c\u6392\u9664\u81f3\u5173\u91cd\u8981\u3002\u65e0\u8bba\u662f\u5e94\u7528\u7a0b\u5e8f\u3001\u65e5\u5fd7\u6587\u4ef6&#xff0c;\u8fd8\u662f\u6570\u636e\u5e93\u4e8b\u52a1&#xff0c;\u90fd\u4f9d\u8d56\u4e8e\u65f6\u95f4\u7684\u51c6\u786e\u6027\u3002<\/p>\n<p>\u5e38\u89c1\u7684\u65f6\u95f4\u540c\u6b65\u5de5\u5177\u5305\u62ecNTP\u548cChrony&#xff0c;\u800c\u5728\u73b0\u4ee3\u865a\u62df\u5316\u73af\u5883\u4e2d&#xff0c;Chrony\u901a\u5e38\u662f\u66f4\u4f18\u7684\u9009\u62e9&#xff0c;\u56e0\u4e3a\u5b83\u80fd\u63d0\u4f9b\u66f4\u5feb\u7684\u540c\u6b65\u901f\u5ea6\u548c\u66f4\u4f4e\u7684\u8d44\u6e90\u5360\u7528&#xff0c;\u5c24\u5176\u5728\u7f51\u7edc\u4e0d\u7a33\u5b9a\u6216\u865a\u62df\u5316\u73af\u5883\u4e2d\u8868\u73b0\u5c24\u4e3a\u51fa\u8272\u3002<\/p>\n<h3>\u9762\u4e34\u7684\u6311\u6218<\/h3>\n<p>\u5047\u8bbe\u4f60\u662fIT\u8fd0\u7ef4\u4e3b\u7ba1&#xff0c;\u8d1f\u8d23\u7ba1\u7406\u516c\u53f8\u6570\u767e\u53f0\u670d\u52a1\u5668&#xff0c;\u8fd9\u4e9b\u670d\u52a1\u5668\u53ef\u80fd\u5206\u5e03\u5728\u4e0d\u540c\u7684\u6570\u636e\u4e2d\u5fc3\u3002\u968f\u7740\u4e1a\u52a1\u7684\u4e0d\u65ad\u6269\u5927&#xff0c;\u7ba1\u7406\u6bcf\u53f0\u673a\u5668\u7684\u65f6\u95f4\u540c\u6b65\u53d8\u5f97\u8d8a\u6765\u8d8a\u590d\u6742\u3002\u6b64\u65f6&#xff0c;\u624b\u52a8\u53bb\u9010\u53f0\u8bbe\u7f6e\u65f6\u95f4\u540c\u6b65\u6e90&#xff0c;\u663e\u7136\u4e0d\u73b0\u5b9e&#xff0c;\u4e14\u5bb9\u6613\u51fa\u9519\u3002<\/p>\n<p>\u5982\u4f55\u8ba9\u6240\u6709\u670d\u52a1\u5668\u7684\u65f6\u95f4\u540c\u6b65\u53d8\u5f97\u7b80\u5355\u3001\u81ea\u52a8\u4e14\u9ad8\u6548&#xff1f;<\/p>\n<h3>\u4e3a\u4ec0\u4e48\u9009\u62e9 Chrony&#xff1f;<\/h3>\n<p>Chrony\u5728\u4e00\u4e9b\u573a\u666f\u4e0b\u4f18\u4e8e\u4f20\u7edf\u7684 NTP&#xff1a;<\/p>\n<ul>\n<li>\u66f4\u7cbe\u786e\u7684\u540c\u6b65&#xff1a;Chrony\u53ef\u4ee5\u5728\u670d\u52a1\u5668\u542f\u52a8\u65f6\u8fc5\u901f\u540c\u6b65\u65f6\u95f4&#xff0c;\u800cNTP\u53ef\u80fd\u9700\u8981\u66f4\u957f\u65f6\u95f4\u3002<\/li>\n<li>\u9002\u5e94\u4e0d\u7a33\u5b9a\u7684\u7f51\u7edc&#xff1a;Chrony\u5728\u4e0d\u7a33\u5b9a\u7684\u7f51\u7edc\u73af\u5883\u4e0b\u8868\u73b0\u66f4\u597d&#xff0c;\u80fd\u591f\u5904\u7406\u4e22\u5305\u548c\u5ef6\u8fdf\u3002<\/li>\n<li>\u9ad8\u6548\u7684\u8d44\u6e90\u5360\u7528&#xff1a;Chrony\u7684\u8d44\u6e90\u6d88\u8017\u76f8\u5bf9\u8f83\u4f4e&#xff0c;\u66f4\u9002\u5408\u5927\u89c4\u6a21\u96c6\u7fa4\u3002<\/li>\n<\/ul>\n<h3>Ansible\u81ea\u52a8\u5316\u90e8\u7f72Chrony\u65f6\u95f4\u540c\u6b65<\/h3>\n<p>\u901a\u8fc7Ansible&#xff0c;\u4f60\u53ef\u4ee5\u8f7b\u677e\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898&#xff0c;\u5feb\u901f\u90e8\u7f72\u5e76\u914d\u7f6eChrony\u65f6\u95f4\u540c\u6b65\u670d\u52a1\u3002Ansible\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u81ea\u52a8\u5316\u8fd0\u7ef4\u5de5\u5177&#xff0c;\u53ef\u4ee5\u8ba9\u4f60\u5728\u51e0\u5206\u949f\u5185\u5b8c\u6210\u8de8\u5927\u89c4\u6a21\u96c6\u7fa4\u7684\u914d\u7f6e\u548c\u7ba1\u7406\u4efb\u52a1\u3002\u901a\u8fc7\u4e00\u4e2a\u7b80\u5355\u7684Playbook&#xff0c;\u4f60\u5c31\u80fd\u5b8c\u6210\u4ee5\u4e0b\u4efb\u52a1&#xff1a;<\/p>\n<ul>\n<li>\u6279\u91cf\u5b89\u88c5 Chrony \u8f6f\u4ef6\u5305&#xff1b;<\/li>\n<li>\u914d\u7f6e\u65f6\u95f4\u540c\u6b65\u6e90&#xff0c;\u786e\u4fdd\u6bcf\u53f0\u670d\u52a1\u5668\u7684\u65f6\u95f4\u4e0e\u6807\u51c6\u65f6\u95f4\u540c\u6b65&#xff1b;<\/li>\n<li>\u81ea\u52a8\u542f\u52a8\u5e76\u542f\u7528 Chrony \u670d\u52a1&#xff0c;\u786e\u4fdd\u670d\u52a1\u5728\u670d\u52a1\u5668\u542f\u52a8\u65f6\u81ea\u52a8\u542f\u52a8&#xff1b;<\/li>\n<li>\u901a\u8fc7\u4e00\u4e2a\u547d\u4ee4\u67e5\u770b\u540c\u6b65\u72b6\u6001&#xff0c;\u786e\u4fdd\u7cfb\u7edf\u65f6\u95f4\u7cbe\u51c6\u3002<\/li>\n<\/ul>\n<p>\u9996\u5148&#xff0c;\u8ba9\u6211\u4eec\u5728Ansible\u7684\u4e3b\u673a\u6e05\u5355\u91cc\u6dfb\u52a0\u6211\u4eec\u7684\u76ee\u6807\u670d\u52a1\u5668\u3002\u5047\u5982\u6211\u4eec\u73b0\u5728\u4e13\u6ce8\u4e8e\u8bbe\u7f6eChrony\u5ba2\u6237\u7aef&#xff0c;\u5e76\u4e14\u51b3\u5b9a\u4f7f\u7528\u56fd\u5185\u7684\u4e92\u8054\u7f51\u65f6\u95f4\u670d\u52a1\u5668\u6765\u8fdb\u884c\u65f6\u95f4\u540c\u6b65\u7684\u8bdd&#xff0c;\u90a3\u4e48\u63a5\u4e0b\u6765\u5c31\u662f\u5177\u4f53\u7684\u6b65\u9aa4\u4e86\u3002<\/p>\n<h4>\u914d\u7f6e\u4e3b\u673a\u6e05\u5355\u6587\u4ef6<\/h4>\n<p>hosts.ini \u6587\u4ef6\u5982\u4e0b&#xff1a;<\/p>\n<p>[chrony_clients]<br \/>\nansible ansible_host&#061;192.168.31.100<br \/>\nansible ansible_host&#061;192.168.31.101<br \/>\nansible ansible_host&#061;192.168.31.102<\/p>\n<h4>\u914d\u7f6e\u5ba2\u6237\u7aef\u540c\u6b65\u670d\u52a1\u5668\u65f6\u95f4<\/h4>\n<p>\u5bf9\u4e8eChrony\u5ba2\u6237\u7aef&#xff0c;\u6211\u4eec\u914d\u7f6e\u5b83\u4eec\u4ece\u6307\u5b9a\u7684\u65f6\u95f4\u540c\u6b65\u670d\u52a1\u5668\u540c\u6b65\u65f6\u95f4&#xff1a;<\/p>\n<p><span class=\"token punctuation\">&#8212;<\/span><br \/>\n<span class=\"token punctuation\">&#8211;<\/span> <span class=\"token key atrule\">name<\/span><span class=\"token punctuation\">:<\/span> \u90e8\u7f72Chrony\u65f6\u95f4\u540c\u6b65\u670d\u52a1<br \/>\n  <span class=\"token key atrule\">hosts<\/span><span class=\"token punctuation\">:<\/span> chrony_servers<br \/>\n  <span class=\"token key atrule\">become<\/span><span class=\"token punctuation\">:<\/span> yes<br \/>\n  <span class=\"token key atrule\">vars<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token key atrule\">ntp_server1<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token string\">&#034;ntp1.aliyun.com&#034;<\/span><br \/>\n    <span class=\"token key atrule\">ntp_server2<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token string\">&#034;ntp2.aliyun.com&#034;<\/span><br \/>\n    <span class=\"token key atrule\">ntp_server3<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token string\">&#034;ntp3.aliyun.com&#034;<\/span><br \/>\n    <span class=\"token key atrule\">ntp_server4<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token string\">&#034;ntp4.aliyun.com&#034;<\/span><br \/>\n    <span class=\"token key atrule\">network_range<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token string\">&#034;192.168.31.0\/24&#034;<\/span><br \/>\n  <span class=\"token key atrule\">tasks<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token punctuation\">&#8211;<\/span> <span class=\"token key atrule\">name<\/span><span class=\"token punctuation\">:<\/span> \u5b89\u88c5Chrony\u8f6f\u4ef6\u5305<br \/>\n      <span class=\"token key atrule\">apt<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token key atrule\">name<\/span><span class=\"token punctuation\">:<\/span> chrony<br \/>\n        <span class=\"token key atrule\">state<\/span><span class=\"token punctuation\">:<\/span> present<\/p>\n<p>    <span class=\"token punctuation\">&#8211;<\/span> <span class=\"token key atrule\">name<\/span><span class=\"token punctuation\">:<\/span> \u914d\u7f6eChrony\u914d\u7f6e\u6587\u4ef6\u5185\u5bb9<br \/>\n      <span class=\"token key atrule\">template<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token key atrule\">src<\/span><span class=\"token punctuation\">:<\/span> chrony.conf.j2<br \/>\n        <span class=\"token key atrule\">dest<\/span><span class=\"token punctuation\">:<\/span> \/etc\/chrony.conf<br \/>\n        <span class=\"token key atrule\">mode<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token string\">&#039;0644&#039;<\/span><\/p>\n<p>    <span class=\"token punctuation\">&#8211;<\/span> <span class=\"token key atrule\">name<\/span><span class=\"token punctuation\">:<\/span> \u542f\u52a8chrony\u670d\u52a1\u5e76\u914d\u7f6e\u5f00\u673a\u542f\u52a8<br \/>\n      <span class=\"token key atrule\">systemd<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token key atrule\">name<\/span><span class=\"token punctuation\">:<\/span> chronyd<br \/>\n        <span class=\"token key atrule\">state<\/span><span class=\"token punctuation\">:<\/span> started<br \/>\n        <span class=\"token key atrule\">enabled<\/span><span class=\"token punctuation\">:<\/span> yes<\/p>\n<p>    <span class=\"token punctuation\">&#8211;<\/span> <span class=\"token key atrule\">name<\/span><span class=\"token punctuation\">:<\/span> \u9a8c\u8bc1Chrony\u662f\u5426\u540c\u6b65\u6210\u529f<br \/>\n      <span class=\"token key atrule\">command<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token key atrule\">cmd<\/span><span class=\"token punctuation\">:<\/span> chronyc tracking<br \/>\n      <span class=\"token key atrule\">register<\/span><span class=\"token punctuation\">:<\/span> chrony_tracking<br \/>\n      <span class=\"token key atrule\">changed_when<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token boolean important\">false<\/span><\/p>\n<p>    <span class=\"token punctuation\">&#8211;<\/span> <span class=\"token key atrule\">name<\/span><span class=\"token punctuation\">:<\/span> \u6253\u5370\u65f6\u95f4\u540c\u6b65\u7ed3\u679c<br \/>\n      <span class=\"token key atrule\">ansible.builtin.debug<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token key atrule\">msg<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token string\">&#034;{{ chrony_tracking.stdout }}&#034;<\/span><\/p>\n<p>chrony.conf.j2\u6587\u4ef6\u8be6\u89e3:<\/p>\n<p>chrony.conf.j2\u662f\u4e00\u4e2aJinja2\u6a21\u677f\u6587\u4ef6&#xff0c;\u7528\u4e8e\u5728Playbook\u6267\u884c\u65f6\u52a8\u6001\u751f\u6210 Chrony\u914d\u7f6e\u6587\u4ef6\u3002Jinja2\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u6a21\u677f\u5f15\u64ce&#xff0c;\u5b83\u53ef\u4ee5\u8ba9\u4f60\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u63d2\u5165\u53d8\u91cf\u548c\u6761\u4ef6\u903b\u8f91&#xff0c;\u5728Ansible Playbook\u4e2d\u5e7f\u6cdb\u4f7f\u7528\u3002<\/p>\n<p>\u5728\u8fd9\u4e2a\u6587\u4ef6\u4e2d&#xff0c;\u6211\u4eec\u901a\u5e38\u4f1a\u8bbe\u7f6eChrony\u670d\u52a1\u5668\u7684\u65f6\u95f4\u6e90\u3001\u5141\u8bb8\u7684\u5ba2\u6237\u7aef\u3001\u65e5\u5fd7\u6587\u4ef6\u8def\u5f84\u7b49\u914d\u7f6e\u3002<\/p>\n<p><span class=\"token comment\"># This is a basic Chrony configuration file generated by Ansible.<\/span><br \/>\n<span class=\"token comment\"># Modify it as per your requirements.<\/span><\/p>\n<p><span class=\"token comment\"># Use public NTP servers for time synchronization<\/span><br \/>\nserver <span class=\"token punctuation\">{<\/span><span class=\"token punctuation\">{<\/span> ntp_server1 <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">}<\/span> iburst<br \/>\nserver <span class=\"token punctuation\">{<\/span><span class=\"token punctuation\">{<\/span> ntp_server2 <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">}<\/span> iburst<br \/>\nserver <span class=\"token punctuation\">{<\/span><span class=\"token punctuation\">{<\/span> ntp_server3 <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">}<\/span> iburst<br \/>\nserver <span class=\"token punctuation\">{<\/span><span class=\"token punctuation\">{<\/span> ntp_server4 <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">}<\/span> iburst<\/p>\n<p><span class=\"token comment\"># Allow clients from the local network to sync with this server<\/span><br \/>\nallow <span class=\"token punctuation\">{<\/span><span class=\"token punctuation\">{<\/span> network_range <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token comment\"># Set the driftfile location to record the offset in time<\/span><br \/>\ndriftfile \/var\/lib\/chrony\/drift<\/p>\n<p><span class=\"token comment\"># Log synchronization details and statistics<\/span><br \/>\nlog tracking measurements statistics<\/p>\n<p><span class=\"token comment\"># Allow clients to query for the server&#039;s time<\/span><br \/>\nlocal stratum 10<\/p>\n<p><span class=\"token comment\"># Make sure that time is synchronized at boot<\/span><br \/>\ninitstepslew 5 <span class=\"token punctuation\">{<\/span><span class=\"token punctuation\">{<\/span> ntp_server1 <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">}<\/span> <span class=\"token punctuation\">{<\/span><span class=\"token punctuation\">{<\/span> ntp_server2 <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token comment\"># Use an external time source (if applicable)<\/span><br \/>\n<span class=\"token comment\"># server ntp.example.com iburst<\/span><\/p>\n<p>\u5173\u952e\u5b57\u6bb5\u8be6\u89e3&#xff1a;<\/p>\n<ul>\n<li>{{ network_range }}&#xff1a;\u6307\u5b9a\u5141\u8bb8\u8fde\u63a5\u5230Chrony\u670d\u52a1\u5668\u8fdb\u884c\u65f6\u95f4\u540c\u6b65\u7684IP\u5730\u5740\u8303\u56f4\u3002<\/li>\n<li>driftfile \/var\/lib\/chrony\/drift&#xff1a;Chrony\u4f1a\u5728\u6587\u4ef6\u4e2d\u8bb0\u5f55\u65f6\u95f4\u6f02\u79fb&#xff0c;\u4ee5\u4fbf\u672a\u6765\u540c\u6b65\u3002<\/li>\n<li>log tracking measurements statistics&#xff1a;\u8bb0\u5f55\u8be6\u7ec6\u7684\u540c\u6b65\u4fe1\u606f\u3001\u6d4b\u91cf\u6570\u636e\u548c\u7edf\u8ba1\u4fe1\u606f&#xff0c;\u4ee5\u4fbf\u540e\u7eed\u5ba1\u8ba1\u4e0e\u5206\u6790\u3002<\/li>\n<li>initstepslew 5&#xff1a;\u8fd9\u4e2a\u914d\u7f6e\u80fd\u8ba9Chrony\u542f\u52a8\u65f6\u66f4\u7cbe\u786e\u5730\u540c\u6b65\u65f6\u95f4&#xff0c;\u901a\u8fc7\u53c2\u8003\u524d5\u4e2aNTP\u670d\u52a1\u5668\u6765\u6821\u51c6\u7cfb\u7edf\u65f6\u95f4\u3002<\/li>\n<li>local stratum 10&#xff1a;\u8bbe\u7f6e\u672c\u5730Chrony\u670d\u52a1\u5668\u7684\u5c42\u7ea7&#xff0c;\u4f7f\u5176\u5728\u6ca1\u6709\u66f4\u9ad8\u4f18\u5148\u7ea7\u65f6\u95f4\u6e90\u65f6\u4f5c\u4e3a\u672c\u5730\u65f6\u95f4\u6e90\u3002<\/li>\n<\/ul>\n<h3>\u6267\u884cPlaybook<\/h3>\n<p>\u53ea\u9700\u8981\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4&#xff0c;Playbook\u4f1a\u81ea\u52a8\u5b8c\u6210\u6240\u6709\u64cd\u4f5c&#xff1a;<\/p>\n<p>ansible-playbook  chrony_playbook.yml<\/p>\n<p>\u6210\u529f\u6267\u884c\u4e0a\u8ff0\u547d\u4ee4\u540e&#xff0c;\u5982\u4e0b\u56fe\u8f93\u51fa\u7ed3\u679c&#xff1a;<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418154221-680272ddc8319.png\" alt=\"\" \/><\/p>\n<h3>\u5feb\u901f\u9a8c\u8bc1<\/h3>\n<p>Playbook\u6267\u884c\u5b8c\u6210&#xff0c;\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5feb\u901f\u9a8c\u8bc1Chrony\u670d\u52a1\u662f\u5426\u6b63\u5e38\u8fd0\u884c\u5e76\u540c\u6b65\u65f6\u95f4&#xff1a;<\/p>\n<p>chronyc tracking<\/p>\n<p>\u5982\u679c\u914d\u7f6e\u6b63\u786e&#xff0c;\u5e94\u8be5\u770b\u5230\u7c7b\u4f3c\u4ee5\u4e0b\u7684\u8f93\u51fa&#xff0c;\u8868\u793a Chrony \u6b63\u5728\u540c\u6b65\u65f6\u95f4&#xff1a;<\/p>\n<p>root&#064;node1:~# chronyc tracking<br \/>\nReference ID    : 74CB974A (a.chl.la)<br \/>\nStratum         : 3<br \/>\nRef time (UTC)  : Wed Feb 19 14:52:49 2025<br \/>\nSystem time     : 0.001176818 seconds fast of NTP time<br \/>\nLast offset     : -0.000331252 seconds<br \/>\nRMS offset      : 0.007539239 seconds<br \/>\nFrequency       : 1.403 ppm fast<br \/>\nResidual freq   : &#043;0.184 ppm<br \/>\nSkew            : 8.313 ppm<br \/>\nRoot delay      : 0.173159912 seconds<br \/>\nRoot dispersion : 0.004186447 seconds<br \/>\nUpdate interval : 65.3 seconds<br \/>\nLeap status     : Normal<\/p>\n<h3>\u603b\u7ed3<\/h3>\n<p>\u901a\u8fc7\u8fd9\u4efdAnsible Playbook&#xff0c;\u4f60\u53ef\u4ee5\u8f7b\u677e\u5730\u5728\u516c\u53f8\u7684\u6240\u6709\u751f\u4ea7\u670d\u52a1\u5668\u4e0a\u90e8\u7f72\u548c\u914d\u7f6eChrony\u65f6\u95f4\u540c\u6b65\u670d\u52a1&#xff0c;\u5b9e\u73b0\u8de8\u670d\u52a1\u5668\u7684\u51c6\u786e\u65f6\u95f4\u540c\u6b65&#xff0c;\u65e0\u9700\u624b\u52a8\u914d\u7f6e\u6bcf\u53f0\u670d\u52a1\u5668\u3002<\/p>\n<h3>\u63a8\u8350\u9605\u8bfb<\/h3>\n<hr \/>\n<ul>\n<li>\u5982\u4f55\u7528Ansible\u81ea\u52a8\u5316\u6536\u96c6\u548c\u7ba1\u7406\u670d\u52a1\u5668\u65e5\u5fd7&#xff1f;\u4f60\u9700\u8981\u8fd9\u4efdPlaybook&#xff01;<\/li>\n<li>\u8ba9\u7f51\u7edc\u7ba1\u7406\u66f4\u9ad8\u6548&#xff01;\u5feb\u901f\u626b\u63cf\u5c40\u57df\u7f51&#xff0c;\u5b9e\u65f6\u83b7\u53d6IP\u4e0eMAC\u5730\u5740<\/li>\n<li>\u670d\u52a1\u5668\u5361\u987f&#xff1f;\u8fd9\u5f20Linux\u6027\u80fd\u8c03\u4f18\u5168\u666f\u56fe\u5e2e\u4f60\u627e\u51fa\u771f\u51f6<\/li>\n<li>90%\u7684\u4eba\u90fd\u4e0d\u4f1a\u7528DeepSeek&#xff1f;\u65b0\u624b\u5fc5\u770b\u7684\u6b63\u786e\u59ff\u52bf&#xff01;<\/li>\n<li>Linux\u7ec8\u7aef\u795e\u5668 Screen&#xff0c;\u8ba9\u4f60\u7684\u4f1a\u8bdd\u6c38\u4e0d\u6389\u7ebf<\/li>\n<li>\u544a\u522b\u624b\u52a8\u64cd\u4f5c&#xff01;\u7528Ansible user\u6a21\u5757\u9ad8\u6548\u7ba1\u7406 Linux\u8d26\u6237<\/li>\n<\/ul>\n<hr \/>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb872\u6b21\uff0c\u70b9\u8d5e26\u6b21\uff0c\u6536\u85cf25\u6b21\u3002\u901a\u8fc7\u8fd9\u4efd\uff0c\u4f60\u53ef\u4ee5\u8f7b\u677e\u5730\u5728\u516c\u53f8\u7684\u6240\u6709\u751f\u4ea7\u670d\u52a1\u5668\u4e0a\u90e8\u7f72\u548c\u914d\u7f6eChrony\u65f6\u95f4\u540c\u6b65\u670d\u52a1\uff0c\u5b9e\u73b0\u8de8\u670d\u52a1\u5668\u7684\u51c6\u786e\u65f6\u95f4\u540c\u6b65\uff0c\u65e0\u9700\u624b\u52a8\u914d\u7f6e\u6bcf\u53f0\u670d\u52a1\u5668\u3002_ansible-playbook \u65f6\u949f\u540c\u6b65<\/p>\n","protected":false},"author":2,"featured_media":17258,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[1064,58,1263,43,118],"topic":[],"class_list":["post-17260","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-ansible","tag-linux","tag-playbook","tag-43","tag-118"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5982\u4f55\u5728\u6210\u767e\u4e0a\u5343\u53f0\u670d\u52a1\u5668\u4e0a\u8f7b\u677e\u90e8\u7f72\u65f6\u95f4\u540c\u6b65\u670d\u52a1\uff1f\u53ea\u9700\u8fd9\u4efdAnsible Playbook\uff01 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/17260.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5982\u4f55\u5728\u6210\u767e\u4e0a\u5343\u53f0\u670d\u52a1\u5668\u4e0a\u8f7b\u677e\u90e8\u7f72\u65f6\u95f4\u540c\u6b65\u670d\u52a1\uff1f\u53ea\u9700\u8fd9\u4efdAnsible Playbook\uff01 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb872\u6b21\uff0c\u70b9\u8d5e26\u6b21\uff0c\u6536\u85cf25\u6b21\u3002\u901a\u8fc7\u8fd9\u4efd\uff0c\u4f60\u53ef\u4ee5\u8f7b\u677e\u5730\u5728\u516c\u53f8\u7684\u6240\u6709\u751f\u4ea7\u670d\u52a1\u5668\u4e0a\u90e8\u7f72\u548c\u914d\u7f6eChrony\u65f6\u95f4\u540c\u6b65\u670d\u52a1\uff0c\u5b9e\u73b0\u8de8\u670d\u52a1\u5668\u7684\u51c6\u786e\u65f6\u95f4\u540c\u6b65\uff0c\u65e0\u9700\u624b\u52a8\u914d\u7f6e\u6bcf\u53f0\u670d\u52a1\u5668\u3002_ansible-playbook \u65f6\u949f\u540c\u6b65\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/17260.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-18T15:42:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418154217-680272d95ac4d.jpg\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/17260.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/17260.html\",\"name\":\"\u5982\u4f55\u5728\u6210\u767e\u4e0a\u5343\u53f0\u670d\u52a1\u5668\u4e0a\u8f7b\u677e\u90e8\u7f72\u65f6\u95f4\u540c\u6b65\u670d\u52a1\uff1f\u53ea\u9700\u8fd9\u4efdAnsible Playbook\uff01 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-18T15:42:23+00:00\",\"dateModified\":\"2025-04-18T15:42:23+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/17260.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/17260.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/17260.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5982\u4f55\u5728\u6210\u767e\u4e0a\u5343\u53f0\u670d\u52a1\u5668\u4e0a\u8f7b\u677e\u90e8\u7f72\u65f6\u95f4\u540c\u6b65\u670d\u52a1\uff1f\u53ea\u9700\u8fd9\u4efdAnsible Playbook\uff01\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u5982\u4f55\u5728\u6210\u767e\u4e0a\u5343\u53f0\u670d\u52a1\u5668\u4e0a\u8f7b\u677e\u90e8\u7f72\u65f6\u95f4\u540c\u6b65\u670d\u52a1\uff1f\u53ea\u9700\u8fd9\u4efdAnsible Playbook\uff01 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/17260.html","og_locale":"zh_CN","og_type":"article","og_title":"\u5982\u4f55\u5728\u6210\u767e\u4e0a\u5343\u53f0\u670d\u52a1\u5668\u4e0a\u8f7b\u677e\u90e8\u7f72\u65f6\u95f4\u540c\u6b65\u670d\u52a1\uff1f\u53ea\u9700\u8fd9\u4efdAnsible Playbook\uff01 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb872\u6b21\uff0c\u70b9\u8d5e26\u6b21\uff0c\u6536\u85cf25\u6b21\u3002\u901a\u8fc7\u8fd9\u4efd\uff0c\u4f60\u53ef\u4ee5\u8f7b\u677e\u5730\u5728\u516c\u53f8\u7684\u6240\u6709\u751f\u4ea7\u670d\u52a1\u5668\u4e0a\u90e8\u7f72\u548c\u914d\u7f6eChrony\u65f6\u95f4\u540c\u6b65\u670d\u52a1\uff0c\u5b9e\u73b0\u8de8\u670d\u52a1\u5668\u7684\u51c6\u786e\u65f6\u95f4\u540c\u6b65\uff0c\u65e0\u9700\u624b\u52a8\u914d\u7f6e\u6bcf\u53f0\u670d\u52a1\u5668\u3002_ansible-playbook \u65f6\u949f\u540c\u6b65","og_url":"https:\/\/www.wsisp.com\/helps\/17260.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-18T15:42:23+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418154217-680272d95ac4d.jpg"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/17260.html","url":"https:\/\/www.wsisp.com\/helps\/17260.html","name":"\u5982\u4f55\u5728\u6210\u767e\u4e0a\u5343\u53f0\u670d\u52a1\u5668\u4e0a\u8f7b\u677e\u90e8\u7f72\u65f6\u95f4\u540c\u6b65\u670d\u52a1\uff1f\u53ea\u9700\u8fd9\u4efdAnsible Playbook\uff01 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-18T15:42:23+00:00","dateModified":"2025-04-18T15:42:23+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/17260.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/17260.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/17260.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u5982\u4f55\u5728\u6210\u767e\u4e0a\u5343\u53f0\u670d\u52a1\u5668\u4e0a\u8f7b\u677e\u90e8\u7f72\u65f6\u95f4\u540c\u6b65\u670d\u52a1\uff1f\u53ea\u9700\u8fd9\u4efdAnsible Playbook\uff01"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/17260","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=17260"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/17260\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/17258"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=17260"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=17260"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=17260"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=17260"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}