Skip to content

Commit

Permalink
Merge branch 'main' into enhancement/add-param-apache-mods
Browse files Browse the repository at this point in the history
  • Loading branch information
lbetz authored Aug 5, 2024
2 parents 31b59aa + 7dc3ead commit 69b63c0
Show file tree
Hide file tree
Showing 17 changed files with 174 additions and 39 deletions.
12 changes: 10 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,15 +245,23 @@ with:
BEAKER_PUPPET_COLLECTION=puppet7 BEAKER_setfile=debian11-64 bundle exec rake beaker
```

or

```sh
BEAKER_PUPPET_COLLECTION=none BEAKER_setfile=archlinux-64 bundle exec rake beaker
```

This latter example will use the distribution's own version of Puppet.

You can replace the string `debian11` with any common operating system.
The following strings are known to work:

* ubuntu2004
* ubuntu2204
* debian11
* centos7
* centos8
* debian12
* centos9
* archlinux
* almalinux8
* almalinux9
* fedora36
Expand Down
6 changes: 6 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

skip-changelog:
- head-branch: ['^release-*', 'release']
42 changes: 42 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes

changelog:
exclude:
labels:
- duplicate
- invalid
- modulesync
- question
- skip-changelog
- wont-fix
- wontfix

categories:
- title: Breaking Changes 🛠
labels:
- backwards-incompatible

- title: New Features 🎉
labels:
- enhancement

- title: Bug Fixes 🐛
labels:
- bug

- title: Documentation Updates 📚
labels:
- documentation
- docs

- title: Dependency Updates ⬆️
labels:
- dependencies

- title: Other Changes
labels:
- "*"
17 changes: 17 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

name: "Pull Request Labeler"

on:
pull_request_target: {}

jobs:
labeler:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
7 changes: 7 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,10 @@ jobs:
# https://docs.github.com/en/actions/security-guides/encrypted-secrets
username: ${{ secrets.PUPPET_FORGE_USERNAME }}
api_key: ${{ secrets.PUPPET_FORGE_API_KEY }}

create-github-release:
name: Create GitHub Release
runs-on: ubuntu-latest
steps:
- name: Create GitHub release
uses: voxpupuli/gha-create-a-github-release@v1
2 changes: 1 addition & 1 deletion .msync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

modulesync_config_version: '8.0.1'
modulesync_config_version: '9.1.0'
3 changes: 3 additions & 0 deletions .puppet-lint.rc
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

--fail-on-warnings
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
source ENV['GEM_SOURCE'] || 'https://rubygems.org'

group :test do
gem 'voxpupuli-test', '~> 7.2', :require => false
gem 'voxpupuli-test', '~> 9.0', :require => false
gem 'coveralls', :require => false
gem 'simplecov-console', :require => false
gem 'puppet_metadata', '~> 4.0', :require => false
Expand Down
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,34 @@ This module provides several non private helper classes for the other official I
* [icingadb](https://github.com/voxpupuli/puppet-icingadb)
* [icingaweb2](https://github.com/voxpupuli/puppet-icingaweb2)

### How to use the classes for Icinga Web an databases with MariaDB on Debian bookwork
### How to use the classes for Icinga Web or any database use on Ubuntu Noble

To get Icinga Web 2 running on Debian bookworm use puppet-php >=8.1.0 (no longer necessary if puppet-php >= 10.2.0 is used) and set:
To get Icinga Web 2 running on Ubutunt Noble use puppet-php >=8.3.0 and set:

```yaml
php::globals::php_version: '8.3'
```
The current MariaDB logs to syslog by default so set:
```yaml
mysql::server::override_options:
mysqld:
log-error: ~
```
This disables the logging to file and the requirement and management of an existing directory /var/log/mysql.
If using PostgreSQL you have to set the version to '16':
```yaml
---
postgresql::globals::version: '16'
```
### How to use the classes for Icinga Web or databases with MariaDB on Debian Bookwork
To get Icinga Web 2 running on Debian Bookworm use puppet-php >=8.2.0 (no longer necessary if puppet-php >= 10.2.0 is used) and set:
```yaml
php::globals::php_version: '8.2'
Expand Down
12 changes: 11 additions & 1 deletion REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,7 @@ The following parameters are available in the `icinga::web` class:
* [`db_pass`](#-icinga--web--db_pass)
* [`apache_cgi_pass_auth`](#-icinga--web--apache_cgi_pass_auth)
* [`apache_extra_mods`](#-icinga--web--apache_extra_mods)
* [`apache_config`](#-icinga--web--apache_config)
* [`db_type`](#-icinga--web--db_type)
* [`db_host`](#-icinga--web--db_host)
* [`db_port`](#-icinga--web--db_port)
Expand Down Expand Up @@ -841,12 +842,21 @@ An option available since Apache v2.4.15 and required for authenticated access t

##### <a name="-icinga--web--apache_extra_mods"></a>`apache_extra_mods`

Data type: `Array[String]`
Data type: `Array[String[1]]`

List of addational Apache modules to load.

Default value: `[]`

##### <a name="-icinga--web--apache_config"></a>`apache_config`

Data type: `Boolean`

Wether or not install an default Apache config for Icinga Web 2. If set to `true` Icinga is
reachable via `/icingaweb2`.

Default value: `true`

##### <a name="-icinga--web--db_type"></a>`db_type`

Data type: `Enum['mysql', 'pgsql']`
Expand Down
28 changes: 20 additions & 8 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@
features => [],
}

# check selinux
$_selinux = if fact('os.selinux.enabled') and $facts['os']['selinux']['enabled'] and $icinga2::globals::selinux_package_name {
$icinga2::manage_selinux
} else {
false
}

# switch logging between mainlog, syslog and eventlog
if $facts['kernel'] != 'windows' {
if $logging_type == 'file' {
Expand Down Expand Up @@ -125,16 +132,20 @@

case $facts['kernel'] {
'linux': {
$icinga_user = $icinga2::globals::user
$icinga_group = $icinga2::globals::group
$icinga_package = $icinga2::globals::package_name
$icinga_service = $icinga2::globals::service_name
$icinga_user = $icinga2::globals::user
$icinga_group = $icinga2::globals::group
$icinga_service = $icinga2::globals::service_name
$icinga_packages = if $_selinux {
[$icinga2::globals::package_name, $icinga2::globals::selinux_package_name] + $extra_packages
} else {
[$icinga2::globals::package_name] + $extra_packages
}

case $facts['os']['family'] {
'redhat': {
$icinga_user_homedir = $icinga2::globals::spool_dir

package { ['nagios-common', $icinga_package] + $extra_packages:
package { ['nagios-common'] + $icinga_packages:
ensure => installed,
before => Class['icinga2'],
}
Expand All @@ -147,7 +158,7 @@
'debian': {
$icinga_user_homedir = '/var/lib/nagios'

package { [$icinga_package] + $extra_packages:
package { $icinga_packages:
ensure => installed,
before => Class['icinga2'],
}
Expand All @@ -156,7 +167,7 @@
'suse': {
$icinga_user_homedir = $icinga2::globals::spool_dir

package { [$icinga_package] + $extra_packages:
package { $icinga_packages:
ensure => installed,
before => Class['icinga2'],
}
Expand Down Expand Up @@ -191,7 +202,8 @@
ensure => file,
owner => $icinga_user,
group => $icinga_group,
require => Package[$icinga_package];
seltype => 'icinga2_spool_t',
require => Package[$icinga_packages];
["${icinga_user_homedir}/.ssh", "${icinga_user_homedir}/.ssh/controlmasters"]:
ensure => directory,
mode => '0700';
Expand Down
12 changes: 7 additions & 5 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,12 @@

($global_zones + keys($_workers) + $zone).each |String $dir| {
file { "${icinga2::globals::conf_dir}/zones.d/${dir}":
ensure => directory,
tag => 'icinga2::config::file',
owner => $icinga2::globals::user,
group => $icinga2::globals::group,
mode => '0750',
ensure => directory,
tag => 'icinga2::config::file',
owner => $icinga2::globals::user,
group => $icinga2::globals::group,
mode => '0750',
seltype => 'icinga2_etc_t',
}
}
} else {
Expand All @@ -140,6 +141,7 @@
purge => true,
recurse => true,
force => true,
seltype => 'icinga2_etc_t',
}
}
}
17 changes: 12 additions & 5 deletions manifests/web.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
# @param apache_extra_mods
# List of addational Apache modules to load.
#
# @param apache_config
# Wether or not install an default Apache config for Icinga Web 2. If set to `true` Icinga is
# reachable via `/icingaweb2`.
#
# @param db_type
# What kind of database type to use.
#
Expand Down Expand Up @@ -60,6 +64,7 @@
Variant[Stdlib::Host, Array[Stdlib::Host]] $api_host = 'localhost',
String $api_user = 'icingaweb2',
Array[String[1]] $apache_extra_mods = [],
Boolean $apache_config = true,
) {
# install all required php extentions
# by icingaweb (done by package dependencies) before PHP
Expand Down Expand Up @@ -159,11 +164,13 @@
# Load additional modules
include prefix($apache_extra_mods, 'apache::mod::')

apache::custom_config { 'icingaweb2':
ensure => present,
content => template('icinga/apache_custom_default.conf.erb'),
verify_config => false,
priority => false,
if $apache_config {
apache::custom_config { 'icingaweb2':
ensure => present,
content => template('icinga/apache_custom_default.conf.erb'),
verify_config => false,
priority => false,
}
}

#
Expand Down
16 changes: 4 additions & 12 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,13 @@
{
"operatingsystem": "CentOS",
"operatingsystemrelease": [
"7",
"8",
"9"
]
},
{
"operatingsystem": "RedHat",
"operatingsystemrelease": [
"7",
"8",
"9"
]
Expand All @@ -52,12 +50,6 @@
"9"
]
},
{
"operatingsystem": "Scientific",
"operatingsystemrelease": [
"7"
]
},
{
"operatingsystem": "Debian",
"operatingsystemrelease": [
Expand All @@ -69,15 +61,15 @@
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [
"20.04",
"22.04"
"22.04",
"24.04"
]
},
{
"operatingsystem": "Fedora",
"operatingsystemrelease": [
"35",
"36",
"37"
"39",
"40"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/icinga_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

it { is_expected.to compile }

case facts[:osfamily]
case facts[:os]['family']
when 'RedHat', 'Debian', 'Suse'

context 'ca => true, this_zone => foo, zones => {}' do
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/repos_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
end
end

case facts[:osfamily]
case facts[:os]['family']
when 'RedHat'
context 'with manage_epel => false, manage_powertools => false' do
let(:params) do
Expand Down
Loading

0 comments on commit 69b63c0

Please sign in to comment.