Skip to content

update support for Ubuntu 24.04 #726

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions data/Debian-12.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
ntp::package_name:
- ntpsec
ntp::config: '/etc/ntpsec/ntp.conf'
4 changes: 4 additions & 0 deletions data/Ubuntu-24.04.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
ntp::package_name:
- ntpsec
ntp::config: '/etc/ntpsec/ntp.conf'
26 changes: 16 additions & 10 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,22 @@
}
}
'Debian': {
if $facts['os']['release']['major'] == '12' {
$daemon_config = '/etc/ntpsec/ntp.conf'
if $facts['os']['name'] == 'Ubuntu' {
# This ugly indentation is forced upon me by puppet-lint. I disclaim
# any responsibility for damage to your eyes.
if (versioncmp($facts['os']['release']['major'], '18.04') >= 0 and
versioncmp($facts['os']['release']['major'], '24.04') < 0 and
$ntp::user) {
file_line { 'Set NTPD daemon user':
ensure => present,
path => '/usr/lib/ntp/ntp-systemd-wrapper',
line => "RUNASUSER=${ntp::user}",
match => '^RUNASUSER\=',
}
}
}
if 'ntpsec' in $ntp::package_name {
$daemon_config = '/etc/default/ntpsec'
} else {
$daemon_config = '/etc/default/ntp'
}
Expand All @@ -46,14 +60,6 @@
match => '^NTPD_OPTS\=',
}
}
if $ntp::user and $facts['os']['release']['major'] == '18.04' {
file_line { 'Set NTPD daemon user':
ensure => present,
path => '/usr/lib/ntp/ntp-systemd-wrapper',
line => "RUNASUSER=${ntp::user}",
match => '^RUNASUSER\=',
}
}
}
'Suse': {
$daemon_config = '/etc/sysconfig/ntp'
Expand Down
3 changes: 2 additions & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
"operatingsystemrelease": [
"18.04",
"20.04",
"22.04"
"22.04",
"24.04"
]
},
{
Expand Down
14 changes: 9 additions & 5 deletions spec/classes/ntp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
let(:conf_path) do
if os.include?('solaris')
'/etc/inet/ntp.conf'
elsif f[:os]['name'] == 'Debian' && f[:os]['release']['major'].to_f >= 12
'/etc/ntpsec/ntp.conf'
elsif f[:os]['name'] == 'Ubuntu' && f[:os]['release']['major'].to_f >= 24.04
'/etc/ntpsec/ntp.conf'
else
'/etc/ntp.conf'
end
Expand Down Expand Up @@ -132,31 +136,31 @@
case f[:os]['family']
when 'RedHat'
it 'uses the centos ntp servers' do
expect(subject).to contain_file('/etc/ntp.conf').with('content' => %r{server \d.centos.pool.ntp.org})
expect(subject).to contain_file(conf_path).with('content' => %r{server \d.centos.pool.ntp.org})
end

it do
expect(subject).to contain_file('/etc/ntp/step-tickers').with('content' => %r{\d.centos.pool.ntp.org})
end
when 'Debian'
it 'uses the debian ntp servers' do
expect(subject).to contain_file('/etc/ntp.conf').with('content' => %r{server \d.debian.pool.ntp.org iburst\n})
expect(subject).to contain_file(conf_path).with('content' => %r{server \d.debian.pool.ntp.org iburst\n})
end
when 'Suse'
it 'uses the opensuse ntp servers' do
expect(subject).to contain_file('/etc/ntp.conf').with('content' => %r{server \d.opensuse.pool.ntp.org})
expect(subject).to contain_file(conf_path).with('content' => %r{server \d.opensuse.pool.ntp.org})
end
when 'FreeBSD'
it 'uses the freebsd ntp servers' do
expect(subject).to contain_file('/etc/ntp.conf').with('content' => %r{server \d.freebsd.pool.ntp.org iburst maxpoll 9})
expect(subject).to contain_file(conf_path).with('content' => %r{server \d.freebsd.pool.ntp.org iburst maxpoll 9})
end
when 'Solaris'
it 'uses the generic NTP pool servers' do
expect(subject).to contain_file('/etc/inet/ntp.conf').with('content' => %r{server \d.pool.ntp.org})
end
when 'AIX'
it 'uses the generic NTP pool servers on AIX' do
expect(subject).to contain_file('/etc/ntp.conf').with('content' => %r{server \d.pool.ntp.org})
expect(subject).to contain_file(conf_path).with('content' => %r{server \d.pool.ntp.org})
end
else
it {
Expand Down
Loading