From d60d916c3a493b7b25b125143bd03da9d79b96b0 Mon Sep 17 00:00:00 2001 From: Bodo Schulz Date: Sat, 2 Jul 2022 19:00:58 +0200 Subject: [PATCH] release - fix mariadb config - fix change configuration parameters - update README - remove redhat based from test matrix --- .github/workflows/main.yml | 101 ++++++++++---------- README.md | 17 ++-- molecule/default/group_vars/all/mariadb.yml | 4 + molecule/default/group_vars/all/vars.yml | 35 +++---- molecule/default/requirements.yml | 10 +- tasks/prepare.yml | 8 +- templates/etc/apt/icingadb.list.j2 | 2 +- templates/etc/icingadb/config.yml.j2 | 21 ++-- vars/main.yml | 7 +- 9 files changed, 105 insertions(+), 100 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7718902..47caea3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -133,63 +133,62 @@ jobs: ANSIBLE_FORCE_COLOR: '1' DISTRIBUTION: ${{ matrix.image }} - rpm: - name: "${{ matrix.image }} / python: ${{ matrix.python-version }}, ansible: ${{ matrix.ansible-version }}" - needs: - - lint - runs-on: ubuntu-18.04 - strategy: - fail-fast: false - matrix: - image: - - oraclelinux:8 - - rockylinux:8 - - almalinux:8 - python-version: - - '3.9' - ansible-version: - - '4.1.0' - - '5.1.0' - - steps: - - name: check out the codebase. - uses: actions/checkout@v2 - with: - path: 'ansible-icingadb' - - - name: set up python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - - name: install dependencies - run: | - python -m pip install --upgrade pip - pip install -r test-requirements.txt - - # See: https://github.com/geerlingguy/ansible-role-mysql/issues/422 - - name: Disable AppArmor - run: | - set -x - sudo apt-get install apparmor-profiles - sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/ - sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld - - - name: test with tox - run: | - tox -e py$(printf "${{ matrix.python-version }}" | tr -d '.')-ansible$(printf "${{ matrix.ansible-version }}" | tr -d '.') -- \ - molecule test - env: - PY_COLORS: '1' - ANSIBLE_FORCE_COLOR: '1' - DISTRIBUTION: ${{ matrix.image }} + # rpm: + # name: "${{ matrix.image }} / python: ${{ matrix.python-version }}, ansible: ${{ matrix.ansible-version }}" + # needs: + # - lint + # runs-on: ubuntu-18.04 + # strategy: + # fail-fast: false + # matrix: + # image: + # - oraclelinux:8 + # - rockylinux:8 + # - almalinux:8 + # python-version: + # - '3.9' + # ansible-version: + # - '4.1.0' + # - '5.1.0' + # + # steps: + # - name: check out the codebase. + # uses: actions/checkout@v2 + # with: + # path: 'ansible-icingadb' + # + # - name: set up python ${{ matrix.python-version }} + # uses: actions/setup-python@v2 + # with: + # python-version: ${{ matrix.python-version }} + # + # - name: install dependencies + # run: | + # python -m pip install --upgrade pip + # pip install -r test-requirements.txt + # + # # See: https://github.com/geerlingguy/ansible-role-mysql/issues/422 + # - name: Disable AppArmor + # run: | + # set -x + # sudo apt-get install apparmor-profiles + # sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/ + # sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld + # + # - name: test with tox + # run: | + # tox -e py$(printf "${{ matrix.python-version }}" | tr -d '.')-ansible$(printf "${{ matrix.ansible-version }}" | tr -d '.') -- \ + # molecule test + # env: + # PY_COLORS: '1' + # ANSIBLE_FORCE_COLOR: '1' + # DISTRIBUTION: ${{ matrix.image }} publish: if: github.ref == 'refs/heads/main' needs: - arch - deb - - rpm runs-on: ubuntu-18.04 steps: - name: galaxy diff --git a/README.md b/README.md index 16ec3a5..7844de9 100644 --- a/README.md +++ b/README.md @@ -24,10 +24,6 @@ This role will fully configure and install [icingadb](https://icinga.com/docs/ic * Debian based - Debian 10 / 11 - Ubuntu 20.04 -* RedHat based - - Alma Linux 8 - - Rocky Linux 8 - - OracleLinux 8 ## usage @@ -55,8 +51,9 @@ icingadb_database: ```yaml -icingadb_defaults_redis: - address: 127.0.0.1:6379 +icingadb_redis: + host: 127.0.0.1 + port: 6379 ``` ### `icingadb_logging` @@ -117,6 +114,8 @@ history tables used to display history information in the web interface and SLA minimal information required for SLA reporting, allowing to keep this information for longer with a smaller storage footprint. +All parameters are given in days, e.g. `120` + #### `history-days` **Optional** @@ -130,15 +129,15 @@ Use options in order to enable retention only for specific categories or to over **Optional** -Number of days to retain historical data for SLA reporting. +*Number of days* to retain historical data for SLA reporting. #### `options` **Optional** -Map of history category to number of days to retain its data. +Map of history category to *number of days* to retain its data. -Available categories are acknowledgement, comment, downtime, flapping, notification, sla and state. +Available categories are `acknowledgement`, `comment`, `downtime`, `flapping`, `notification` and `state`. ```yaml diff --git a/molecule/default/group_vars/all/mariadb.yml b/molecule/default/group_vars/all/mariadb.yml index ba41f93..95ee2d2 100644 --- a/molecule/default/group_vars/all/mariadb.yml +++ b/molecule/default/group_vars/all/mariadb.yml @@ -22,5 +22,9 @@ mariadb_config_mysqld: performance_schema: 1 expire_logs_days: 2 max_connections: 20 + # fixes + # 'You do not have the SUPER privilege and binary logging is enabled + # (you *might* want to use the less safe log_bin_trust_function_creators variable)' + log_bin_trust_function_creators: "1" ... diff --git a/molecule/default/group_vars/all/vars.yml b/molecule/default/group_vars/all/vars.yml index 30ffa02..ca6bb7c 100644 --- a/molecule/default/group_vars/all/vars.yml +++ b/molecule/default/group_vars/all/vars.yml @@ -8,28 +8,29 @@ icingadb_database: password: icingadb icingadb_redis: - address: "127.0.0.1:{{ redis_network_port }}" + host: 127.0.0.1 + port: "{{ redis_network_port }}" icingadb_logging: level: debug - interval: "20s" - options: - database: debug - redis: debug - heartbeat: fatal - high-availability: fatal - config-sync: fatal - history-sync: fatal - runtime-updates: fatal - overdue-sync: fatal - dump-signals: fatal + interval: "3s" + # options: + # database: debug + # redis: debug + # heartbeat: debug + # high-availability: debug + # config-sync: debug + # history-sync: debug + # runtime-updates: debug + # overdue-sync: debug + # dump-signals: debug icingadb_retention: - history_days: "90d" - sla_days: "90d" + history_days: 90 + sla_days: 90 options: - acknowledgement: "10d" - comment: "10d" - downtime: "5d" + acknowledgement: 10 + comment: 10 + downtime: 5 ... diff --git a/molecule/default/requirements.yml b/molecule/default/requirements.yml index 7fcfb0a..6c01b82 100644 --- a/molecule/default/requirements.yml +++ b/molecule/default/requirements.yml @@ -3,25 +3,25 @@ - name: snapd src: https://github.com/bodsch/ansible-snapd.git scm: git - version: 1.1.0 + version: 1.1.2 - name: apparmor src: https://github.com/bodsch/ansible-apparmor.git scm: git - version: 1.0.0 + version: 1.0.1 - name: monitoring-tools src: https://github.com/bodsch/ansible-monitoring-plugins.git - version: 1.3.5 + version: 1.3.7 - name: mariadb src: https://github.com/bodsch/ansible-mariadb.git scm: git - # version: 2.2.8 + version: 2.2.11 - name: redis src: https://github.com/bodsch/ansible-redis.git scm: git - version: 1.1.0 + version: 1.1.1 ... diff --git a/tasks/prepare.yml b/tasks/prepare.yml index 2e55809..bb37c78 100644 --- a/tasks/prepare.yml +++ b/tasks/prepare.yml @@ -116,12 +116,12 @@ key: https://packages.icinga.com/icinga.key state: present - - name: install icinga testing repository + - name: install icinga release repository yum_repository: - name: icinga-testing-build + name: icinga-stable-release state: present - description: ICINGA (testing builds for epel) - baseurl: https://packages.icinga.com/epel/$releasever/testing/ + description: ICINGA + baseurl: https://packages.icinga.com/epel/$releasever/release/ gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ICINGA gpgcheck: 1 enabled: 1 diff --git a/templates/etc/apt/icingadb.list.j2 b/templates/etc/apt/icingadb.list.j2 index be69e29..04f1f89 100644 --- a/templates/etc/apt/icingadb.list.j2 +++ b/templates/etc/apt/icingadb.list.j2 @@ -1,6 +1,6 @@ {{ ansible_managed | comment }} -deb https://packages.icinga.com/{{ ansible_distribution | lower }} icinga-{{ ansible_distribution_release | lower }}-testing main +deb https://packages.icinga.com/{{ ansible_distribution | lower }} icinga-{{ ansible_distribution_release | lower }} main {% if ansible_distribution_major_version | int == 9 %} # debian 9 needs backports deb http://deb.debian.org/debian stretch-backports main diff --git a/templates/etc/icingadb/config.yml.j2 b/templates/etc/icingadb/config.yml.j2 index 52c3936..6c9045a 100644 --- a/templates/etc/icingadb/config.yml.j2 +++ b/templates/etc/icingadb/config.yml.j2 @@ -11,7 +11,8 @@ database: password: {{ icingadb_database.password }} redis: - address: {{ icingadb_redis.address }} + host: {{ icingadb_redis.host }} + port: {{ icingadb_redis.port | default('6379') }} logging: {% if icingadb_logging.level in _valid_loglevel %} @@ -76,38 +77,38 @@ logging: retention: {% if icingadb_retention.history_days is defined and - icingadb_retention.history_days | default('') | length > 0 %} + icingadb_retention.history_days | default('0') | int > 0 %} history-days: {{ icingadb_retention.history_days }} {% endif %} {% if icingadb_retention.sla_days is defined and - icingadb_retention.sla_days | default('') | length > 0 %} + icingadb_retention.sla_days | default('0') | int > 0 %} sla-days: {{ icingadb_retention.sla_days }} {% endif %} {% if icingadb_retention.options is defined and - icingadb_retention.options | default('') | length > 0 %} + icingadb_retention.options | count > 0 %} options: {% if icingadb_retention.options.acknowledgement is defined and - icingadb_retention.options.acknowledgement | default('') | length > 0 %} + icingadb_retention.options.acknowledgement | default('0') | int > 0 %} acknowledgement: {{ icingadb_retention.options.acknowledgement }} {% endif %} {% if icingadb_retention.options.comment is defined and - icingadb_retention.options.comment | default('') | length > 0 %} + icingadb_retention.options.comment | default('0') | int > 0 %} comment: {{ icingadb_retention.options.comment }} {% endif %} {% if icingadb_retention.options.downtime is defined and - icingadb_retention.options.downtime | default('') | length > 0 %} + icingadb_retention.options.downtime | default('0') | int > 0 %} downtime: {{ icingadb_retention.options.downtime }} {% endif %} {% if icingadb_retention.options.flapping is defined and - icingadb_retention.options.flapping | default('') | length > 0 %} + icingadb_retention.options.flapping | default('0') | int > 0 %} flapping: {{ icingadb_retention.options.flapping }} {% endif %} {% if icingadb_retention.options.notification is defined and - icingadb_retention.options.notification | default('') | length > 0 %} + icingadb_retention.options.notification | default('0') | int > 0 %} notification: {{ icingadb_retention.options.notification }} {% endif %} {% if icingadb_retention.options.state is defined and - icingadb_retention.options.state | default('') | length > 0 %} + icingadb_retention.options.state | default('0') | int > 0 %} state: {{ icingadb_retention.options.state }} {% endif %} {% endif %} diff --git a/vars/main.yml b/vars/main.yml index ae45a2c..ea8ebd5 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -11,14 +11,15 @@ icingadb_installed: false icingadb_install_dir: /usr/share/icingadb icingadb_defaults_database: - host: localhost + host: 127.0.0.1 port: 3306 database: icingadb user: icingadb password: icingadb icingadb_defaults_redis: - address: localhost:6380 + host: 127.0.0.1 + port: 6379 icingadb_defaults_logging: level: info @@ -36,7 +37,7 @@ icingadb_defaults_logging: dump_signals: fatal icingadb_defaults_retention: - history_days: "10d" + history_days: "" sla_days: "" options: acknowledgement: ""