summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff McCune <jeff@puppetlabs.com>2013-02-25 15:28:06 -0800
committerJeff McCune <jeff@puppetlabs.com>2013-02-25 15:28:06 -0800
commitfd064cbdf39bf12794e4c6733b188a077a47a214 (patch)
tree4464659fab4d779efb51eba206d20d9ecf47f4c9
parent346d9053ba3e4bcc77de2fad6b6eb9665554741a (diff)
parent7d6776868eb226bd85372cc1d62c3779b673d25c (diff)
Merge branch 'mattr--feature/add-archlinux-support'
* mattr--feature/add-archlinux-support: Add support for Arch Linux closes #40
-rw-r--r--manifests/init.pp22
-rw-r--r--spec/classes/ntp_spec.rb20
-rw-r--r--templates/ntp.conf.archlinux.erb24
3 files changed, 66 insertions, 0 deletions
diff --git a/manifests/init.pp b/manifests/init.pp
index 543db63..9b9c465 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -10,6 +10,7 @@
# - CentOS 5.4
# - Amazon Linux 2011.09
# - FreeBSD 9.0
+# - Archlinux
#
# Parameters:
#
@@ -120,6 +121,27 @@ class ntp($servers='UNSET',
$servers_real = $servers
}
}
+
+ Linux: {
+ if ($::operatingsystem == 'Archlinux') {
+ $supported = true
+ $pkg_name = ['ntp']
+ $svc_name = 'ntpd'
+ $config = '/etc/ntp.conf'
+ $config_tpl = 'ntp.conf.archlinux.erb'
+
+ if ($servers == 'UNSET') {
+ $servers_real = [ '0.pool.ntp.org',
+ '1.pool.ntp.org',
+ '2.pool.ntp.org' ]
+ } else {
+ $servers_real = $servers
+ }
+ } else {
+ fail("The ${module_name} module is not supported on an ${::operatingsystem} system")
+ }
+ }
+
default: {
fail("The ${module_name} module is not supported on ${::osfamily} based systems")
}
diff --git a/spec/classes/ntp_spec.rb b/spec/classes/ntp_spec.rb
index 8f41a22..e74f7c1 100644
--- a/spec/classes/ntp_spec.rb
+++ b/spec/classes/ntp_spec.rb
@@ -88,6 +88,26 @@ describe 'ntp' do
end
+ describe "for operating system Archlinux" do
+
+ let(:params) {{}}
+ let(:facts) { { :operatingsystem => 'Archlinux',
+ :osfamily => 'Linux' } }
+
+ it { should contain_service('ntp').with_name('ntpd') }
+ it { should contain_package('ntp').with_ensure('present') }
+
+ it 'should use the NTP pool servers by default' do
+ content = param_value(subject, 'file', '/etc/ntp.conf', 'content')
+ expected_lines = [
+ "server 0.pool.ntp.org",
+ "server 1.pool.ntp.org",
+ "server 2.pool.ntp.org"]
+ (content.split("\n") & expected_lines).should == expected_lines
+ end
+ end
+
+
['Debian', 'RedHat','SuSE', 'FreeBSD'].each do |osfamily|
describe "for operating system family #{osfamily}" do
diff --git a/templates/ntp.conf.archlinux.erb b/templates/ntp.conf.archlinux.erb
new file mode 100644
index 0000000..78494e1
--- /dev/null
+++ b/templates/ntp.conf.archlinux.erb
@@ -0,0 +1,24 @@
+# With the default settings below, ntpd will only synchronize your clock.
+#
+# For details, see:
+# - the ntp.conf man page
+# - http://support.ntp.org/bin/view/Support/GettingStarted
+# - https://wiki.archlinux.org/index.php/Network_Time_Protocol_daemon
+
+# Associate to public NTP pool servers; see http://www.pool.ntp.org/
+<% [servers_real].flatten.each do |server| -%>
+server <%= server %>
+<% end -%>
+
+<% if @restrict -%>
+# Only allow read-only access from localhost
+restrict default noquery nopeer
+restrict 127.0.0.1
+restrict ::1
+<% end -%>
+
+# Location of drift file
+driftfile /var/lib/ntp/ntp.drift
+
+# NOTE: If you run dhcpcd and have lines like 'restrict' and 'fudge' appearing
+# here, be sure to add '-Y -N' to the dhcpcd_ethX variables in /etc/conf.d/net