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

Add support for the icingadb module #333

Merged
merged 3 commits into from Jan 6, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
38 changes: 38 additions & 0 deletions .devcontainer/README.md
@@ -0,0 +1,38 @@
# devcontainer


For format details, see https://aka.ms/devcontainer.json.

For config options, see the README at:
https://github.com/microsoft/vscode-dev-containers/tree/v0.140.1/containers/puppet

``` json
{
"name": "Puppet Development Kit (Community)",
"dockerFile": "Dockerfile",

// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.profiles.linux": {
"bash": {
"path": "bash",
}
}
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"puppet.puppet-vscode",
"rebornix.Ruby"
],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "pdk --version",
}
```



16 changes: 5 additions & 11 deletions .devcontainer/devcontainer.json
@@ -1,23 +1,17 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.140.1/containers/puppet
{
"name": "Puppet Development Kit (Community)",
"dockerFile": "Dockerfile",

// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
"terminal.integrated.profiles.linux": {
"bash": {
"path": "bash",
}
}
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"puppet.puppet-vscode",
"rebornix.Ruby"
]

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "pdk --version",
}
17 changes: 0 additions & 17 deletions .fixtures.puppet4.yml

This file was deleted.

1 change: 1 addition & 0 deletions .fixtures.yml
Expand Up @@ -7,5 +7,6 @@ fixtures:
yumrepo: "puppetlabs/yumrepo_core"
zypprepo: "puppet/zypprepo"
systemd: "camptocamp/systemd"
icinga: "icinga/icinga"
symlinks:
icingaweb2: "#{source_dir}"
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE.md
Expand Up @@ -6,7 +6,7 @@ GitHub supports Markdown: https://guides.github.com/features/mastering-markdown/
Multi-line code blocks either with three back ticks, or four space indent.

```
class { 'icingaweb2':
class { 'icinga2':
manage_repo => true,
}
```
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,28 @@
name: Test

on:
- workflow_dispatch
- pull_request
- push

jobs:
test:
runs-on: ubuntu-latest
env:
BUNDLE_WITHOUT: system_tests

steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
- name: Run static validation for Puppet/Ruby files
run: bundle exec rake validate
- name: Run Ruby Linter
run: bundle exec rake rubocop
- name: Run Puppet Linter
run: bundle exec rake lint
- name: Run unit tests
run: bundle exec rake parallel_spec
21 changes: 0 additions & 21 deletions .mailmap

This file was deleted.

14 changes: 0 additions & 14 deletions .pmtignore

This file was deleted.

2 changes: 1 addition & 1 deletion .rubocop.yml
Expand Up @@ -4,7 +4,7 @@ require:
- rubocop-rspec
AllCops:
DisplayCopNames: true
TargetRubyVersion: '2.4'
TargetRubyVersion: '2.5'
Include:
- "**/*.rb"
Exclude:
Expand Down
8 changes: 8 additions & 0 deletions .sync.yml
@@ -0,0 +1,8 @@
# This file can be used to customize the files managed by PDK.
#
# See https://github.com/puppetlabs/pdk-templates/blob/main/README.md
# for more information.
#
# See https://github.com/puppetlabs/pdk-templates/blob/main/config_defaults.yml
# for the default values.
--- {}
16 changes: 0 additions & 16 deletions .travis/setup.sh

This file was deleted.

1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -24,6 +24,7 @@ group :development do
gem "puppet-module-posix-dev-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby]
gem "puppet-module-win-default-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-module-win-dev-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "voxpupuli-puppet-lint-plugins", '>= 3.0', require: false
end
group :system_tests do
gem "puppet-module-posix-system-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby]
Expand Down
1 change: 1 addition & 0 deletions Rakefile
Expand Up @@ -43,6 +43,7 @@ end

PuppetLint.configuration.send('disable_relative')


if Bundler.rubygems.find_name('github_changelog_generator').any?
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
raise "Set CHANGELOG_GITHUB_TOKEN environment variable eg 'export CHANGELOG_GITHUB_TOKEN=valid_token_here'" if Rake.application.top_level_tasks.include? "changelog" and ENV['CHANGELOG_GITHUB_TOKEN'].nil?
Expand Down
2 changes: 1 addition & 1 deletion data/Linux-kernel.yaml
Expand Up @@ -8,6 +8,6 @@ icingaweb2::globals::pgsql_vspheredb_schema: /usr/share/icingaweb2/modules/vsphe
icingaweb2::globals::gettext_package_name: gettext
icingaweb2::globals::icingacli_bin: /usr/bin/icingacli
icingaweb2::globals::default_module_path: /usr/share/icingaweb2/modules

icingaweb2::conf_group: icingaweb2
icingaweb2::logging_file: /var/log/icingaweb2/icingaweb2.log
icingaweb2::module::icingadb::package_name: icingadb-web
4 changes: 2 additions & 2 deletions data/common.yaml
Expand Up @@ -12,11 +12,11 @@ icingaweb2::module::fileshipper::git_repository: https://github.com/Icinga/icing
icingaweb2::module::generictts::git_repository: https://github.com/Icinga/icingaweb2-module-generictts.git
icingaweb2::module::graphite::git_repository: https://github.com/Icinga/icingaweb2-module-graphite.git
icingaweb2::module::incubator::git_repository: https://github.com/Icinga/icingaweb2-module-incubator.git
icingaweb2::module::incubator::git_revision: v0.5.0
icingaweb2::module::incubator::git_revision: v0.19.0
icingaweb2::module::ipl::git_repository: https://github.com/Icinga/icingaweb2-module-ipl.git
icingaweb2::module::ipl::git_revision: v0.5.0
icingaweb2::module::puppetdb::git_repository: https://github.com/Icinga/icingaweb2-module-puppetdb.git
icingaweb2::module::reactbundle::git_repository: https://github.com/Icinga/icingaweb2-module-reactbundle.git
icingaweb2::module::reactbundle::git_revision: v0.7.0
icingaweb2::module::reactbundle::git_revision: v0.9.0
icingaweb2::module::vsphere::git_repository: https://github.com/Icinga/icingaweb2-module-vsphere.git
icingaweb2::module::vspheredb::git_repository: https://github.com/Icinga/icingaweb2-module-vspheredb.git
28 changes: 13 additions & 15 deletions examples/apache2.pp
@@ -1,38 +1,36 @@
class { 'apache':
mpm_module => 'prefork'
mpm_module => 'prefork',
}

