Skip to content
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

Replace icinga2::tls::client with icinga::cert #750

Merged
merged 1 commit into from
Dec 22, 2023
Merged
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
1 change: 0 additions & 1 deletion REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ start on boot and will be restarted if stopped.

* `icinga2::feature`: Private define resource to used by this module only.
* `icinga2::object`: Define resource to used by this module only.
* `icinga2::tls::client`: A class to generate tls key, cert and cacert paths.

### Functions

Expand Down
22 changes: 17 additions & 5 deletions manifests/feature/elasticsearch.pp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
fail('You must include the icinga2 base class before using any icinga2 feature class!')
}

$user = $icinga2::globals::user
$owner = $icinga2::globals::user
$group = $icinga2::globals::group
$conf_dir = $icinga2::globals::conf_dir
$ssl_dir = $icinga2::globals::cert_dir
Expand All @@ -104,7 +104,7 @@
}

File {
owner => $user,
owner => $owner,
group => $group,
}

Expand All @@ -128,9 +128,21 @@
'key_path' => $cert['key_file'],
}

icinga2::tls::client { 'ElasticsearchWriter_elasticsearch':
args => $cert,
notify => $_notify,
# Workaround, icinga::cert doesn't accept undef values for owner and group!
if $facts['os']['family'] != 'windows' {
icinga::cert { 'ElasticsearchWriter_elasticsearch':
args => $cert,
owner => $owner,
group => $group,
notify => $_notify,
}
} else {
icinga::cert { 'ElasticsearchWriter_elasticsearch':
args => $cert,
owner => 'foo',
group => 'bar',
notify => $_notify,
}
}
} else {
$attrs_ssl = {
Expand Down
18 changes: 15 additions & 3 deletions manifests/feature/gelf.pp
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,21 @@
'key_path' => $cert['key_file'],
}

icinga2::tls::client { 'GelfWriter_gelf':
args => $cert,
notify => $_notify,
# Workaround, icinga::cert doesn't accept undef values for owner and group!
if $facts['os']['family'] != 'windows' {
icinga::cert { 'GelfWriter_gelf':
args => $cert,
owner => $owner,
group => $group,
notify => $_notify,
}
} else {
icinga::cert { 'GelfWriter_gelf':
args => $cert,
owner => 'foo',
group => 'bar',
notify => $_notify,
}
}
} else {
$attrs_ssl = {
Expand Down
32 changes: 22 additions & 10 deletions manifests/feature/icingadb.pp
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@
fail('You must include the icinga2 base class before using any icinga2 feature class!')
}

$owner = $icinga2::globals::user
$group = $icinga2::globals::group
$conf_dir = $icinga2::globals::conf_dir
$data_dir = $icinga2::globals::data_dir
$ssl_dir = $icinga2::globals::cert_dir
$conf_dir = $icinga2::globals::conf_dir
$data_dir = $icinga2::globals::data_dir
$cert_dir = $icinga2::globals::cert_dir
$owner = $icinga2::globals::user
$group = $icinga2::globals::group

$_password = if $password =~ Sensitive {
$password
Expand All @@ -103,7 +103,7 @@
undef
}

$_notify = $ensure ? {
$_notify = $ensure ? {
'present' => Class['icinga2::service'],
default => undef,
}
Expand All @@ -126,7 +126,7 @@
if $enable_tls {
$cert = icinga::cert::files(
'IcingaDB-icingadb',
$ssl_dir,
$cert_dir,
$tls_key_file,
$tls_cert_file,
$tls_cacert_file,
Expand All @@ -146,9 +146,21 @@
'tls_protocolmin' => $tls_protocolmin,
}

icinga2::tls::client { 'IcingaDB-icingadb':
args => $cert,
notify => $_notify,
# Workaround, icinga::cert doesn't accept undef values for owner and group!
if $facts['os']['family'] != 'windows' {
icinga::cert { 'IcingaDB-icingadb':
args => $cert,
owner => $owner,
group => $group,
notify => $_notify,
}
} else {
icinga::cert { 'IcingaDB-icingadb':
args => $cert,
owner => 'foo',
group => 'bar',
notify => $_notify,
}
}
} # enable_tls
else {
Expand Down
18 changes: 15 additions & 3 deletions manifests/feature/idomysql.pp
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,21 @@
'ssl_cipher' => $ssl_cipher,
}

icinga2::tls::client { 'IdoMysqlConnection_ido-mysql':
args => $cert,
notify => $_notify,
# Workaround, icinga::cert doesn't accept undef values for owner and group!
if $facts['os']['family'] != 'windows' {
icinga::cert { 'IdoMysqlConnection_ido-mysql':
args => $cert,
owner => $owner,
group => $group,
notify => $_notify,
}
} else {
icinga::cert { 'IdoMysqlConnection_ido-mysql':
args => $cert,
owner => 'foo',
group => 'bar',
notify => $_notify,
}
}
} else {
$attrs_ssl = {
Expand Down
18 changes: 15 additions & 3 deletions manifests/feature/idopgsql.pp
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,21 @@
'ssl_key' => $cert['key_file'],
}

icinga2::tls::client { 'IdoPgsqlConnection_ido-pgsql':
args => $cert,
notify => $_notify,
# Workaround, icinga::cert doesn't accept undef values for owner and group!
if $facts['os']['family'] != 'windows' {
icinga::cert { 'IdoPgsqlConnection_ido-pgsql':
args => $cert,
owner => $owner,
group => $group,
notify => $_notify,
}
} else {
icinga::cert { 'IdoPgsqlConnection_ido-pgsql':
args => $cert,
owner => 'foo',
group => 'bar',
notify => $_notify,
}
}
} else {
$attrs_ssl = {
Expand Down
22 changes: 17 additions & 5 deletions manifests/feature/influxdb.pp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
fail('You must include the icinga2 base class before using any icinga2 feature class!')
}

$user = $icinga2::globals::user
$owner = $icinga2::globals::user
$group = $icinga2::globals::group
$conf_dir = $icinga2::globals::conf_dir
$ssl_dir = $icinga2::globals::cert_dir
Expand Down Expand Up @@ -140,7 +140,7 @@
}

File {
owner => $user,
owner => $owner,
group => $group,
}

Expand All @@ -167,9 +167,21 @@
'ssl_key' => $cert['key_file'],
}

icinga2::tls::client { 'InfluxdbWriter_influxdb':
args => $cert,
notify => $_notify,
# Workaround, icinga::cert doesn't accept undef values for owner and group!
if $facts['os']['family'] != 'windows' {
icinga::cert { 'InfluxdbWriter_influxdb':
args => $cert,
owner => $owner,
group => $group,
notify => $_notify,
}
} else {
icinga::cert { 'InfluxdbWriter_influxdb':
args => $cert,
owner => 'foo',
group => 'bar',
notify => $_notify,
}
}
} else {
$attrs_ssl = {
Expand Down
22 changes: 17 additions & 5 deletions manifests/feature/influxdb2.pp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
fail('You must include the icinga2 base class before using any icinga2 feature class!')
}

$user = $icinga2::globals::user
$owner = $icinga2::globals::user
$group = $icinga2::globals::group
$conf_dir = $icinga2::globals::conf_dir
$ssl_dir = $icinga2::globals::cert_dir
Expand All @@ -118,7 +118,7 @@
}

File {
owner => $user,
owner => $owner,
group => $group,
}

Expand All @@ -145,9 +145,21 @@
'ssl_key' => $cert['key_file'],
}

icinga2::tls::client { 'Influxdb2Writer_influxdb2':
args => $cert,
notify => $_notify,
# Workaround, icinga::cert doesn't accept undef values for owner and group!
if $facts['os']['family'] != 'windows' {
icinga::cert { 'Influxdb2Writer_influxdb2':
args => $cert,
owner => $owner,
group => $group,
notify => $_notify,
}
} else {
icinga::cert { 'Influxdb2Writer_influxdb2':
args => $cert,
owner => 'foo',
group => 'bar',
notify => $_notify,
}
}
} else {
$attrs_ssl = {
Expand Down
51 changes: 0 additions & 51 deletions manifests/tls/client.pp

This file was deleted.