時間を固定するためのPuppetモジュールを作成するには? [コピー]

時間を固定するためのPuppetモジュールを作成するには? [コピー]

私はNTPを介して時間を変更できるPuppetモジュールを作成しましたが、これはNTPオフセットの小さいサーバーでのみ機能します。

いくつかの理由で、いくつかのサーバーでは10分以上の時間偏差が発生します。

ntpオフセットが高すぎるときにexec "service ntpd stop; ntpdate ntp3.domain.local; service ntpd start"を実行して時間を強制するPuppetモジュールを作成したいと思います。

Puppetにこのコマンドを実行するようにNTPオフセットが高すぎるかどうかを確認するにはどうすればよいですか?それとも、より良い解決策がありますか?

ベストアンサー1

service ntpd stop; ntpdate ntp3.domain.local; service ntpd start

確かにこの問題に対する誤った解決策です。この-gオプションを使用してくださいntpd

   -g     Normally, ntpd exits with a message to the  system  log  if  the
          offset  exceeds the panic threshold, which is 1000 s by default.
          This option allows the time to  be  set  to  any  value  without
          restriction; however, this can happen only once.  If the thresh‐
          old is exceeded after that, ntpd will exit with a message to the
          system log.  This option can be used with the -q and -x options.

これをiburstslmが提案したオプションと組み合わせます。これは、このオプションがないと、ntpd大きな違いを修正するのに長い時間がかかるからです。通常、時間関連のアプリケーションが混乱しないように、ごくわずかなステップでのみシステム時間を変更しようとしますが、このiburstオプションはそれを変更します。

ntpdPuppetがパニック後に自動的に再起動されることを確認する必要があります。マンページによると、Puppetは一度回復し、その後も死ぬからです。

おすすめ記事