Skip to content

Commit

Permalink
replace icingaweb2::repos with icinga::repos, add new param manage_re…
Browse files Browse the repository at this point in the history
…pos to replace mange_repo in the future
  • Loading branch information
lbetz committed Oct 14, 2020
1 parent c29c4dd commit fb1e41e
Show file tree
Hide file tree
Showing 13 changed files with 61 additions and 176 deletions.
41 changes: 25 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
6. [Development - Guide for contributing to the module](#development)

## Overview

[Icinga Web 2] is the associated web interface for the open source
monitoring tool [Icinga 2]. This module helps with installing and managing
configuration of Icinga Web 2 and its modules on multiple operating systems.
Expand All @@ -26,6 +27,11 @@ This module can manage all configurations files of Icinga Web 2 and import an in
manage all official [modules](https://www.icinga.com/products/icinga-web-2-modules/) as well as modules developed by the
community.

### What's new in version 3.0.0

* The current version now uses the `icinga::repos` class from the new module `icinga` for the configuration of
repositories including EPEL on RedHat and Backports on Debian. (see https://github.com/icinga/puppet-icinga)

## Setup

### What the Icinga 2 Puppet module supports
Expand All @@ -40,34 +46,39 @@ community.

This module depends on

* [icinga/ciinga] >= 1.0.0
* needed if `manage_repos` is set to `true`
* [puppetlabs/stdlib] >= 4.16.0
* [puppetlabs/vcsrepo] >= 1.3.0
* [puppetlabs/concat] >= 2.0.1

Depending on your setup the following modules may also be required:

* [puppetlabs/apt] >= 2.0.0
* [puppetlabs/yumrepo_core] >= 1.0.0
* [puppet/zypprepo] >= 2.0.0

### Limitations

This module has been tested on:

* Debian 9, 10
* CentOS/RHEL 6, 7
* CentOS/RHEL 6, 7, 8
* Requires [Software Collections Repository](https://wiki.centos.org/AdditionalResources/Repositories/SCL)
* Ubuntu 16.04, 18.04
* SLES 12

* PHP >= 7.0
* Ubuntu 16.04, 18.04, 20.04
* SLES 12, 15

Other operating systems or versions may work but have not been tested.

## Usage

NOTE: If you plan to use additional modules from git, the CLI `git` command has to be installed. You can manage it yourself as package resource or declare the package name in `extra_packages`.

By default, your distribution's packages are used to install Icinga Web 2.

Use the `manage_repos` parameter to configure repositories by default the official and stable [packages.icinga.com]. To configure your own
repositories, or use the official testing or nightly snapshot stage, see https://github.com/icinga/puppet-icinga.

``` puppet
class { '::icingaweb2':
manage_repos => true,
}
```

The usage of this module isn't simple. That depends on how Icinga Web 2 is implemented. Monitoring is here just a module in a framework. All basic stuff like authentication, logging or authorization is done by this framework. To store user and usergroups in a MySQL database, the database has to exist:
```
mysql::db { 'icingaweb2':
Expand All @@ -78,7 +89,7 @@ mysql::db { 'icingaweb2':
}
class {'icingaweb2':
manage_repo => true,
manage_repos => true,
import_schema => true,
db_type => 'mysql',
db_host => 'localhost',
Expand All @@ -95,7 +106,7 @@ If you set `import_schema` to `true` an default admin user `icingaadmin` with pa
In case that `import_schema` is disabled or you'd like to use a different backend for authorization like LDAP, more work is required. At first we need a ressource with credentials to connect a LDAP server:
```
class {'icingaweb2':
manage_repo => true,
manage_repos => true,
}
icingaweb2::config::resource{ 'my-ldap':
Expand Down Expand Up @@ -220,10 +231,8 @@ See also [CHANGELOG.md]

[Icinga 2]: https://www.icinga.com/products/icinga-2/
[Icinga Web 2]: https://www.icinga.com/products/icinga-web-2/
[icinga/icinga]: https://github.com/icinga/puppet-icinga/

[puppetlabs/apt]: https://github.com/puppetlabs/puppetlabs-apt
[puppetlabs/yumrepo_core]: https://github.com/puppetlabs/puppetlabs-yumrepo_core
[puppet/zypprepo]: https://forge.puppet.com/puppet/zypprepo
[puppetlabs/stdlib]: https://github.com/puppetlabs/puppetlabs-stdlib
[puppetlabs/concat]: https://github.com/puppetlabs/puppetlabs-concat
[puppetlabs/vcsrepo]: https://forge.puppet.com/puppetlabs/vcsrepo
Expand Down
4 changes: 2 additions & 2 deletions examples/apache2.pp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
}

class {'icingaweb2':
manage_repo => true,
manage_repos => true,
import_schema => true,
db_type => 'mysql',
db_host => 'localhost',
Expand All @@ -64,4 +64,4 @@
password => 'icinga',
}
}
}
}
4 changes: 2 additions & 2 deletions examples/import_schema.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
}

