Skip to content

Commit

Permalink
Allow configuring bindcmdaddress
Browse files Browse the repository at this point in the history
  • Loading branch information
nbarrientos committed Aug 2, 2019
1 parent 3ef4863 commit 1ef8aa8
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 6 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ class { '::chrony':

The following parameters are available in the chrony module

#### `bindcmdaddress`

Array of addresses of interfaces on which chronyd will listen for monitoring
command packets (defaults to localhost).

#### `chrony_password`

This sets the chrony password to be used in the key file.
Expand Down
1 change: 1 addition & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class chrony::config (
$bindcmdaddress = $chrony::bindcmdaddress,
$commandkey = $chrony::commandkey,
$config = $chrony::config,
$config_template = $chrony::config_template,
Expand Down
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class chrony (
Array[String] $bindcmdaddress = $chrony::params::bindcmdaddress,
$commandkey = $chrony::params::commandkey,
$config = $chrony::params::config,
$config_template = $chrony::params::config_template,
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,6 @@
$pools = {}
$makestep_seconds = 10
$makestep_updates = 3
$bindcmdaddress = ['127.0.0.1', '::1']

}
4 changes: 4 additions & 0 deletions spec/classes/chrony_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
when 'RedHat'
context 'using defaults' do
it { is_expected.to contain_file('/etc/chrony.conf').with_content(%r{^\s*port 0$}) }
it { is_expected.to contain_file('/etc/chrony.conf').with_content(%r{^\s*bindcmdaddress ::1$}) }
it { is_expected.to contain_file('/etc/chrony.conf').with_content(%r{^\s*bindcmdaddress 127.0.0.1$}) }
['0.pool.ntp.org', '1.pool.ntp.org', '2.pool.ntp.org', '3.pool.ntp.org'].each do |s|
it { is_expected.to contain_file('/etc/chrony.conf').with_content(%r{^\s*server #{s} iburst$}) }
end
Expand All @@ -51,6 +53,8 @@
when 'Debian'
context 'using defaults' do
it { is_expected.to contain_file('/etc/chrony/chrony.conf').with_content(%r{^\s*port 0$}) }
it { is_expected.to contain_file('/etc/chrony/chrony.conf').with_content(%r{^\s*bindcmdaddress ::1$}) }
it { is_expected.to contain_file('/etc/chrony/chrony.conf').with_content(%r{^\s*bindcmdaddress 127.0.0.1$}) }
['0.pool.ntp.org', '1.pool.ntp.org', '2.pool.ntp.org', '3.pool.ntp.org'].each do |s|
it { is_expected.to contain_file('/etc/chrony/chrony.conf').with_content(%r{^\s*server #{s} iburst$}) }
end
Expand Down
6 changes: 3 additions & 3 deletions templates/chrony.conf.debian.erb
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ makestep <%= @makestep_seconds %> <%= @makestep_updates %>
allow <%= allowed %>
<% end -%>

# Listen for commands only on localhost.
bindcmdaddress 127.0.0.1
bindcmdaddress ::1
<% Array(@bindcmdaddress).each do |addr| -%>
bindcmdaddress <%= addr %>
<% end -%>

# http://chrony.tuxfamily.org/manual.html#port-directive
port <%= @port %>
Expand Down
6 changes: 3 additions & 3 deletions templates/chrony.conf.redhat.erb
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ makestep <%= @makestep_seconds %> <%= @makestep_updates %>
allow <%= allowed %>
<% end -%>

# Listen for commands only on localhost.
bindcmdaddress 127.0.0.1
bindcmdaddress ::1
<% Array(@bindcmdaddress).each do |addr| -%>
bindcmdaddress <%= addr %>
<% end -%>

# http://chrony.tuxfamily.org/manual.html#port-directive
port <%= @port %>
Expand Down

0 comments on commit 1ef8aa8

Please sign in to comment.