add component based log level config for icingadb - #369
Open
fscaptain wants to merge 2 commits into
Open
Conversation
Member
|
Hi @fscaptain, sorry for letting you wait. This looks good to me. Though, we could improve on it a little in the future (testing for valid values would not be necessary if we used argument specs, that's for the future though). Could you rebase your branch on the current main? I've already prepared a patch for your branch if you'd like to use that :) diff --git a/doc/role-icingadb/README.md b/doc/role-icingadb/README.md
new file mode 120000
index 0000000..239b853
--- /dev/null
+++ b/doc/role-icingadb/README.md
@@ -0,0 +1 @@
+../../roles/icingadb/README.md
\ No newline at end of file
diff --git a/doc/role-icingadb/role-icingadb.md b/roles/icingadb/README.md
similarity index 69%
rename from doc/role-icingadb/role-icingadb.md
rename to roles/icingadb/README.md
index 8b2f4ec..6641670 100644
--- a/doc/role-icingadb/role-icingadb.md
+++ b/roles/icingadb/README.md
@@ -1,4 +1,4 @@
-# Role icinga.icinga.icingadb
+# Role netways.icinga.icingadb
This role installs and configures the IcingaDB daemon. In addition it can also import the schema into the database. It is idempotent and works in HA-setups (two Icinga2 instances).
@@ -6,15 +6,15 @@ It serves as the official, more performant successor to Icinga IDO. More informa
> [!TIP]
-> In many scenarios you want to install the [icingadb_redis role](../role-icingadb_redis/) together with this role. It is part of this collection, too.
+> In many scenarios you want to install the [icingadb_redis role](https://github.com/NETWAYS/ansible-collection-icinga/tree/main/doc/role-icingadb_redis/) together with this role. It is part of this collection, too.
## Database
-IcingaDB relies on a relational database to persist received data. This database **won't** be created by this role - you need to deploy and configure one in advance. For more information, see the [Databases](../getting-started.md#databases) section in the getting started guide.
+IcingaDB relies on a relational database to persist received data. This database **won't** be created by this role - you need to deploy and configure one in advance. For more information, see the [Databases](https://github.com/NETWAYS/ansible-collection-icinga/tree/main/doc/getting-started.md) section in the getting started guide.
## Variables
-The following variables define the configuration for IcingaDB. Some variables got predefined [defaults](../../roles/icingadb/defaults/main.yml), others are purely opt-in.
+The following variables define the configuration for IcingaDB. Some variables got predefined [defaults](https://github.com/NETWAYS/ansible-collection-icinga/tree/main/roles/icingadb/defaults/main.yml), others are purely opt-in.
For more information on the respective settings please see [the official documentation](https://icinga.com/docs/icinga-db/latest/doc/03-Configuration/).
@@ -51,26 +51,26 @@ For more information on the respective settings please see [the official documen
### Logging configuration
-| Variable | Type | Description | Default |
-|----------|------|-------------|---------|
-| `icingadb_logging_level` | `fatal\|error\|warn\|info\|debug` | Defines the logging level for IcingaDB. | `info` |
+| Variable | Type | Description | Default |
+|---------- |------ |------------- |---------|
+| `icingadb_logging_level` | `fatal\|error\|warn\|info\|debug` | Defines the logging level for IcingaDB. | `info` |
#### Compont based log level
The following variables can be used to define special log levels for individual components.
-| Variable | Type | Description | Default |
-|----------|------|-------------|---------|
-| `icingadb_log_level_confic_sync` | `fatal\|error\|warn\|info\|debug` | log-level for component `config-sync` | value from `icingadb_logging_level`, `info` by default |
-| `icingadb_log_level_database` | `fatal\|error\|warn\|info\|debug` | log-level for component `database` | value from `icingadb_logging_level`, `info` by default |
-| `icingadb_log_level_dumps_ignals` | `fatal\|error\|warn\|info\|debug` | log-level for component `dump-signals` | value from `icingadb_logging_level`, `info` by default |
-| `icingadb_log_level_confic_sync` | `fatal\|error\|warn\|info\|debug` | log-level for component `heartbeat` | value from `icingadb_logging_level`, `info` by default |
-| `icingadb_log_level_high_availability` | `fatal\|error\|warn\|info\|debug` | log-level for component `high-availability` | value from `icingadb_logging_level`, `info` by default |
-| `icingadb_log_level_history_sync` | `fatal\|error\|warn\|info\|debug` | log-level for component `history-sync` | value from `icingadb_logging_level`, `info` by default |
-| `icingadb_log_level_overdue_sync` | `fatal\|error\|warn\|info\|debug` | log-level for component `overdue-sync` | value from `icingadb_logging_level`, `info` by default |
-| `icingadb_log_level_redis` | `fatal\|error\|warn\|info\|debug` | log-level for component `redis` | value from `icingadb_logging_level`, `info` by default |
-| `icingadb_log_level_retention` | `fatal\|error\|warn\|info\|debug` | log-level for component `retention` | value from `icingadb_logging_level`, `info` by default |
-| `icingadb_log_level_runtime_updates` | `fatal\|error\|warn\|info\|debug` | log-level for component `runtime-updates` | value from `icingadb_logging_level`, `info` by default |
-| `icingadb_log_level_telemetry` | `fatal\|error\|warn\|info\|debug` | log-level for component `telemetry` | value from `icingadb_logging_level`, `info` by default |
+| Variable | Type | Description | Default |
+| --- | --- | --- | --- |
+| `icingadb_log_level_confic_sync` | `fatal\|error\|warn\|info\|debug` | log-level for component `config-sync` | value from `icingadb_logging_level`, `info` by default |
+| `icingadb_log_level_database` | `fatal\|error\|warn\|info\|debug` | log-level for component `database` | value from `icingadb_logging_level`, `info` by default |
+| `icingadb_log_level_dumps_ignals` | `fatal\|error\|warn\|info\|debug` | log-level for component `dump-signals` | value from `icingadb_logging_level`, `info` by default |
+| `icingadb_log_level_confic_sync` | `fatal\|error\|warn\|info\|debug` | log-level for component `heartbeat` | value from `icingadb_logging_level`, `info` by default |
+| `icingadb_log_level_high_availability` | `fatal\|error\|warn\|info\|debug` | log-level for component `high-availability` | value from `icingadb_logging_level`, `info` by default |
+| `icingadb_log_level_history_sync` | `fatal\|error\|warn\|info\|debug` | log-level for component `history-sync` | value from `icingadb_logging_level`, `info` by default |
+| `icingadb_log_level_overdue_sync` | `fatal\|error\|warn\|info\|debug` | log-level for component `overdue-sync` | value from `icingadb_logging_level`, `info` by default |
+| `icingadb_log_level_redis` | `fatal\|error\|warn\|info\|debug` | log-level for component `redis` | value from `icingadb_logging_level`, `info` by default |
+| `icingadb_log_level_retention` | `fatal\|error\|warn\|info\|debug` | log-level for component `retention` | value from `icingadb_logging_level`, `info` by default |
+| `icingadb_log_level_runtime_updates` | `fatal\|error\|warn\|info\|debug` | log-level for component `runtime-updates` | value from `icingadb_logging_level`, `info` by default |
+| `icingadb_log_level_telemetry` | `fatal\|error\|warn\|info\|debug` | log-level for component `telemetry` | value from `icingadb_logging_level`, `info` by default |
### IcingaDB Retention
@@ -114,7 +114,7 @@ This play installs IcingaDB with on the same host as its connected MysQL databas
icingadb_database_type: mysql # needed by the schema import
roles:
- - role: icinga.icinga.icingadb
+ - role: netways.icinga.icingadb
```
This more complex example installs IcingaDB and connects it to a **remote** PostgreSQL database, using client certificates and TLS. It also imports the schema into the database. Redis is installed locally.
@@ -135,5 +135,5 @@ This more complex example installs IcingaDB and connects it to a **remote** Post
icingadb_database_import_schema: true
roles:
- - role: icinga.icinga.icingadb
+ - role: netways.icinga.icingadb
```
diff --git a/roles/icingadb/templates/icingadb.ini.j2 b/roles/icingadb/templates/icingadb.ini.j2
index 939f90c..f2cb408 100644
--- a/roles/icingadb/templates/icingadb.ini.j2
+++ b/roles/icingadb/templates/icingadb.ini.j2
@@ -30,7 +30,9 @@ database:
redis:
host: {{ icingadb_redis_host }}
-{% if icingadb_redis_port is defined %}
+{% if icingadb_redis_tls is defined %}
+ port: {{ icingadb_redis_tls_port | default(icingadb_redis_port) }}
+{% else %}
port: {{ icingadb_redis_port }}
{% endif %}
{% if icingadb_redis_password is defined %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make it possible to define component based log levels for icingadb.