It’s been a while since we have released a new version of our Icinga Web 2 Puppet module. Today we’re happy to announce v2.0 of this module, available on Puppet Forge. We reworked the whole module, with new mechanisms and features that make it easy to install and configure Icinga Web 2 and many of its modules. The new module enables you to configure every possible setting of Icinga Web 2 and is compatible with Puppet starting from version 4.7. Here’s a brief introduction with some examples:

Installation of Icinga Web 2

This Puppet module relies on the official Icinga repository to install Icinga Web 2. You can decide to import the database schema and set every global configuration through the ::icingaweb2 class. In almost every case you should also install and configure the monitoring module, which connects your Icinga Web 2 interface to the Icinga 2 core. This example installs Icinga Web 2 and connects it to your existing Icinga 2 database and API.

class {'icingaweb2':
  manage_repo => true,
  import_schema => false,
 }

class {'icingaweb2::module::monitoring':
  ido_host => 'localhost',
  ido_db_name => 'icinga2',
  ido_db_username => 'icinga2',
  ido_db_password => 'supersecret',
  commandtransports => {
    icinga2 => {
      transport => 'api',
      username => 'root',
      password => 'icinga',
    }
  }
 }

Managing Resources and Authentication Methods

Resources are used by Icinga Web 2 and its modules to connect to connect to various databases. You can configure as many resources as you wish, and use them for different purposes. The following example will create a new database resource that is used as backend for user authentication.

icingaweb2::config::resource{'my-sql':
  type        => 'db',
  db_type     => 'mysql',
  host        => 'localhost',
  port        => 3306,
  db_name     => 'icingaweb2',
  db_username => 'root',
  db_password => 'supersecret',
}

icingaweb2::config::authmethod {'db-auth':
  backend  => 'db',
  resource => 'my-sql',
  order    => '02',
}

Hint: You can add more than one authentication method and define in which order to look up users.

Managing Modules

Generally, this Puppet module aims to support all official Icinga Web 2 modules. The following modules can be managed for now, others will follow in future releases:

  • Director: Manage Icinga 2 configuration in a web frontend
  • PuppetDB (with Director): Import data from the PuppetDB and use it with the Director
  • Businessprocess: Create business processes based on your monitoring configuration
  • Cube: Extended filtering and view on hosts and services
  • GenericTTS: Connect your ticket system to Icinga Web 2
  • Monitoring: Connect the web interface to Icinga 2
  • Translation: Translate Icinga Web 2 to other languages
  • Doc: Documentation

We didn’t forget about community modules! See the section below to find out how you install and configure your own modules.

Managing Community Modules

There are many modules out there written by our community. Be it to visualise graphs or display your hosts on a map, Icinga Web 2 allows you to do many things. And the best thing about it is, you can manage these community modules with this Puppet module as well. The ::icingaweb::module defined type is designed to manage modules in general and it is also used internally for the built in icinga Web 2 modules.

This example installs and configures the Map module:

include icingaweb2

$conf_dir        = $::icingaweb2::params::conf_dir
$module_conf_dir = "${conf_dir}/modules/map"

$map_settings = {
  'module-map' => {
    'section_name' => 'map',
    'target'       => "${module_conf_dir}/config.ini",
    'settings'     => {
      'stateType'      => 'hard',
      'default_lat'    => '52.520645',
      'default_long'   => '13.409779',
      'default_zoom'   => '6',
      'max_zoom'       => '19',
      'min_zoom'       => '2',
      'dashlet_height' => '300',
      'marker_size'    => '15',
    },
  },
}

icingaweb2::module { 'map':
  install_method => 'git',
  git_repository => 'https://github.com/nbuchwitz/icingaweb2-module-map.git',
  git_revision   => 'v1.0.3',
  settings       => $map_settings,
}

You can find many more examples in the docs and in the examples directory of this Puppet module.