Переглянути джерело

feat(ntp): Add ntp service and timezone

Signed-off-by: Jeremy MAURO <jeremy.mauro@gmail.com>
Jeremy MAURO 2 роки тому
батько
коміт
231cb5dcdc

+ 15 - 0
cookbooks/gateway/recipes/_ntp.rb

@@ -0,0 +1,15 @@
+#
+# Cookbook:: gateway
+# Recipe:: _ntp
+#
+# Copyright:: 2022, The Authors, All Rights Reserved.
+
+package 'systemd-timesyncd'
+
+execute 'timedatectl set-ntp true' do
+  only_if '[ "$(timedatectl show --value --property=NTP)" == "no" ]'
+end
+
+execute 'timedatectl set-timezone Europe/Paris' do
+  not_if '[ "$(readlink -f /etc/localtime)" == "/usr/share/zoneinfo/Europe/Paris" ]'
+end

+ 3 - 0
cookbooks/gateway/recipes/default.rb

@@ -29,3 +29,6 @@ include_recipe 'etckeeper::commit'
 
 # Patching /etc
 include_recipe 'gateway::_system_patch'
+
+# Setting up Time zone && NTP
+include_recipe 'gateway::_ntp'