Muehlenhoff has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/322279 )

Change subject: Make systemd-timesyncd available as an alternative time 
synchronisation provider
......................................................................


Make systemd-timesyncd available as an alternative time synchronisation provider

We don't need any of ntp's advanced features on the clients and we've
run into a fair share of runtime bugs (like failing to restart properly
or various cases where ntp failed to start after a reboot (it gets
stuck in interface activation/XFAC).

This patch adds a Hiera-configurable class to use systemd-timesyncd
instead. systemd-timesyncd is shipped as part the standard systemd
package. It is configured via the timedatectl tool.

We can then enable this for a subset of jessie servers and if it proves to
be more reliable than ntpd in practice, move all jessie systems to it.

Bug: T150257
Change-Id: Ie4c9ab7f82f590817f2b92d19f09cbbdda25fb95
---
A modules/base/templates/timesyncd.conf.erb
M modules/standard/manifests/init.pp
A modules/standard/manifests/ntp/timesyncd.pp
3 files changed, 59 insertions(+), 2 deletions(-)

Approvals:
  Muehlenhoff: Looks good to me, approved
  Alexandros Kosiaris: Looks good to me, but someone else must approve
  jenkins-bot: Verified
  Filippo Giunchedi: Looks good to me, but someone else must approve



diff --git a/modules/base/templates/timesyncd.conf.erb 
b/modules/base/templates/timesyncd.conf.erb
new file mode 100644
index 0000000..2cd2fab
--- /dev/null
+++ b/modules/base/templates/timesyncd.conf.erb
@@ -0,0 +1,7 @@
+## THIS FILE IS MANAGED BY PUPPET
+#
+# See timesyncd.conf(5) for details.
+
+[Time]
+NTP=<%@ntp_servers[@site].sort.each do |ntpserver| -%> <%= ntpserver -%>
+<% end %>
diff --git a/modules/standard/manifests/init.pp 
b/modules/standard/manifests/init.pp
index c03d90e..98ec8ff 100644
--- a/modules/standard/manifests/init.pp
+++ b/modules/standard/manifests/init.pp
@@ -9,8 +9,14 @@
     include ::base
     include ::standard::ntp
 
-    unless $::fqdn in $::standard::ntp::wmf_peers[$::site] {
-        include standard::ntp::client
+    if hiera('use_timesyncd', false) {
+        include standard::ntp::timesyncd
+    }
+    else
+    {
+        unless $::fqdn in $::standard::ntp::wmf_peers[$::site] {
+            include standard::ntp::client
+        }
     }
 
     include ::standard::diamond
diff --git a/modules/standard/manifests/ntp/timesyncd.pp 
b/modules/standard/manifests/ntp/timesyncd.pp
new file mode 100644
index 0000000..9d20ff1
--- /dev/null
+++ b/modules/standard/manifests/ntp/timesyncd.pp
@@ -0,0 +1,44 @@
+# == Class standard::ntp::timesyncd
+#
+# Setup clock synchronisation using systemd-timesyncd
+class standard::ntp::timesyncd () {
+    requires_os('debian >= jessie')
+    require standard::ntp
+
+    package { 'ntp':
+        ensure => absent,
+    }
+
+    $wmf_peers = $::standard::ntp::wmf_peers
+    # This maps the servers that regular clients use
+    $ntp_servers = {
+        eqiad => concat($wmf_peers['eqiad'], $wmf_peers['codfw']),
+        codfw => concat($wmf_peers['eqiad'], $wmf_peers['codfw']),
+        esams => concat($wmf_peers['esams'], $wmf_peers['eqiad']),
+        ulsfo => concat($wmf_peers['eqiad'], $wmf_peers['codfw']),
+    }
+
+    file { '/etc/systemd/timesyncd.conf':
+        ensure  => present,
+        mode    => '0444',
+        owner   => 'root',
+        group   => 'root',
+        content => template('base/timesyncd.conf.erb'),
+        notify  => Service['systemd-timesyncd'],
+    }
+
+    service { 'systemd-timesyncd':
+        ensure   => running,
+        provider => systemd,
+        enable   => true,
+    }
+
+    monitoring::service { 'ntp':
+        description    => 'NTP',
+        check_command  => 'check_ntp_time!0.5!1',
+        check_interval => 30,
+        retry_interval => 15,
+    }
+
+}
+

-- 
To view, visit https://gerrit.wikimedia.org/r/322279
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie4c9ab7f82f590817f2b92d19f09cbbdda25fb95
Gerrit-PatchSet: 7
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Muehlenhoff <mmuhlenh...@wikimedia.org>
Gerrit-Reviewer: Alexandros Kosiaris <akosia...@wikimedia.org>
Gerrit-Reviewer: BBlack <bbl...@wikimedia.org>
Gerrit-Reviewer: Ema <e...@wikimedia.org>
Gerrit-Reviewer: Faidon Liambotis <fai...@wikimedia.org>
Gerrit-Reviewer: Filippo Giunchedi <fgiunch...@wikimedia.org>
Gerrit-Reviewer: Gehel <gleder...@wikimedia.org>
Gerrit-Reviewer: Muehlenhoff <mmuhlenh...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to