diff --git a/CHANGELOG.md b/CHANGELOG.md index 4591f22..7431e5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,2 +1,5 @@ # CHANGELOG +## 0.1.3 + +* timedatectl support (CentOS 7) diff --git a/manifests/config.pp b/manifests/config.pp index f0e9346..5157673 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -1,10 +1,20 @@ class timezone::config inherits timezone { - file { '/etc/localtime': - source => "file:///usr/share/zoneinfo/${timezone::region}/${timezone::locality}", - links => 'follow', - replace => true, - mode => '0644', + if($timezone::params::timedatectl) + { + exec { 'set timezone': + command => "timedatectl set-timezone ${timezone::region}/${timezone::locality}", + unless => "timedatectl status | grep \"Time zone: ${timezone::region}/${timezone::locality}\"", + path => '/usr/sbin:/usr/bin:/sbin:/bin', + } + } + else + { + file { '/etc/localtime': + source => "file:///usr/share/zoneinfo/${timezone::region}/${timezone::locality}", + links => 'follow', + replace => true, + mode => '0644', + } } - } diff --git a/manifests/params.pp b/manifests/params.pp index 232d545..05c2b46 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -8,8 +8,13 @@ { case $::operatingsystemrelease { - /^[5-7].*$/: + /^[5-6].*$/: { + $timezonectl=false + } + /^7.*$/: + { + $timezonectl=true } default: { fail("Unsupported RHEL/CentOS version! - ${::operatingsystemrelease}") } } @@ -24,6 +29,7 @@ { /^1[46].*$/: { + $timezonectl=false } default: { fail("Unsupported Ubuntu version! - ${::operatingsystemrelease}") } } diff --git a/metadata.json b/metadata.json index 02297a6..0b893b9 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "eyp-timezone", - "version": "0.1.2", + "version": "0.1.3", "author": "eyp", "summary": "sets timezone", "license": "Apache-2.0",