Allow setting of public_addr from ::profile::mon and ::mon

To make public_addr persistent this change writes it into the
[mon.$id] section from the ::mon define.

This change also allows for configuration of public_addr from the
::profile::mon class so that it can be set via hieradata.

Change-Id: I56f969328c68ed83a9b2d54ff4254dbcd6f55de0
This commit is contained in:
Giulio Fidente committed 2016-03-09 08:15:56 +00:00
1 parent 59fc06026d
commit 134e431719
6 files changed
+18 -10

No files matched your search

+6 -2
View File
@@ -143,7 +143,9 @@ test -e \$mon_data/done
}
if $public_addr {
$public_addr_option = "--public_addr ${public_addr}"
ceph_config {
"mon.${id}/public_addr": value => $public_addr;
}
}
Ceph_config<||> ->
@@ -164,7 +166,6 @@ mon_data=\$(ceph-mon ${cluster_option} --id ${id} --show-config-value mon_data)
if [ ! -d \$mon_data ] ; then
mkdir -p \$mon_data
if ceph-mon ${cluster_option} \
${public_addr_option} \
--mkfs \
--id ${id} \
--keyring ${keyring_path} ; then
@@ -220,6 +221,9 @@ test ! -d \$mon_data
",
logoutput => true,
timeout => $exec_timeout,
} ->
ceph_config {
"mon.${id}/public_addr": ensure => absent;
} -> Package<| tag == 'ceph' |>
}
}
+1 -1
View File
@@ -23,11 +23,11 @@
class ceph::profile::mon {
require ::ceph::profile::base
Ceph_config<| |> ->
ceph::mon { $::hostname:
authentication_type => $ceph::profile::params::authentication_type,
key => $ceph::profile::params::mon_key,
keyring => $ceph::profile::params::mon_keyring,
public_addr => $ceph::profile::params::public_addr,
}
$defaults = {
+6
View File
@@ -76,6 +76,11 @@
# [*public_network*] The address of the public network.
# Optional. {public-network-ip/netmask}
#
# [*public_addr*] The MON bind IP address.
# Optional. The IPv(4|6) address on which MON binds itself.
# This is useful when not specifying public_network or when there is more than one IP address on
# the same network and you want to be specific about the IP to bind the MON on.
#
# [*mon_key*] The mon secret key.
# Optional. Either mon_key or mon_keyring need to be set when using cephx.
#
@@ -108,6 +113,7 @@ class ceph::profile::params (
$osd_pool_default_min_size = undef,
$cluster_network = undef,
$public_network = undef,
$public_addr = undef,
$mon_key = undef,
$mon_keyring = undef,
$client_keys = {},
+2 -1
View File
@@ -23,7 +23,8 @@ describe 'ceph::profile::mon' do
it { is_expected.to contain_ceph__mon('first').with(
:authentication_type => 'cephx',
:key => 'AQATGHJTUCBqIBAA7M2yafV1xctn1pgr3GcKPg==')
:key => 'AQATGHJTUCBqIBAA7M2yafV1xctn1pgr3GcKPg==',
:public_addr => '10.11.12.2')
}
it { is_expected.to contain_class('ceph::keys').with(
'args' => {
+2 -6
View File
@@ -85,7 +85,6 @@ mon_data=\$(ceph-mon --id A --show-config-value mon_data)
if [ ! -d \$mon_data ] ; then
mkdir -p \$mon_data
if ceph-mon \
\
--mkfs \
--id A \
--keyring /tmp/ceph-mon-keyring-A ; then
@@ -124,7 +123,6 @@ mon_data=\$(ceph-mon --id A --show-config-value mon_data)
if [ ! -d \$mon_data ] ; then
mkdir -p \$mon_data
if ceph-mon \
\
--mkfs \
--id A \
--keyring /etc/ceph/ceph.mon.keyring ; then
@@ -152,6 +150,7 @@ fi
end
it { is_expected.to contain_service('ceph-mon-A').with('ensure' => 'running') }
it { is_expected.to contain_ceph_config('mon.A/public_addr').with_value("127.0.0.1") }
it { is_expected.to contain_exec('ceph-mon-testcluster.client.admin.keyring-A').with(
'command' => '/bin/true # comment to satisfy puppet syntax requirements
set -ex
@@ -164,7 +163,6 @@ mon_data=\$(ceph-mon --cluster testcluster --id A --show-config-value mon_data)
if [ ! -d \$mon_data ] ; then
mkdir -p \$mon_data
if ceph-mon --cluster testcluster \
--public_addr 127.0.0.1 \
--mkfs \
--id A \
--keyring /dev/null ; then
@@ -275,7 +273,6 @@ mon_data=\$(ceph-mon --id A --show-config-value mon_data)
if [ ! -d \$mon_data ] ; then
mkdir -p \$mon_data
if ceph-mon \
\
--mkfs \
--id A \
--keyring /tmp/ceph-mon-keyring-A ; then
@@ -319,7 +316,6 @@ mon_data=\$(ceph-mon --id A --show-config-value mon_data)
if [ ! -d \$mon_data ] ; then
mkdir -p \$mon_data
if ceph-mon \
\
--mkfs \
--id A \
--keyring /etc/ceph/ceph.mon.keyring ; then
@@ -347,6 +343,7 @@ fi
end
it { is_expected.to contain_service('ceph-mon-A').with('ensure' => 'running') }
it { is_expected.to contain_ceph_config('mon.A/public_addr').with_value("127.0.0.1") }
it { is_expected.to contain_exec('ceph-mon-testcluster.client.admin.keyring-A').with(
'command' => '/bin/true # comment to satisfy puppet syntax requirements
set -ex
@@ -359,7 +356,6 @@ mon_data=\$(ceph-mon --cluster testcluster --id A --show-config-value mon_data)
if [ ! -d \$mon_data ] ; then
mkdir -p \$mon_data
if ceph-mon --cluster testcluster \
--public_addr 127.0.0.1 \
--mkfs \
--id A \
--keyring /dev/null ; then
+1
View File
@@ -14,6 +14,7 @@ ceph::profile::params::osd_pool_default_size: '2'
ceph::profile::params::osd_pool_default_min_size: '1'
ceph::profile::params::cluster_network: '10.12.13.0/24'
ceph::profile::params::public_network: '10.11.12.0/24'
ceph::profile::params::public_addr: '10.11.12.2'
######## Keys
ceph::profile::params::mon_key: 'AQATGHJTUCBqIBAA7M2yafV1xctn1pgr3GcKPg=='