-
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
122 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
class chrony::config ( | ||
$config = $chrony::config, | ||
$config_template = $chrony::config_template, | ||
$config_keys = $chrony::config_keys, | ||
$config_keys_template = $chrony::config_keys_template, | ||
$chrony_password = $chrony::chrony_password, | ||
$servers = $chrony::servers,) inherits chrony { | ||
file { $config: | ||
ensure => file, | ||
owner => 0, | ||
group => 0, | ||
mode => '0644', | ||
content => template($config_template), | ||
} | ||
|
||
file { $config_keys: | ||
ensure => file, | ||
owner => 0, | ||
group => 0, | ||
mode => '0644', | ||
content => template($config_keys_template), | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,33 @@ | ||
class chrony ( | ||
$ntpservers = [ | ||
'0.nl.pool.ntp.org', | ||
'1.nl.pool.ntp.org', | ||
'2.nl.pool.ntp.org', | ||
'3.nl.pool.ntp.org', ] | ||
){ | ||
package { 'chrony': | ||
ensure => present, | ||
} | ||
$autoupdate = $chrony::params::autoupdate, | ||
$config = $chrony::params::config, | ||
$config_template = $chrony::params::config_template, | ||
$config_keys = $chrony::params::config_keys, | ||
$config_keys_template = $chrony::params::config_keys_template, | ||
$chrony_password = $chrony::params::chrony_password, | ||
$package_ensure = $chrony::params::package_ensure, | ||
$package_name = $chrony::params::package_name, | ||
$servers = $chrony::params::servers, | ||
$service_enable = $chrony::params::service_enable, | ||
$service_ensure = $chrony::params::service_ensure, | ||
$service_manage = $chrony::params::service_manage, | ||
$service_name = $chrony::params::service_name,) inherits chrony::params { | ||
if $autoupdate { | ||
notice('autoupdate parameter has been deprecated and replaced with package_ensure. Set this to latest for the same behavior as autoupdate => true.' | ||
) | ||
} | ||
|
||
file { '/etc/chrony.conf': | ||
ensure => present, | ||
owner => root, | ||
group => root, | ||
mode => '0644', | ||
content => template('chrony/chrony.conf.erb'), | ||
require => Package['chrony'], | ||
notify => Service['chrony.service'], | ||
} | ||
include '::chrony::install' | ||
include '::chrony::config' | ||
include '::chrony::service' | ||
|
||
# Anchor this as per #8140 - this ensures that classes won't float off and | ||
# mess everything up. You can read about this at: | ||
# http://docs.puppetlabs.com/puppet/2.7/reference/lang_containment.html#known-issues | ||
anchor { 'chrony::begin': } | ||
anchor { 'chrony::end': } | ||
|
||
Anchor['chrony::begin'] -> Class['::chrony::install'] -> Class['::chrony::config'] | ||
~> Class['::chrony::service'] -> Anchor['chrony::end'] | ||
|
||
service { 'chrony.service': | ||
ensure => running, | ||
provider => systemd, | ||
hasstatus => true, | ||
hasrestart => true, | ||
enable => true, | ||
require => Package['chrony'], | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class chrony::install ( | ||
$package_ensure = $chrony::package_ensure, | ||
$package_name = $chrony::package_name, | ||
) inherits chrony { | ||
|
||
package { 'chrony': | ||
ensure => $package_ensure, | ||
name => $package_name, | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
class chrony::params { | ||
$autoupdate = false | ||
$package_ensure = 'present' | ||
$service_enable = true | ||
$service_ensure = 'running' | ||
$service_manage = true | ||
$chrony_password = 'xyzzy' | ||
|
||
case $::osfamily { | ||
'Archlinux' : { | ||
$config = '/etc/chrony.conf' | ||
$config_template = 'chrony/chrony.conf.archlinux.erb' | ||
$config_keys = 'etc/chrony.keys' | ||
$config_keys_template = 'chrony/chrony.keys.archlinux.erb' | ||
$package_name = ['chrony'] | ||
$service_name = 'chrony' | ||
$servers = ['0.pool.ntp.org', '1.pool.ntp.org', '2.pool.ntp.org',] | ||
} | ||
|
||
default : { | ||
fail("The ${module_name} module is not supported on an ${::osfamily} based system.") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
class chrony::service ( | ||
$service_enable = $chrony::service_enable, | ||
$service_ensure = $chrony::service_ensure, | ||
$service_manage = $chrony::service_manage, | ||
$service_name = $chrony::service_name, | ||
) inherits chrony { | ||
|
||
if ! ($service_ensure in [ 'running', 'stopped' ]) { | ||
fail('service_ensure parameter must be running or stopped') | ||
} | ||
|
||
if $service_manage == true { | ||
service { 'chrony': | ||
ensure => $service_ensure, | ||
enable => $service_enable, | ||
name => $service_name, | ||
hasstatus => true, | ||
hasrestart => true, | ||
} | ||
} | ||
|
||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1 <%= chrony_password %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
node default { | ||
|
||
notify { 'enduser-before': } | ||
notify { 'enduser-after': } | ||
|
||
class { 'chrony': | ||
require => Notify['enduser-before'], | ||
before => Notify['enduser-after'], | ||
} | ||
|
||
} |