class { 'apache::mod::php': }

case $::osfamily {
case $facts['os']['family'] {
'redhat': {
package { 'php-mysql': }
package { 'php-mysqlnd': }

file {'/etc/httpd/conf.d/icingaweb2.conf':
file { '/etc/httpd/conf.d/icingaweb2.conf':
ensure => file,
source => 'puppet:///modules/icingaweb2/examples/apache2/icingaweb2.conf',
require => Class['apache'],
notify => Service['httpd'],
}

package { 'centos-release-scl':
before => Class['icingaweb2']
}
}
'debian': {
class { 'apache::mod::rewrite': }

file {'/etc/apache2/conf.d/icingaweb2.conf':
file { '/etc/apache2/conf.d/icingaweb2.conf':
ensure => file,
source => 'puppet:///modules/icingaweb2/examples/apache2/icingaweb2.conf',
require => Class['apache'],
notify => Service['apache2'],
}
}
default: {
fail("Your plattform ${::osfamily} is not supported by this example.")
fail("Your plattform ${facts['os']['family']} is not supported by this example.")
}
}

include ::mysql::server
include mysql::server

mysql::db { 'icingaweb2':
user => 'icingaweb2',
Expand All @@ -41,7 +39,7 @@
grant => ['SELECT', 'INSERT', 'UPDATE', 'DELETE', 'DROP', 'CREATE VIEW', 'CREATE', 'INDEX', 'EXECUTE', 'ALTER', 'REFERENCES'],
}

class {'icingaweb2':
class { 'icingaweb2':
manage_repos => true,
import_schema => true,
db_type => 'mysql',
Expand All @@ -52,7 +50,7 @@
require => Mysql::Db['icingaweb2'],
}

class {'icingaweb2::module::monitoring':
class { 'icingaweb2::module::monitoring':
ido_host => 'localhost',
ido_db_name => 'icinga2',
ido_db_username => 'icinga2',
Expand All @@ -62,6 +60,6 @@
transport => 'api',
username => 'root',
password => 'icinga',
}
}
},
},
}
10 changes: 5 additions & 5 deletions examples/authmethod.pp
@@ -1,11 +1,11 @@
include ::icingaweb2
include icingaweb2

icingaweb2::config::authmethod {'external-auth':
icingaweb2::config::authmethod { 'external-auth':
backend => 'external',
order => '01',
}

icingaweb2::config::resource{'my-sql':
icingaweb2::config::resource { 'my-sql':
type => 'db',
db_type => 'mysql',
host => 'localhost',
Expand All @@ -15,8 +15,8 @@
db_password => 'supersecret',
}

icingaweb2::config::authmethod {'db-auth':
icingaweb2::config::authmethod { 'db-auth':
backend => 'db',
resource => 'my-sql',
order => '02',
}
}
10 changes: 5 additions & 5 deletions examples/groupbackend.pp
@@ -1,15 +1,15 @@
include ::icingaweb2
include icingaweb2

icingaweb2::config::groupbackend {'mysql-backend':
icingaweb2::config::groupbackend { 'mysql-backend':
backend => 'db',
resource => 'my-sql',
}

icingaweb2::config::groupbackend {'ldap-backend':
icingaweb2::config::groupbackend { 'ldap-backend':
backend => 'ldap',
resource => 'my-ldap',
ldap_group_class => 'groupofnames',
ldap_group_name_attribute => 'cn',
ldap_group_member_attribute => 'member',
ldap_base_dn => 'ou=groups,dc=icinga,dc=com'
}
ldap_base_dn => 'ou=groups,dc=icinga,dc=com',
}
16 changes: 4 additions & 12 deletions examples/import_schema.pp → examples/import_schema-mysql.pp
@@ -1,4 +1,4 @@
include ::mysql::server
include mysql::server

mysql::db { 'icingaweb2':
user => 'icingaweb2',
Expand All @@ -7,20 +7,12 @@
grant => ['SELECT', 'INSERT', 'UPDATE', 'DELETE', 'DROP', 'CREATE VIEW', 'CREATE', 'INDEX', 'EXECUTE', 'ALTER', 'REFERENCES'],
}

include ::postgresql::server

postgresql::server::db { 'icingaweb2':
user => 'icingaweb2',
password => postgresql_password('icingaweb2', 'icingaweb2'),
}

class {'icingaweb2':
class { 'icingaweb2':
manage_repos => true,
import_schema => true,
db_type => 'pgsql',
db_type => 'mysql',
db_host => 'localhost',
db_port => 5432,
db_username => 'icingaweb2',
db_password => 'icingaweb2',
require => [ Postgresql::Server::Db['icingaweb2'], Mysql::Db['icingaweb2'] ]
require => Mysql::Db['icingaweb2'],
}