class {'icingaweb2':
manage_repo => true,
manage_repos => true,
import_schema => true,
db_type => 'pgsql',
db_host => 'localhost',
db_port => 5432,
db_username => 'icingaweb2',
db_password => 'icingaweb2',
require => [ Postgresql::Server::Db['icingaweb2'], Mysql::Db['icingaweb2'] ]
}
}
2 changes: 1 addition & 1 deletion examples/init_repo.pp → examples/init_repos.pp
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
class { 'icingaweb2':
manage_repo => true,
manage_repos => true,
}
4 changes: 2 additions & 2 deletions examples/module_director.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}

class {'icingaweb2':
manage_repo => true,
manage_repos => true,
import_schema => true,
db_type => 'mysql',
db_host => 'localhost',
Expand Down Expand Up @@ -46,4 +46,4 @@
api_username => 'root',
api_password => 'icinga',
require => Mysql::Db['director']
}
}
4 changes: 2 additions & 2 deletions examples/module_monitoring.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


class {'icingaweb2':
manage_repo => true,
manage_repos => true,
import_schema => true,
db_type => 'mysql',
db_host => 'localhost',
Expand All @@ -32,4 +32,4 @@
password => 'icinga',
}
}
}
}
2 changes: 1 addition & 1 deletion examples/nginx.pp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
}

class {'icingaweb2':
manage_repo => true,
manage_repos => true,
import_schema => true,
db_type => 'mysql',
db_host => 'localhost',
Expand Down
2 changes: 1 addition & 1 deletion examples/resource.pp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class { 'icingaweb2':
manage_repo => true,
manage_repos => true,
}

icingaweb2::config::resource{'my-sql':
Expand Down
23 changes: 17 additions & 6 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@
# Whether users can change themes or not.
#
# @param [Boolean] manage_repo
# When set to true this module will install the packages.icinga.com repository.
# Deprecated, use manage_repos.
#
# @param [Boolean] manage_repos
# When set to true this module will use the module icinga/puppet-icinga to manage repositories,
# e.g. the release repo on packages.icinga.com repository by default, the EPEL repository or Backports.
# For more information, see http://github.com/icinga/puppet-icinga.
#
# @param [Boolean] manage_package
# If set to `false` packages aren't managed.
Expand Down Expand Up @@ -92,7 +97,7 @@
# }
#
# class {'icingaweb2':
# manage_repo => true,
# manage_repos => true,
# import_schema => true,
# db_type => 'mysql',
# db_host => 'localhost',
Expand All @@ -111,7 +116,7 @@
# }
#
# class {'icingaweb2':
# manage_repo => true,
# manage_repos => true,
# import_schema => true,
# db_type => 'pgsql',
# db_host => 'localhost',
Expand All @@ -134,6 +139,7 @@
String $theme = 'Icinga',
Boolean $theme_disabled = false,
Boolean $manage_repo = false,
Boolean $manage_repos = false,
Boolean $manage_package = true,
Optional[Array[String]] $extra_packages = undef,
Boolean $import_schema = false,
Expand All @@ -150,11 +156,16 @@

require ::icingaweb2::globals

class { '::icingaweb2::repo': }
-> class { '::icingaweb2::install': }
if $manage_repos or $manage_repo {
require ::icinga::repos
if $manage_repo {
deprecation('manage_repo', 'manage_repo is deprecated and will be replaced by manage_repos in the future.')
}
}

class { '::icingaweb2::install': }
-> class { '::icingaweb2::config': }

contain ::icingaweb2::repo
contain ::icingaweb2::install
contain ::icingaweb2::config
}
95 changes: 0 additions & 95 deletions manifests/repo.pp

This file was deleted.

10 changes: 8 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
"name": "puppetlabs/concat",
"version_requirement": ">= 2.0.1 < 7.0.0"
},
{
"name": "icinga/icinga",
"version_requirement": ">= 1.0.0 < 2.0.0"
},
{
"name": "puppetlabs/vcsrepo",
"version_requirement": ">= 1.3.0 < 4.0.0"
Expand Down Expand Up @@ -53,13 +57,15 @@
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [
"16.04",
"18.04"
"18.04",
"20.04"
]
},
{
"operatingsystem": "SLES",
"operatingsystemrelease": [
"12"
"12",
"15"
]
}
],
Expand Down
10 changes: 0 additions & 10 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,9 @@

it { is_expected.to contain_class('icingaweb2::config') }
it { is_expected.to contain_class('icingaweb2::install') }
it { is_expected.to contain_class('icingaweb2::repo') }

it { is_expected.to contain_package('icingaweb2').with('ensure' => 'installed') }

case facts[:osfamily]
when 'Debian'
it { is_expected.not_to contain_apt__source('icinga-stable-release') }
when 'RedHat'
it { is_expected.not_to contain_yumrepo('icinga-stable-release') }
when 'Suse'
it { is_expected.not_to contain_zypprepo('icinga-stable-release') }
end

context "#{os} with manage_package => false" do
let(:params) { { manage_package: false } }

Expand Down
Loading

0 comments on commit fb1e41e

Please sign in to comment.