diff --git a/.ansible-lint b/.ansible-lint index 94dc18de7..426ba1149 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -9,6 +9,7 @@ exclude_paths: - .vagrant/ - changelogs/ - docs/ + # parseable: true # quiet: true # verbosity: 1 diff --git a/.github/workflows/ans-int-test-activation.yaml b/.github/workflows/ans-int-test-activation.yaml index 82901406c..c0dc91265 100644 --- a/.github/workflows/ans-int-test-activation.yaml +++ b/.github/workflows/ans-int-test-activation.yaml @@ -10,6 +10,11 @@ env: COLLECTION_NAME: general MODULE_NAME: activation +# https://stackoverflow.com/questions/70928424/limit-github-action-workflow-concurrency-on-push-and-pull-request +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + name: Ansible Integration Tests for Activation Module on: workflow_dispatch: @@ -39,15 +44,12 @@ jobs: - stable-2.17 - devel python: - - '3.8' - '3.9' - '3.10' - '3.11' - '3.12' exclude: # Exclude unsupported sets. - - ansible: stable-2.14 - python: '3.12' - ansible: stable-2.15 python: '3.12' @@ -72,5 +74,5 @@ jobs: CHECKMK_DOWNLOAD_PW: ${{ secrets.CHECKMK_DOWNLOAD_PW }} - name: Run integration test - run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker + run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker default working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} diff --git a/.github/workflows/ans-int-test-bakery.yaml b/.github/workflows/ans-int-test-bakery.yaml index 4462f503e..a9151f67f 100644 --- a/.github/workflows/ans-int-test-bakery.yaml +++ b/.github/workflows/ans-int-test-bakery.yaml @@ -10,6 +10,10 @@ env: COLLECTION_NAME: general MODULE_NAME: bakery +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + name: Ansible Integration Tests for Bakery Module on: workflow_dispatch: @@ -39,15 +43,12 @@ jobs: - stable-2.17 - devel python: - - '3.8' - '3.9' - '3.10' - '3.11' - '3.12' exclude: # Exclude unsupported sets. - - ansible: stable-2.14 - python: '3.12' - ansible: stable-2.15 python: '3.12' @@ -72,5 +73,5 @@ jobs: CHECKMK_DOWNLOAD_PW: ${{ secrets.CHECKMK_DOWNLOAD_PW }} - name: Run integration test - run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker + run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker default working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} diff --git a/.github/workflows/ans-int-test-contact_group.yaml b/.github/workflows/ans-int-test-contact_group.yaml index 42ae1bc33..d1227d3ba 100644 --- a/.github/workflows/ans-int-test-contact_group.yaml +++ b/.github/workflows/ans-int-test-contact_group.yaml @@ -10,6 +10,10 @@ env: COLLECTION_NAME: general MODULE_NAME: contact_group +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + name: Ansible Integration Tests for Contact Group Module on: workflow_dispatch: @@ -39,15 +43,12 @@ jobs: - stable-2.17 - devel python: - - '3.8' - '3.9' - '3.10' - '3.11' - '3.12' exclude: # Exclude unsupported sets. - - ansible: stable-2.14 - python: '3.12' - ansible: stable-2.15 python: '3.12' @@ -72,5 +73,5 @@ jobs: CHECKMK_DOWNLOAD_PW: ${{ secrets.CHECKMK_DOWNLOAD_PW }} - name: Run integration test - run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker + run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker default working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} diff --git a/.github/workflows/ans-int-test-discovery.yaml b/.github/workflows/ans-int-test-discovery.yaml index a41d68387..609cadf03 100644 --- a/.github/workflows/ans-int-test-discovery.yaml +++ b/.github/workflows/ans-int-test-discovery.yaml @@ -10,6 +10,10 @@ env: COLLECTION_NAME: general MODULE_NAME: discovery +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + name: Ansible Integration Tests for Discovery Module on: workflow_dispatch: @@ -39,15 +43,12 @@ jobs: - stable-2.17 - devel python: - - '3.8' - '3.9' - '3.10' - '3.11' - '3.12' exclude: # Exclude unsupported sets. - - ansible: stable-2.14 - python: '3.12' - ansible: stable-2.15 python: '3.12' @@ -72,5 +73,5 @@ jobs: CHECKMK_DOWNLOAD_PW: ${{ secrets.CHECKMK_DOWNLOAD_PW }} - name: Run integration test - run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker + run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker default working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} diff --git a/.github/workflows/ans-int-test-downtime.yaml b/.github/workflows/ans-int-test-downtime.yaml index 2f21e600a..eeafbe5a3 100644 --- a/.github/workflows/ans-int-test-downtime.yaml +++ b/.github/workflows/ans-int-test-downtime.yaml @@ -10,6 +10,10 @@ env: COLLECTION_NAME: general MODULE_NAME: downtime +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + name: Ansible Integration Tests for Downtime Module on: workflow_dispatch: @@ -39,15 +43,12 @@ jobs: - stable-2.17 - devel python: - - '3.8' - '3.9' - '3.10' - '3.11' - '3.12' exclude: # Exclude unsupported sets. - - ansible: stable-2.14 - python: '3.12' - ansible: stable-2.15 python: '3.12' @@ -72,5 +73,5 @@ jobs: CHECKMK_DOWNLOAD_PW: ${{ secrets.CHECKMK_DOWNLOAD_PW }} - name: Run integration test - run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker + run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker default working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} diff --git a/.github/workflows/ans-int-test-folder.yaml b/.github/workflows/ans-int-test-folder.yaml index b1e1fa3b8..6bedab035 100644 --- a/.github/workflows/ans-int-test-folder.yaml +++ b/.github/workflows/ans-int-test-folder.yaml @@ -10,6 +10,10 @@ env: COLLECTION_NAME: general MODULE_NAME: folder +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + name: Ansible Integration Tests for Folder Module on: workflow_dispatch: @@ -39,15 +43,12 @@ jobs: - stable-2.17 - devel python: - - '3.8' - '3.9' - '3.10' - '3.11' - '3.12' exclude: # Exclude unsupported sets. - - ansible: stable-2.14 - python: '3.12' - ansible: stable-2.15 python: '3.12' @@ -72,5 +73,5 @@ jobs: CHECKMK_DOWNLOAD_PW: ${{ secrets.CHECKMK_DOWNLOAD_PW }} - name: Run integration test - run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker + run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker default working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} diff --git a/.github/workflows/ans-int-test-host.yaml b/.github/workflows/ans-int-test-host.yaml index 692195e45..d64921454 100644 --- a/.github/workflows/ans-int-test-host.yaml +++ b/.github/workflows/ans-int-test-host.yaml @@ -10,6 +10,10 @@ env: COLLECTION_NAME: general MODULE_NAME: host +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + name: Ansible Integration Tests for Host Module on: workflow_dispatch: @@ -39,15 +43,12 @@ jobs: - stable-2.17 - devel python: - - '3.8' - '3.9' - '3.10' - '3.11' - '3.12' exclude: # Exclude unsupported sets. - - ansible: stable-2.14 - python: '3.12' - ansible: stable-2.15 python: '3.12' @@ -72,5 +73,5 @@ jobs: CHECKMK_DOWNLOAD_PW: ${{ secrets.CHECKMK_DOWNLOAD_PW }} - name: Run integration test - run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker + run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker default working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} diff --git a/.github/workflows/ans-int-test-host_group.yaml b/.github/workflows/ans-int-test-host_group.yaml index 59964b3fe..98b3ee54f 100644 --- a/.github/workflows/ans-int-test-host_group.yaml +++ b/.github/workflows/ans-int-test-host_group.yaml @@ -10,6 +10,10 @@ env: COLLECTION_NAME: general MODULE_NAME: host_group +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + name: Ansible Integration Tests for Host Group Module on: workflow_dispatch: @@ -39,15 +43,12 @@ jobs: - stable-2.17 - devel python: - - '3.8' - '3.9' - '3.10' - '3.11' - '3.12' exclude: # Exclude unsupported sets. - - ansible: stable-2.14 - python: '3.12' - ansible: stable-2.15 python: '3.12' @@ -72,5 +73,5 @@ jobs: CHECKMK_DOWNLOAD_PW: ${{ secrets.CHECKMK_DOWNLOAD_PW }} - name: Run integration test - run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker + run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker default working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} diff --git a/.github/workflows/ans-int-test-lkp-bakery.yaml b/.github/workflows/ans-int-test-lkp-bakery.yaml index b11451ef5..25886b102 100644 --- a/.github/workflows/ans-int-test-lkp-bakery.yaml +++ b/.github/workflows/ans-int-test-lkp-bakery.yaml @@ -10,6 +10,10 @@ env: COLLECTION_NAME: general MODULE_NAME: lookup_bakery +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + name: Ansible Integration Tests for Bakery Lookup Module on: workflow_dispatch: @@ -39,15 +43,12 @@ jobs: - stable-2.17 - devel python: - - '3.8' - '3.9' - '3.10' - '3.11' - '3.12' exclude: # Exclude unsupported sets. - - ansible: stable-2.14 - python: '3.12' - ansible: stable-2.15 python: '3.12' @@ -72,5 +73,5 @@ jobs: CHECKMK_DOWNLOAD_PW: ${{ secrets.CHECKMK_DOWNLOAD_PW }} - name: Run integration test - run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker + run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker default working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} diff --git a/.github/workflows/ans-int-test-lkp-folder.yaml b/.github/workflows/ans-int-test-lkp-folder.yaml index 853f58ab4..f8831f6a8 100644 --- a/.github/workflows/ans-int-test-lkp-folder.yaml +++ b/.github/workflows/ans-int-test-lkp-folder.yaml @@ -10,6 +10,10 @@ env: COLLECTION_NAME: general MODULE_NAME: lookup_folder +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + name: Ansible Integration Tests for Folder Lookup Module on: workflow_dispatch: @@ -37,15 +41,12 @@ jobs: - stable-2.17 - devel python: - - '3.8' - '3.9' - '3.10' - '3.11' - '3.12' exclude: # Exclude unsupported sets. - - ansible: stable-2.14 - python: '3.12' - ansible: stable-2.15 python: '3.12' @@ -70,5 +71,5 @@ jobs: CHECKMK_DOWNLOAD_PW: ${{ secrets.CHECKMK_DOWNLOAD_PW }} - name: Run integration test - run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker + run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker default working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} diff --git a/.github/workflows/ans-int-test-lkp-folders.yaml b/.github/workflows/ans-int-test-lkp-folders.yaml index 84d72b14b..95b75cf14 100644 --- a/.github/workflows/ans-int-test-lkp-folders.yaml +++ b/.github/workflows/ans-int-test-lkp-folders.yaml @@ -10,6 +10,10 @@ env: COLLECTION_NAME: general MODULE_NAME: lookup_folders +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + name: Ansible Integration Tests for Folders Lookup Module on: workflow_dispatch: @@ -37,15 +41,12 @@ jobs: - stable-2.17 - devel python: - - '3.8' - '3.9' - '3.10' - '3.11' - '3.12' exclude: # Exclude unsupported sets. - - ansible: stable-2.14 - python: '3.12' - ansible: stable-2.15 python: '3.12' @@ -70,5 +71,5 @@ jobs: CHECKMK_DOWNLOAD_PW: ${{ secrets.CHECKMK_DOWNLOAD_PW }} - name: Run integration test - run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker + run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker default working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} diff --git a/.github/workflows/ans-int-test-lkp-host.yaml b/.github/workflows/ans-int-test-lkp-host.yaml index c9be5906e..1693f0157 100644 --- a/.github/workflows/ans-int-test-lkp-host.yaml +++ b/.github/workflows/ans-int-test-lkp-host.yaml @@ -10,6 +10,10 @@ env: COLLECTION_NAME: general MODULE_NAME: lookup_host +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + name: Ansible Integration Tests for Host Lookup Module on: workflow_dispatch: @@ -37,15 +41,12 @@ jobs: - stable-2.17 - devel python: - - '3.8' - '3.9' - '3.10' - '3.11' - '3.12' exclude: # Exclude unsupported sets. - - ansible: stable-2.14 - python: '3.12' - ansible: stable-2.15 python: '3.12' @@ -70,5 +71,5 @@ jobs: CHECKMK_DOWNLOAD_PW: ${{ secrets.CHECKMK_DOWNLOAD_PW }} - name: Run integration test - run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker + run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker default working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} diff --git a/.github/workflows/ans-int-test-lkp-hosts.yaml b/.github/workflows/ans-int-test-lkp-hosts.yaml index f006f4655..9ad9f9be5 100644 --- a/.github/workflows/ans-int-test-lkp-hosts.yaml +++ b/.github/workflows/ans-int-test-lkp-hosts.yaml @@ -10,6 +10,10 @@ env: COLLECTION_NAME: general MODULE_NAME: lookup_hosts +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + name: Ansible Integration Tests for Hosts Lookup Module on: workflow_dispatch: @@ -37,15 +41,12 @@ jobs: - stable-2.17 - devel python: - - '3.8' - '3.9' - '3.10' - '3.11' - '3.12' exclude: # Exclude unsupported sets. - - ansible: stable-2.14 - python: '3.12' - ansible: stable-2.15 python: '3.12' @@ -70,5 +71,5 @@ jobs: CHECKMK_DOWNLOAD_PW: ${{ secrets.CHECKMK_DOWNLOAD_PW }} - name: Run integration test - run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker + run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker default working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} diff --git a/.github/workflows/ans-int-test-lkp-rules.yaml b/.github/workflows/ans-int-test-lkp-rules.yaml index ff6ff9292..7556c7c98 100644 --- a/.github/workflows/ans-int-test-lkp-rules.yaml +++ b/.github/workflows/ans-int-test-lkp-rules.yaml @@ -10,6 +10,10 @@ env: COLLECTION_NAME: general MODULE_NAME: lookup_rules +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + name: Ansible Integration Tests for Rule Lookup Modules on: workflow_dispatch: @@ -39,15 +43,12 @@ jobs: - stable-2.17 - devel python: - - '3.8' - '3.9' - '3.10' - '3.11' - '3.12' exclude: # Exclude unsupported sets. - - ansible: stable-2.14 - python: '3.12' - ansible: stable-2.15 python: '3.12' @@ -72,5 +73,5 @@ jobs: CHECKMK_DOWNLOAD_PW: ${{ secrets.CHECKMK_DOWNLOAD_PW }} - name: Run integration test - run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker + run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker default working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} diff --git a/.github/workflows/ans-int-test-lkp-rulesets.yaml b/.github/workflows/ans-int-test-lkp-rulesets.yaml index a92a54673..8a2936874 100644 --- a/.github/workflows/ans-int-test-lkp-rulesets.yaml +++ b/.github/workflows/ans-int-test-lkp-rulesets.yaml @@ -10,6 +10,10 @@ env: COLLECTION_NAME: general MODULE_NAME: lookup_rulesets +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + name: Ansible Integration Tests for Ruleset Lookup Modules on: workflow_dispatch: @@ -39,15 +43,12 @@ jobs: - stable-2.17 - devel python: - - '3.8' - '3.9' - '3.10' - '3.11' - '3.12' exclude: # Exclude unsupported sets. - - ansible: stable-2.14 - python: '3.12' - ansible: stable-2.15 python: '3.12' @@ -72,5 +73,5 @@ jobs: CHECKMK_DOWNLOAD_PW: ${{ secrets.CHECKMK_DOWNLOAD_PW }} - name: Run integration test - run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker + run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker default working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} diff --git a/.github/workflows/ans-int-test-lkp-version.yaml b/.github/workflows/ans-int-test-lkp-version.yaml index d1ffc2bbf..d16579afb 100644 --- a/.github/workflows/ans-int-test-lkp-version.yaml +++ b/.github/workflows/ans-int-test-lkp-version.yaml @@ -10,6 +10,10 @@ env: COLLECTION_NAME: general MODULE_NAME: lookup_version +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + name: Ansible Integration Tests for Version Lookup Module on: workflow_dispatch: @@ -39,15 +43,12 @@ jobs: - stable-2.17 - devel python: - - '3.8' - '3.9' - '3.10' - '3.11' - '3.12' exclude: # Exclude unsupported sets. - - ansible: stable-2.14 - python: '3.12' - ansible: stable-2.15 python: '3.12' @@ -72,5 +73,5 @@ jobs: CHECKMK_DOWNLOAD_PW: ${{ secrets.CHECKMK_DOWNLOAD_PW }} - name: Run integration test - run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker + run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker default working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} diff --git a/.github/workflows/ans-int-test-password.yaml b/.github/workflows/ans-int-test-password.yaml index e3082c511..3db9d308b 100644 --- a/.github/workflows/ans-int-test-password.yaml +++ b/.github/workflows/ans-int-test-password.yaml @@ -10,6 +10,10 @@ env: COLLECTION_NAME: general MODULE_NAME: password +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + name: Ansible Integration Tests for Password Module on: workflow_dispatch: @@ -39,15 +43,12 @@ jobs: - stable-2.17 - devel python: - - '3.8' - '3.9' - '3.10' - '3.11' - '3.12' exclude: # Exclude unsupported sets. - - ansible: stable-2.14 - python: '3.12' - ansible: stable-2.15 python: '3.12' @@ -72,5 +73,5 @@ jobs: CHECKMK_DOWNLOAD_PW: ${{ secrets.CHECKMK_DOWNLOAD_PW }} - name: Run integration test - run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker + run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker default working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} diff --git a/.github/workflows/ans-int-test-rule.yaml b/.github/workflows/ans-int-test-rule.yaml index 429a9b2f4..17275b760 100644 --- a/.github/workflows/ans-int-test-rule.yaml +++ b/.github/workflows/ans-int-test-rule.yaml @@ -10,6 +10,10 @@ env: COLLECTION_NAME: general MODULE_NAME: rule +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + name: Ansible Integration Tests for Rule Module on: workflow_dispatch: @@ -39,15 +43,12 @@ jobs: - stable-2.17 - devel python: - - '3.8' - '3.9' - '3.10' - '3.11' - '3.12' exclude: # Exclude unsupported sets. - - ansible: stable-2.14 - python: '3.12' - ansible: stable-2.15 python: '3.12' @@ -72,5 +73,5 @@ jobs: CHECKMK_DOWNLOAD_PW: ${{ secrets.CHECKMK_DOWNLOAD_PW }} - name: Run integration test - run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker + run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker default working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} diff --git a/.github/workflows/ans-int-test-service_group.yaml b/.github/workflows/ans-int-test-service_group.yaml index 52d4b214e..1db6e05ec 100644 --- a/.github/workflows/ans-int-test-service_group.yaml +++ b/.github/workflows/ans-int-test-service_group.yaml @@ -10,6 +10,10 @@ env: COLLECTION_NAME: general MODULE_NAME: service_group +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + name: Ansible Integration Tests for Service Group Module on: workflow_dispatch: @@ -39,15 +43,12 @@ jobs: - stable-2.17 - devel python: - - '3.8' - '3.9' - '3.10' - '3.11' - '3.12' exclude: # Exclude unsupported sets. - - ansible: stable-2.14 - python: '3.12' - ansible: stable-2.15 python: '3.12' @@ -72,5 +73,5 @@ jobs: CHECKMK_DOWNLOAD_PW: ${{ secrets.CHECKMK_DOWNLOAD_PW }} - name: Run integration test - run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker + run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker default working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} diff --git a/.github/workflows/ans-int-test-tag_group.yaml b/.github/workflows/ans-int-test-tag_group.yaml index 22f7c0a23..37b7184a6 100644 --- a/.github/workflows/ans-int-test-tag_group.yaml +++ b/.github/workflows/ans-int-test-tag_group.yaml @@ -10,6 +10,10 @@ env: COLLECTION_NAME: general MODULE_NAME: tag_group +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + name: Ansible Integration Tests for Tag Group Module on: workflow_dispatch: @@ -39,15 +43,12 @@ jobs: - stable-2.17 - devel python: - - '3.8' - '3.9' - '3.10' - '3.11' - '3.12' exclude: # Exclude unsupported sets. - - ansible: stable-2.14 - python: '3.12' - ansible: stable-2.15 python: '3.12' @@ -72,5 +73,5 @@ jobs: CHECKMK_DOWNLOAD_PW: ${{ secrets.CHECKMK_DOWNLOAD_PW }} - name: Run integration test - run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker + run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker default working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} diff --git a/.github/workflows/ans-int-test-timeperiod.yaml b/.github/workflows/ans-int-test-timeperiod.yaml index 7a4b17086..f18f2a63d 100644 --- a/.github/workflows/ans-int-test-timeperiod.yaml +++ b/.github/workflows/ans-int-test-timeperiod.yaml @@ -10,6 +10,10 @@ env: COLLECTION_NAME: general MODULE_NAME: timeperiod +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + name: Ansible Integration Tests for Timeperiod Module on: workflow_dispatch: @@ -39,15 +43,12 @@ jobs: - stable-2.17 - devel python: - - '3.8' - '3.9' - '3.10' - '3.11' - '3.12' exclude: # Exclude unsupported sets. - - ansible: stable-2.14 - python: '3.12' - ansible: stable-2.15 python: '3.12' @@ -72,5 +73,5 @@ jobs: CHECKMK_DOWNLOAD_PW: ${{ secrets.CHECKMK_DOWNLOAD_PW }} - name: Run integration test - run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker + run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker default working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} diff --git a/.github/workflows/ans-int-test-user.yaml b/.github/workflows/ans-int-test-user.yaml index b351a3406..a758985ef 100644 --- a/.github/workflows/ans-int-test-user.yaml +++ b/.github/workflows/ans-int-test-user.yaml @@ -10,6 +10,10 @@ env: COLLECTION_NAME: general MODULE_NAME: user +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + name: Ansible Integration Tests for User Module on: workflow_dispatch: @@ -39,15 +43,12 @@ jobs: - stable-2.17 - devel python: - - '3.8' - '3.9' - '3.10' - '3.11' - '3.12' exclude: # Exclude unsupported sets. - - ansible: stable-2.14 - python: '3.12' - ansible: stable-2.15 python: '3.12' @@ -72,5 +73,5 @@ jobs: CHECKMK_DOWNLOAD_PW: ${{ secrets.CHECKMK_DOWNLOAD_PW }} - name: Run integration test - run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker + run: ansible-test integration ${{env.MODULE_NAME}} -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker default working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} diff --git a/.github/workflows/ansible-lint.yaml b/.github/workflows/ansible-lint.yaml index ac671c0c0..1d51054aa 100644 --- a/.github/workflows/ansible-lint.yaml +++ b/.github/workflows/ansible-lint.yaml @@ -33,7 +33,6 @@ jobs: fail-fast: false matrix: python: - - '3.8' - '3.9' - '3.10' - '3.11' diff --git a/.github/workflows/molecule-role-agent.yaml b/.github/workflows/molecule-role-agent.yaml index b6b28548b..5eff148ad 100644 --- a/.github/workflows/molecule-role-agent.yaml +++ b/.github/workflows/molecule-role-agent.yaml @@ -64,10 +64,6 @@ jobs: run: | python3 -m pip install --upgrade pip python3 -m pip install -r requirements.txt - # The following works around a incompatibility between Python requests and Docker. - # https://github.com/ansible-collections/community.docker/issues/860 - # Remove at a later point, when the updated community.docker is shipped. - ansible-galaxy collection install community.docker --force working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} - name: "Provide secrets file." diff --git a/.github/workflows/molecule-role-server.yaml b/.github/workflows/molecule-role-server.yaml index d9f33e507..8568ee7d7 100644 --- a/.github/workflows/molecule-role-server.yaml +++ b/.github/workflows/molecule-role-server.yaml @@ -64,10 +64,6 @@ jobs: run: | python3 -m pip install --upgrade pip python3 -m pip install -r requirements.txt - # The following works around a incompatibility between Python requests and Docker. - # https://github.com/ansible-collections/community.docker/issues/860 - # Remove at a later point, when the updated community.docker is shipped. - ansible-galaxy collection install community.docker --force working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} - name: "Provide secrets file." diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 141d5340b..921f86aa8 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -30,20 +30,20 @@ jobs: steps: - - name: Check out code + - name: "Checkout Code" uses: actions/checkout@v4 with: path: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} - - name: Set up Python + - name: "Set up Python" uses: actions/setup-python@v5 with: python-version: '3.11' - - name: Install ansible-base (${{ matrix.ansible }}) + - name: "Install ansible-base (${{ matrix.ansible }})" run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check - - name: Run sanity tests + - name: "Run Sanity Tests" run: ansible-test sanity --docker -v --color --coverage working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} @@ -57,19 +57,19 @@ jobs: # Prepare the environment. # - - name: Checkout code + - name: "Checkout Code" uses: actions/checkout@v4 - - name: Get current version + - name: "Get current Version" id: current_version run: echo "version=$(grep 'version:' galaxy.yml | cut -d ' ' -f 2)" >> $GITHUB_OUTPUT - - name: Set up Python + - name: "Set up Python" uses: actions/setup-python@v5 with: python-version: '3.11' - - name: Install Dependencies + - name: "Install Dependencies" run: | python -m pip install --upgrade pip if [ -f requirements.txt ]; then pip install -r requirements.txt; fi @@ -78,7 +78,7 @@ jobs: # First stage: Build and install collection to generate docs and changelogs. # - - name: Copy Files and Directories to Source + - name: "Copy Files and Directories to Source" run: | mkdir -p build/src cp $files build/src @@ -87,19 +87,30 @@ jobs: files: ${{env.FILES}} directories: ${{env.DIRS}} - - name: Build Ansible Collection + - name: "Build Ansible Collection" run: ansible-galaxy collection build build/src --force - - name: Install Ansible Collection + - name: "Install Ansible Collection" run: ansible-galaxy collection install --no-deps ./${{env.NAMESPACE}}-${{env.COLLECTION_NAME}}-${{ steps.current_version.outputs.version }}.tar.gz - - name: Compile Collection Changelog + - name: "Compile Collection Changelog" run: antsibull-changelog release - - name: Compile Collection Docs + # This is slightly hacky and we might need to adapt it later. + # But for now it looks promising. See the below link for documentation: + # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings + - name: "Record Changes for Release" + run: | + { + echo 'CHANGELOG_FRAGMENT<<EOF' + echo "$(git diff CHANGELOG.rst | grep '^+' | tail -n+4 | tr -d '+')" + echo 'EOF' + } >> $GITHUB_ENV + + - name: "Compile Collection Docs" run: antsibull-docs collection --use-current --squash-hierarchy --fail-on-error --dest-dir ./docs/ ${{env.NAMESPACE}}.${{env.COLLECTION_NAME}} - - name: Create Pull Request for docs and changelog against devel branch + - name: "Create Pull Request for Docs and Changelog against devel branch" uses: peter-evans/create-pull-request@v6 with: commit-message: Update Docs and Changelogs upon Release @@ -118,7 +129,7 @@ jobs: # Second stage: Build the final version of the collection and release it. # - - name: Copy Files and Directories to Source + - name: "Copy Files and Directories to Source" run: | mkdir -p build/src cp $files build/src @@ -128,10 +139,10 @@ jobs: files: ${{env.FILES}} directories: ${{env.DIRS}} - - name: Build Ansible Collection + - name: "Build Ansible Collection" run: ansible-galaxy collection build build/src --force - - name: Create Release and upload Assets + - name: "Create Release and upload Assets" id: create-release uses: softprops/action-gh-release@v2 with: @@ -146,7 +157,9 @@ jobs: For information about this collection and how to install it, refer to the [README](https://github.com/Checkmk/ansible-collection-checkmk.general/blob/main/README.md). + ${{env.CHANGELOG_FRAGMENT}} + For a detailed changelog, refer to the [CHANGELOG](https://github.com/Checkmk/ansible-collection-checkmk.general/blob/main/CHANGELOG.rst). - - name: Publish Ansible Collection to the Galaxy + - name: "Publish Ansible Collection to the Galaxy" run: ansible-galaxy collection publish ${{env.NAMESPACE}}-${{env.COLLECTION_NAME}}-${{ steps.current_version.outputs.version }}.tar.gz --api-key ${{ secrets.GALAXY_API_KEY }} diff --git a/.gitignore b/.gitignore index 765803282..b0cb459d1 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ playbooks/vars/config.yml playbooks/test*.yml playbooks/hosts playbooks/hosts.bak +venv/ Vagrantfile Vagrantfile.bak venv \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1906df002..6bfe54ae0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,7 +10,7 @@ See [Contributing to Ansible-maintained collections](https://docs.ansible.com/an ## A word of warning While we want the community to engage in developing this collection, please be -aware, that we have to ensure a certain level of quality and scope. +aware, that we want to ensure a certain level of quality and scope. Additionally, this is purely a side project of a few people, which means the time available is limited. We will try to be as transparent as possible about what we will include but please do not feel discouraged, if an idea @@ -49,7 +49,7 @@ After submitting a PR, follow the instructions to sign the [CLA](https://github. ### Changelog When changing this collection, please make sure to write a log of what you did. -To do so, create a `.yml` file in the folder `changelogs/fragments`. +To do so, create a `.yml` file in the folder `changelogs/fragments/`. The name does not matter, as the changelog is compiled of all fragments during build-time. For reference regarding the file format, take a look at the file `changelogs/template.yml`. @@ -94,7 +94,7 @@ The following are guidelines to keep in mind, when creating or changing roles an - `checkmk_server_foo` for a server role variable - `checkmk_agent_bar` for a agent role variable - `checkmk_var_bat` for general variables - - Do not prefix the variable with an underscore ( `_` ) + - Internal variables, not intended to be changed by a user should be prefixed with a double underscore (`__`). - Tags - When tagging roles or playbooks, separate single words with dashes (`my-custom-tag`) @@ -133,11 +133,11 @@ You can also run a subset by mentioning them as follows. See `tests/integration/ ### Molecule -To test our roles, we use [Molecule](https://www.jeffgeerling.com/blog/2018/testing-your-ansible-roles-molecule). It can be installed using the `requirements.txt`in this project or manually. The tests are crafted by the maintainers of this project to reflect real world scenarios a role would be used in. To run the tests, you need to navigate to the role directory and choose a scenario. At the time of writing those are named after the supported Checkmk versions: `2.1.0`and `2.2.0`. +To test our roles, we use [Molecule](https://www.jeffgeerling.com/blog/2018/testing-your-ansible-roles-molecule). It can be installed using the `requirements.txt`in this project or manually. The tests are crafted by the maintainers of this project to reflect real world scenarios a role would be used in. To run the tests, you need to navigate to the role directory and choose a scenario. At the time of writing those are named after the supported Checkmk versions: `2.2.0`and `2.3.0`. cd roles/server/ - molecule test -s 2.1.0 molecule test -s 2.2.0 + molecule test -s 2.3.0 ### Unit diff --git a/SUPPORT.md b/SUPPORT.md index 69c5e1e31..deae1ffb1 100644 --- a/SUPPORT.md +++ b/SUPPORT.md @@ -54,3 +54,4 @@ Collection Version | Checkmk Versions | Ansible Versions | Remarks 4.4.0 | 2.0.0p39, 2.1.0p41, 2.2.0p24 | 2.14, 2.15, 2.16 | None 4.4.1 | 2.0.0p39, 2.1.0p41, 2.2.0p24 | 2.14, 2.15, 2.16 | None 5.0.0 | 2.1.0p44, 2.2.0p27, 2.3.0p5 | 2.15, 2.16, 2.17 | Breaking changes to the following modules: `lookup_folder`, `rule` and role: `agent`. +5.1.0 | 2.1.0p44, 2.2.0p27, 2.3.0p6 | 2.15, 2.16, 2.17 | None diff --git a/Vagrantfile.kvm b/Vagrantfile.kvm index 308e640b4..b5565b85c 100644 --- a/Vagrantfile.kvm +++ b/Vagrantfile.kvm @@ -28,7 +28,8 @@ Vagrant.configure("2") do |config| end $script = <<-SCRIPT apt-get -y update --quiet - apt-get -y install python3-pip ca-certificates curl gnupg lsb-release qemu-guest-agent + add-apt-repository -y ppa:deadsnakes + apt-get -y install python3-pip ca-certificates curl gnupg lsb-release qemu-guest-agent python3.8 python3.9 python3.10 python3.11 python3.12 sudo -u vagrant python3 -m pip install pip --upgrade sudo -u vagrant python3 -m pip install -r /home/vagrant/ansible_collections/checkmk/general/requirements.txt sudo -u vagrant python3 -m pip install -r /home/vagrant/ansible_collections/checkmk/general/requirements-qa.txt diff --git a/changelogs/fragments/agent.yml b/changelogs/fragments/agent.yml new file mode 100644 index 000000000..d20fa0ce7 --- /dev/null +++ b/changelogs/fragments/agent.yml @@ -0,0 +1,10 @@ +bugfixes: + - Agent role - For Windows hosts the download of correct setup files was broken + due to a mixup in the modules used to fetch the files. The role would always + fall back to the GENERIC agent, even if a specific agent was available. + This is fixed now. + +minor_changes: + - Agent role - Improve idempotency by reading the registration states both for + Agent registration and Updater registration and skipping the registration + if it is not necessary. diff --git a/changelogs/fragments/build.yml b/changelogs/fragments/build.yml new file mode 100644 index 000000000..4ff65b508 --- /dev/null +++ b/changelogs/fragments/build.yml @@ -0,0 +1,2 @@ +minor_changes: + - Testing - Testing against Python 3.8 was removed for all modules. diff --git a/changelogs/fragments/release_summary.yml b/changelogs/fragments/release_summary.yml new file mode 100644 index 000000000..7e23ff785 --- /dev/null +++ b/changelogs/fragments/release_summary.yml @@ -0,0 +1 @@ +release_summary: "Some love for the agent role." diff --git a/changelogs/fragments/variables.yml b/changelogs/fragments/variables.yml new file mode 100644 index 000000000..9d729fcd7 --- /dev/null +++ b/changelogs/fragments/variables.yml @@ -0,0 +1,7 @@ +minor_changes: + - Agent role - All internal variables are now prefixed with a double underscore (`__`). + If you hooked into any variable, which is not in `defaults/main.yml` you need to check your inventory. + Be advised, that it is bad practice, to use internal variables directly. + - Server role - All internal variables are now prefixed with a double underscore (`__`). + If you hooked into any variable, which is not in `defaults/main.yml` you need to check your inventory. + Be advised, that it is bad practice, to use internal variables directly. diff --git a/galaxy.yml b/galaxy.yml index 994bb2fb2..e9b440a07 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -10,7 +10,7 @@ name: general # The version of the collection. Must be compatible with semantic versioning -version: 5.0.0 +version: 5.1.0 # The path to the Markdown (.md) readme file. This path is relative to the root of the collection readme: README.md diff --git a/meta/runtime.yml b/meta/runtime.yml index 7a4d6fb59..f14de217e 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -1,4 +1,4 @@ -requires_ansible: '>=2.14.0' +requires_ansible: '>=2.15.0' action_groups: checkmk: @@ -8,9 +8,11 @@ action_groups: - discovery - downtime - folder - - host - host_group + - host + - password - rule - service_group - tag_group + - timeperiod - user diff --git a/playbooks/usecases/remote-registration.yml b/playbooks/usecases/remote-registration.yml index c034127f3..3c6c47aad 100644 --- a/playbooks/usecases/remote-registration.yml +++ b/playbooks/usecases/remote-registration.yml @@ -9,7 +9,7 @@ vars: # Basic server and authentication information. # You have to provide the distributed setup yourself. - checkmk_agent_version: "2.2.0p7" + checkmk_agent_version: "2.3.0p6" checkmk_agent_edition: "cre" checkmk_agent_user: "cmkadmin" checkmk_agent_pass: "password" diff --git a/playbooks/vars/auth.yml b/playbooks/vars/auth.yml index a05674090..9862a9eca 100644 --- a/playbooks/vars/auth.yml +++ b/playbooks/vars/auth.yml @@ -7,7 +7,7 @@ checkmk_var_automation_secret: "mysecret" checkmk_agent_user: "{{ checkmk_var_automation_user }}" checkmk_agent_pass: "{{ checkmk_var_automation_secret }}" -checkmk_var_version: "2.2.0b4" +checkmk_var_version: "2.3.0p6" checkmk_var_edition: "cre" ############################################################# diff --git a/plugins/lookup/README.md b/plugins/lookup/README.md index 9cbd28b34..d9599ff19 100644 --- a/plugins/lookup/README.md +++ b/plugins/lookup/README.md @@ -8,9 +8,9 @@ This way, they do not need to be provided at task level. ```bash export ANSIBLE_LOOKUP_CHECKMK_SERVER_URL="https://myserver" export ANSIBLE_LOOKUP_CHECKMK_SITE=mysite -export ANSIBLE_LOOKUP_AUTOMATION_USER=automation -export ANSIBLE_LOOKUP_AUTOMATION_SECRET=mysecret -export ANSIBLE_LOOKUP_VALIDATE_CERTS=False +export ANSIBLE_LOOKUP_CHECKMK_AUTOMATION_USER=automation +export ANSIBLE_LOOKUP_CHECKMK_AUTOMATION_SECRET=mysecret +export ANSIBLE_LOOKUP_CHECKMK_VALIDATE_CERTS=False ``` ### Method 2: In `ansible.cfg` @@ -31,10 +31,10 @@ validate_certs = False gather_facts: false vars: ansible_lookup_checkmk_server_url: "https://myserver" - ansible_lookup_checkmk_site: "mysite" - ansible_lookup_automation_user: "automation" - ansible_lookup_automation_secret: "mysecret" - ansible_lookup_validate_certs: false + ansible_lookup_checkmk_site: "mysite" + ansible_lookup_checkmk_automation_user: "automation" + ansible_lookup_checkmk_automation_secret: "mysecret" + ansible_lookup_checkmk_validate_certs: false tasks: - name: Get the attributes of myhost diff --git a/plugins/lookup/folders.py b/plugins/lookup/folders.py index a021d0bba..b56285353 100644 --- a/plugins/lookup/folders.py +++ b/plugins/lookup/folders.py @@ -117,7 +117,7 @@ ) }}" loop_control: - label: "{{ item.id }}" + label: "{{ item.id }}" - name: Get all hosts of the folder /test recursively ansible.builtin.debug: @@ -137,7 +137,7 @@ }}" loop: "{{ looping|subelements('members.hosts.value') }}" loop_control: - label: "{{ item.0.id }}" + label: "{{ item.0.id }}" - name: "Use variables outside the module call." ansible.builtin.debug: @@ -155,7 +155,7 @@ recursive=True, ) }}" loop_control: - label: "{{ item.id }}" + label: "{{ item.id }}" """ RETURN = """ diff --git a/plugins/lookup/rules.py b/plugins/lookup/rules.py index 4d9e9267f..4709d092b 100644 --- a/plugins/lookup/rules.py +++ b/plugins/lookup/rules.py @@ -117,7 +117,7 @@ ) }}" loop_control: - label: "{{ item.id }}" + label: "{{ item.id }}" - name: Get all rules of the ruleset host_groups in folder /test ansible.builtin.debug: @@ -134,7 +134,7 @@ ) }}" loop_control: - label: "{{ item.id }}" + label: "{{ item.id }}" - name: actice_checks:http rules that match a certain description AND comment ansible.builtin.debug: @@ -152,7 +152,7 @@ ) }}" loop_control: - label: "{{ item.id }}" + label: "{{ item.id }}" - name: "Use variables outside the module call." ansible.builtin.debug: @@ -166,7 +166,7 @@ loop: "{{ lookup('checkmk.general.rules', ruleset='host_groups') }}" loop_control: - label: "{{ item.id }}" + label: "{{ item.id }}" """ RETURN = """ diff --git a/plugins/lookup/rulesets.py b/plugins/lookup/rulesets.py index 55090488e..c86ded875 100644 --- a/plugins/lookup/rulesets.py +++ b/plugins/lookup/rulesets.py @@ -122,7 +122,7 @@ ) }}" loop_control: - label: "{{ item.id }}" + label: "{{ item.id }}" - name: Get all used deprecated rulesets ansible.builtin.debug: @@ -140,7 +140,7 @@ ) }}" loop_control: - label: "{{ item.0.id }}" + label: "{{ item.0.id }}" - name: "Use variables outside the module call." ansible.builtin.debug: @@ -154,7 +154,7 @@ loop: "{{ lookup('checkmk.general.rulesets', regex='', rulesets_deprecated=True, rulesets_used=True) }}" loop_control: - label: "{{ item.0.id }}" + label: "{{ item.0.id }}" """ RETURN = """ diff --git a/plugins/modules/rule.py b/plugins/modules/rule.py index 3b37852d1..28f732a82 100644 --- a/plugins/modules/rule.py +++ b/plugins/modules/rule.py @@ -155,32 +155,32 @@ rule: conditions: { "host_label_groups": [ - { + { + operator: "and", + label_group: [ + { + operator: "and", + label: "cmk/site:beta" + }, + { + operator: "or", + label: "cmk/os_family:linux" + } + ], + }, + { + operator: "or", + label_group: [ + { operator: "and", - label_group: [ - { - operator: "and", - label: "cmk/site:beta" - }, - { - operator: "or", - label: "cmk/os_family:linux" - } - ], - }, - { + label: "cmk/site:alpha" + }, + { operator: "or", - label_group: [ - { - operator: "and", - label: "cmk/site:alpha" - }, - { - operator: "or", - label: "cmk/os_family:windows" - } - ], - }, + label: "cmk/os_family:windows" + } + ], + }, ], "host_name": { "match_on": [ diff --git a/plugins/modules/user.py b/plugins/modules/user.py index d9d3fe9c7..61254edfd 100644 --- a/plugins/modules/user.py +++ b/plugins/modules/user.py @@ -197,13 +197,13 @@ password: "uschi" enforce_password_change: true email: "checker@grevenbroich.de" - fallback_contact: True + fallback_contact: true pager: 089-123456789 contactgroups: - "sport" - "vereinsgeschehen" - "lokalpolitik" - disable_notifications: True + disable_notifications: true disable_notifications_timerange: { "start_time": "2023-02-23T15:06:48+00:00", "end_time": "2023-02-23T16:06:48+00:00"} language: "de" roles: diff --git a/requirements.txt b/requirements.txt index b838767ab..85ae18cb5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,4 +7,4 @@ molecule >= 5.0.1 molecule-plugins[docker] yamllint pywinrm -netaddr \ No newline at end of file +netaddr diff --git a/roles/agent/README.md b/roles/agent/README.md index 279641e59..bd968e348 100644 --- a/roles/agent/README.md +++ b/roles/agent/README.md @@ -16,7 +16,7 @@ Please make sure it is installed on your system and available for Ansible. ## Role Variables - checkmk_agent_version: "2.3.0p5" + checkmk_agent_version: "2.3.0p6" The Checkmk version of the site your agents will talk to. @@ -159,7 +159,7 @@ Typically this would be your Ansible host, hence the default `localhost`. checkmk_agent_delegate_download: "{{ inventory_hostname }}" -Configure the host to which Checkmk API downloads are delegated to. After download the files are transferred to the remote node, when the remote node didn't do the download. +Configure the host to which downloads are delegated to. After download the files are transferred to the remote node, when the remote node didn't do the download itself. checkmk_agent_mode: pull diff --git a/roles/agent/defaults/main.yml b/roles/agent/defaults/main.yml index 950b35e94..f9f349d4c 100644 --- a/roles/agent/defaults/main.yml +++ b/roles/agent/defaults/main.yml @@ -1,5 +1,5 @@ --- -checkmk_agent_version: "2.3.0p5" +checkmk_agent_version: "2.3.0p6" checkmk_agent_edition: cre checkmk_agent_server_protocol: http checkmk_agent_server: localhost diff --git a/roles/agent/handlers/main.yml b/roles/agent/handlers/main.yml index f3c5c60fb..4f77ba676 100644 --- a/roles/agent/handlers/main.yml +++ b/roles/agent/handlers/main.yml @@ -4,7 +4,7 @@ server_url: "{{ checkmk_agent_server_protocol }}://{{ checkmk_agent_server }}:{{ checkmk_agent_server_port }}/" site: "{{ checkmk_agent_site }}" automation_user: "{{ checkmk_agent_user }}" - automation_secret: "{{ checkmk_agent_auth }}" + automation_secret: "{{ __checkmk_agent_auth }}" force_foreign_changes: "{{ checkmk_agent_force_foreign_changes }}" redirect: 'true' validate_certs: "{{ checkmk_agent_server_validate_certs }}" diff --git a/roles/agent/molecule/2.3.0/group_vars/all.yml b/roles/agent/molecule/2.3.0/group_vars/all.yml index 11a82eb53..41080d2f3 100644 --- a/roles/agent/molecule/2.3.0/group_vars/all.yml +++ b/roles/agent/molecule/2.3.0/group_vars/all.yml @@ -1,6 +1,6 @@ --- # General -checkmk_var_version: "2.3.0p5" +checkmk_var_version: "2.3.0p6" checkmk_var_edition: "cre" checkmk_var_checkmk_site: "mysite" checkmk_var_automation_user: "cmkadmin" diff --git a/roles/agent/tasks/Debian.yml b/roles/agent/tasks/Debian.yml index b1a80d255..80cfcb229 100644 --- a/roles/agent/tasks/Debian.yml +++ b/roles/agent/tasks/Debian.yml @@ -2,7 +2,7 @@ - name: "{{ ansible_os_family }} Derivatives: Install host-specific {{ checkmk_agent_edition | upper }} Agent." become: true ansible.builtin.apt: - deb: "{{ checkmk_agent_agent.file.host }}" + deb: "{{ __checkmk_agent_agent.file.host }}" force: "{{ checkmk_agent_force_install | bool }}" state: present when: | @@ -14,7 +14,7 @@ - name: "{{ ansible_os_family }} Derivatives: Install GENERIC or folder-specific {{ checkmk_agent_edition | upper }} Agent." become: true ansible.builtin.apt: - deb: "{{ checkmk_agent_agent.file.cee }}" + deb: "{{ __checkmk_agent_agent.file.cee }}" force: "{{ checkmk_agent_force_install | bool }}" state: present when: | @@ -25,8 +25,8 @@ - name: "{{ ansible_os_family }} Derivatives: Transfer Vanilla agent." ansible.builtin.copy: - src: "{{ checkmk_agent_agent.file.cre }}" - dest: "{{ checkmk_agent_agent.file.cre }}" + src: "{{ __checkmk_agent_agent.file.cre }}" + dest: "{{ __checkmk_agent_agent.file.cre }}" mode: "0644" when: | checkmk_agent_edition | lower == "cre" @@ -37,7 +37,7 @@ - name: "{{ ansible_os_family }} Derivatives: Install Vanilla agent." become: true ansible.builtin.apt: - deb: "{{ checkmk_agent_agent.file.cre }}" + deb: "{{ __checkmk_agent_agent.file.cre }}" force: "{{ checkmk_agent_force_install | bool }}" state: present when: checkmk_agent_edition | lower == "cre" diff --git a/roles/agent/tasks/Linux-files.yml b/roles/agent/tasks/Linux-files.yml index 94e7b8577..a7da8da87 100644 --- a/roles/agent/tasks/Linux-files.yml +++ b/roles/agent/tasks/Linux-files.yml @@ -1,15 +1,15 @@ --- - name: "{{ ansible_system }}: Download Vanilla {{ checkmk_agent_edition | upper }} agent." ansible.builtin.get_url: - url: "{{ checkmk_agent_agent.url.cre }}" + url: "{{ __checkmk_agent_agent.url.cre }}" validate_certs: "{{ checkmk_agent_server_validate_certs | bool }}" - dest: "{{ checkmk_agent_agent.file.cre }}" + dest: "{{ __checkmk_agent_agent.file.cre }}" mode: '0640' when: checkmk_agent_edition | lower == "cre" - register: checkmk_agent_vanilla_download_state + register: __checkmk_agent_vanilla_download_state retries: 3 delay: 10 - until: "not checkmk_agent_vanilla_download_state.failed | bool" + until: "not __checkmk_agent_vanilla_download_state.failed | bool" delegate_to: "{{ checkmk_agent_delegate_download }}" tags: - download-package @@ -17,23 +17,23 @@ - name: "{{ ansible_system }}: Download host-specific {{ checkmk_agent_edition | upper }} Agent." ansible.builtin.uri: url: - "{{ checkmk_agent_agent.url.cee }}?\ + "{{ __checkmk_agent_agent.url.cee }}?\ host_name={{ checkmk_agent_host_name }}&\ - os_type={{ checkmk_agent_files_mapping[ansible_os_family] }}&\ + os_type={{ __checkmk_agent_files_mapping[ansible_os_family] }}&\ agent_type=host_name" validate_certs: "{{ checkmk_agent_server_validate_certs | bool }}" - dest: "{{ checkmk_agent_agent.file.host }}" + dest: "{{ __checkmk_agent_agent.file.host }}" method: GET headers: - Authorization: "Bearer {{ checkmk_agent_user }} {{ checkmk_agent_auth }}" + Authorization: "Bearer {{ checkmk_agent_user }} {{ __checkmk_agent_auth }}" Accept: "application/octet-stream" when: | checkmk_agent_edition | lower != "cre" become: false - register: checkmk_agent_host_download_state + register: __checkmk_agent_host_download_state # This task may fail, as we fall back to the generic agent in that case failed_when: 'false' - changed_when: checkmk_agent_host_download_state.status is defined and checkmk_agent_host_download_state.status == 200 + changed_when: __checkmk_agent_host_download_state.status is defined and __checkmk_agent_host_download_state.status == 200 delegate_to: "{{ checkmk_agent_delegate_download }}" tags: - download-package @@ -41,30 +41,32 @@ - name: "{{ ansible_system }}: Set Fact: Agent State: host-specific." ansible.builtin.set_fact: checkmk_agent_host_specific: >- - {{ (checkmk_agent_host_download_state.status is defined and checkmk_agent_host_download_state.status == 200) | bool }} + {{ (__checkmk_agent_host_download_state.status is defined and __checkmk_agent_host_download_state.status == 200) | bool }} + tags: + - download-package - name: "{{ ansible_system }}: Download folder-specific {{ checkmk_agent_edition | upper }} Agent." ansible.builtin.uri: url: - "{{ checkmk_agent_agent.url.cee }}?\ - os_type={{ checkmk_agent_files_mapping[ansible_os_family] }}&\ + "{{ __checkmk_agent_agent.url.cee }}?\ + os_type={{ __checkmk_agent_files_mapping[ansible_os_family] }}&\ folder_name={{ checkmk_agent_folder }}&\ agent_type=generic" validate_certs: "{{ checkmk_agent_server_validate_certs | bool }}" - dest: "{{ checkmk_agent_agent.file.cee }}" + dest: "{{ __checkmk_agent_agent.file.cee }}" method: GET headers: - Authorization: "Bearer {{ checkmk_agent_user }} {{ checkmk_agent_auth }}" + Authorization: "Bearer {{ checkmk_agent_user }} {{ __checkmk_agent_auth }}" Accept: "application/octet-stream" become: false - register: checkmk_agent_folder_download_state + register: __checkmk_agent_folder_download_state when: | checkmk_agent_edition | lower != "cre" and checkmk_agent_folder is defined and not checkmk_agent_host_specific | bool retries: 3 failed_when: 'false' - changed_when: checkmk_agent_folder_download_state.status is defined and checkmk_agent_folder_download_state.status == 200 + changed_when: __checkmk_agent_folder_download_state.status is defined and __checkmk_agent_folder_download_state.status == 200 delegate_to: "{{ checkmk_agent_delegate_download }}" tags: - download-package @@ -72,19 +74,21 @@ - name: "{{ ansible_system }}: Set Fact: Agent State: folder-specific." ansible.builtin.set_fact: checkmk_agent_folder_specific: >- - {{ (checkmk_agent_folder_download_state.status is defined and checkmk_agent_folder_download_state.status == 200) | bool }} + {{ (__checkmk_agent_folder_download_state.status is defined and __checkmk_agent_folder_download_state.status == 200) | bool }} + tags: + - download-package - name: "{{ ansible_system }}: Download GENERIC {{ checkmk_agent_edition | upper }} Agent." ansible.builtin.uri: url: - "{{ checkmk_agent_agent.url.cee }}?\ - os_type={{ checkmk_agent_files_mapping[ansible_os_family] }}&\ + "{{ __checkmk_agent_agent.url.cee }}?\ + os_type={{ __checkmk_agent_files_mapping[ansible_os_family] }}&\ agent_type=generic" validate_certs: "{{ checkmk_agent_server_validate_certs | bool }}" - dest: "{{ checkmk_agent_agent.file.cee }}" + dest: "{{ __checkmk_agent_agent.file.cee }}" method: GET headers: - Authorization: "Bearer {{ checkmk_agent_user }} {{ checkmk_agent_auth }}" + Authorization: "Bearer {{ checkmk_agent_user }} {{ __checkmk_agent_auth }}" Accept: "application/octet-stream" become: false when: | @@ -97,8 +101,8 @@ - name: "{{ ansible_system }}: Transfer host-specific {{ checkmk_agent_edition | upper }} Agent." ansible.builtin.copy: - src: "{{ checkmk_agent_agent.file.host }}" - dest: "{{ checkmk_agent_agent.file.host }}" + src: "{{ __checkmk_agent_agent.file.host }}" + dest: "{{ __checkmk_agent_agent.file.host }}" mode: "0644" when: | checkmk_agent_edition | lower != "cre" @@ -109,8 +113,8 @@ - name: "{{ ansible_system }}: Transfer GENERIC or folder-specific {{ checkmk_agent_edition | upper }} Agent." ansible.builtin.copy: - src: "{{ checkmk_agent_agent.file.cee }}" - dest: "{{ checkmk_agent_agent.file.cee }}" + src: "{{ __checkmk_agent_agent.file.cee }}" + dest: "{{ __checkmk_agent_agent.file.cee }}" mode: "0644" when: | checkmk_agent_edition | lower != "cre" @@ -121,8 +125,8 @@ - name: "{{ ansible_system }}: Transfer Vanilla {{ checkmk_agent_edition | upper }} Agent." ansible.builtin.copy: - src: "{{ checkmk_agent_agent.file.cre }}" - dest: "{{ checkmk_agent_agent.file.cre }}" + src: "{{ __checkmk_agent_agent.file.cre }}" + dest: "{{ __checkmk_agent_agent.file.cre }}" mode: "0644" when: | checkmk_agent_edition | lower == "cre" diff --git a/roles/agent/tasks/Linux.yml b/roles/agent/tasks/Linux.yml index 416e00855..6ddc18fd9 100644 --- a/roles/agent/tasks/Linux.yml +++ b/roles/agent/tasks/Linux.yml @@ -33,15 +33,15 @@ - name: "{{ ansible_system }}: Download Vanilla agent." ansible.builtin.get_url: - url: "{{ checkmk_agent_agent.url.cre }}" + url: "{{ __checkmk_agent_agent.url.cre }}" validate_certs: "{{ checkmk_agent_server_validate_certs | bool }}" - dest: "{{ checkmk_agent_agent.file.cre }}" + dest: "{{ __checkmk_agent_agent.file.cre }}" mode: '0640' when: checkmk_agent_edition | lower == "cre" - register: checkmk_agent_download_state + register: __checkmk_agent_download_state retries: 3 delay: 10 - until: "not checkmk_agent_download_state.failed | bool" + until: "not __checkmk_agent_download_state.failed | bool" delegate_to: "{{ checkmk_agent_delegate_download }}" tags: - download-package @@ -57,22 +57,22 @@ site: "{{ checkmk_agent_site }}" validate_certs: "{{ checkmk_agent_server_validate_certs | bool }}" automation_user: "{{ checkmk_agent_user }}" - automation_secret: "{{ checkmk_agent_auth }}" + automation_secret: "{{ __checkmk_agent_auth }}" folder: "{{ checkmk_agent_folder | default(omit) }}" name: "{{ checkmk_agent_host_name }}" attributes: "{{ checkmk_agent_host_attributes }}" state: "present" become: false - register: checkmk_agent_create_result + register: __checkmk_agent_create_result failed_when: | - (checkmk_agent_create_result.failed == true) and - ("The host is already part of the specified target folder" not in checkmk_agent_create_result.msg) + (__checkmk_agent_create_result.failed == true) and + ("The host is already part of the specified target folder" not in __checkmk_agent_create_result.msg) delegate_to: "{{ checkmk_agent_delegate_api_calls }}" when: checkmk_agent_add_host | bool notify: "Activate changes" - name: "Ensure registration readyness." # noqa no-handler - when: checkmk_agent_create_result.changed | bool + when: __checkmk_agent_create_result.changed | bool block: - name: "Trigger activation of changes." ansible.builtin.meta: flush_handlers @@ -80,54 +80,72 @@ - name: "{{ ansible_system }}: Check for Agent Updater Binary." ansible.builtin.stat: path: /usr/bin/cmk-update-agent - register: checkmk_agent_updater_binary + register: __checkmk_agent_updater_binary - name: "{{ ansible_system }}: Check for Agent Controller Binary." ansible.builtin.stat: path: /usr/bin/cmk-agent-ctl - register: checkmk_agent_controller_binary + register: __checkmk_agent_controller_binary + +- name: "{{ ansible_system }}: Read Agent Controller State." + become: true + ansible.builtin.command: cat /var/lib/cmk-agent/registered_connections.json + register: __checkmk_agent_registered_connections + changed_when: false + +- name: "{{ ansible_system }}: Read Updater State." + become: true + ansible.builtin.command: cat /var/lib/check_mk_agent/cache/plugins_cmk-update-agent.cache + register: __checkmk_agent_updater_state + changed_when: false + failed_when: | + not __checkmk_agent_updater_state.rc == 0 + and not __checkmk_agent_updater_state.rc == 1 - name: "{{ ansible_system }}: Register Agent for automatic Updates using User Password." # noqa no-changed-when become: true ansible.builtin.shell: | cmk-update-agent register -H {{ checkmk_agent_host_name }} \ -s {{ checkmk_agent_registration_server }} -i {{ checkmk_agent_registration_site }} -p {{ checkmk_agent_server_protocol }} \ - -U {{ checkmk_agent_user }} -P {{ checkmk_agent_auth }} + -U {{ checkmk_agent_user }} -P {{ __checkmk_agent_auth }} no_log: "{{ checkmk_agent_no_log | bool }}" - register: checkmk_agent_update_state + register: __checkmk_agent_update_state when: | checkmk_agent_edition | lower != "cre" - and checkmk_agent_updater_binary.stat.exists | bool + and __checkmk_agent_updater_binary.stat.exists | bool and checkmk_agent_update | bool and (checkmk_agent_pass is defined and checkmk_agent_pass | length) and (checkmk_agent_secret is not defined) + and not checkmk_agent_registration_server + '/' + checkmk_agent_registration_site in __checkmk_agent_updater_state.stdout - name: "{{ ansible_system }}: Register Agent for automatic Updates using Automation Secret." # noqa no-changed-when become: true ansible.builtin.shell: | cmk-update-agent register -H {{ checkmk_agent_host_name }} \ -s {{ checkmk_agent_registration_server }} -i {{ checkmk_agent_registration_site }} -p {{ checkmk_agent_server_protocol }} \ - -U {{ checkmk_agent_user }} -S {{ checkmk_agent_auth }} + -U {{ checkmk_agent_user }} -S {{ __checkmk_agent_auth }} no_log: "{{ checkmk_agent_no_log | bool }}" - register: checkmk_agent_update_state + register: __checkmk_agent_update_state when: | checkmk_agent_edition | lower != "cre" - and checkmk_agent_updater_binary.stat.exists | bool + and __checkmk_agent_updater_binary.stat.exists | bool and checkmk_agent_update | bool and (checkmk_agent_secret is defined and checkmk_agent_secret | length) + and not checkmk_agent_registration_server + '/' + checkmk_agent_registration_site in __checkmk_agent_updater_state.stdout - name: "{{ ansible_system }}: Register Agent for TLS." # noqa no-changed-when become: true ansible.builtin.shell: | cmk-agent-ctl register -H {{ checkmk_agent_host_name }} \ -s {{ checkmk_agent_registration_server }} -i {{ checkmk_agent_registration_site }} \ - -U {{ checkmk_agent_user }} -P {{ checkmk_agent_auth }} --trust-cert + -U {{ checkmk_agent_user }} -P {{ __checkmk_agent_auth }} --trust-cert no_log: "{{ checkmk_agent_no_log | bool }}" - register: checkmk_agent_tls_state + register: __checkmk_agent_tls_state when: | - checkmk_agent_controller_binary.stat.exists | bool + __checkmk_agent_controller_binary.stat.exists | bool and checkmk_agent_tls | bool - and (checkmk_agent_auth is defined and checkmk_agent_auth | length) + and (__checkmk_agent_auth is defined and __checkmk_agent_auth | length) + and not checkmk_agent_registration_server + '/' + checkmk_agent_registration_site in __checkmk_agent_registered_connections.stdout - name: "{{ ansible_system }}: Verify Checkmk Agent Port is open." ansible.builtin.wait_for: diff --git a/roles/agent/tasks/RedHat.yml b/roles/agent/tasks/RedHat.yml index b3711add3..3e8b2a609 100644 --- a/roles/agent/tasks/RedHat.yml +++ b/roles/agent/tasks/RedHat.yml @@ -2,7 +2,7 @@ - name: "{{ ansible_os_family }} Derivatives: Install host-specific {{ checkmk_agent_edition | upper }} Agent." become: true ansible.builtin.dnf: - name: "{{ checkmk_agent_agent.file.host }}" + name: "{{ __checkmk_agent_agent.file.host }}" state: present disable_gpg_check: true when: | @@ -14,7 +14,7 @@ - name: "{{ ansible_os_family }} Derivatives: Install GENERIC or folder-specific {{ checkmk_agent_edition | upper }} Agent." become: true ansible.builtin.dnf: - name: "{{ checkmk_agent_agent.file.cee }}" + name: "{{ __checkmk_agent_agent.file.cee }}" state: present disable_gpg_check: true when: | @@ -25,8 +25,8 @@ - name: "{{ ansible_os_family }} Derivatives: Transfer Vanilla agent." ansible.builtin.copy: - src: "{{ checkmk_agent_agent.file.cre }}" - dest: "{{ checkmk_agent_agent.file.cre }}" + src: "{{ __checkmk_agent_agent.file.cre }}" + dest: "{{ __checkmk_agent_agent.file.cre }}" mode: "0644" when: | checkmk_agent_edition | lower == "cre" @@ -37,7 +37,7 @@ - name: "{{ ansible_os_family }} Derivatives: Install Vanilla agent." become: true ansible.builtin.dnf: - name: "{{ checkmk_agent_agent.file.cre }}" + name: "{{ __checkmk_agent_agent.file.cre }}" state: present disable_gpg_check: true when: checkmk_agent_edition | lower == "cre" diff --git a/roles/agent/tasks/Suse.yml b/roles/agent/tasks/Suse.yml index fe0ceb277..fe654141d 100644 --- a/roles/agent/tasks/Suse.yml +++ b/roles/agent/tasks/Suse.yml @@ -2,7 +2,7 @@ - name: "{{ ansible_os_family }} Derivatives: Install host-specific {{ checkmk_agent_edition | upper }} Agent." become: true community.general.zypper: - name: "{{ checkmk_agent_agent.file.host }}" + name: "{{ __checkmk_agent_agent.file.host }}" force: "{{ checkmk_agent_force_install | bool }}" state: present disable_gpg_check: true @@ -15,7 +15,7 @@ - name: "{{ ansible_os_family }} Derivatives: Install GENERIC or folder-specific {{ checkmk_agent_edition | upper }} Agent." become: true community.general.zypper: - name: "{{ checkmk_agent_agent.file.cee }}" + name: "{{ __checkmk_agent_agent.file.cee }}" force: "{{ checkmk_agent_force_install | bool }}" state: present disable_gpg_check: true @@ -27,8 +27,8 @@ - name: "{{ ansible_os_family }} Derivatives: Transfer Vanilla agent." ansible.builtin.copy: - src: "{{ checkmk_agent_agent.file.cre }}" - dest: "{{ checkmk_agent_agent.file.cre }}" + src: "{{ __checkmk_agent_agent.file.cre }}" + dest: "{{ __checkmk_agent_agent.file.cre }}" mode: "0644" when: | checkmk_agent_edition | lower == "cre" @@ -39,7 +39,7 @@ - name: "{{ ansible_os_family }} Derivatives: Install Vanilla agent." become: true community.general.zypper: - name: "{{ checkmk_agent_agent.file.cre }}" + name: "{{ __checkmk_agent_agent.file.cre }}" force: "{{ checkmk_agent_force_install | bool }}" state: present disable_gpg_check: true diff --git a/roles/agent/tasks/Win32NT-files.yml b/roles/agent/tasks/Win32NT-files.yml index 38a589bdf..99d8822a7 100644 --- a/roles/agent/tasks/Win32NT-files.yml +++ b/roles/agent/tasks/Win32NT-files.yml @@ -4,196 +4,222 @@ block: - name: "{{ ansible_system }}: Download Vanilla {{ checkmk_agent_edition | upper }} Agent." ansible.windows.win_get_url: - url: "{{ checkmk_agent_agent.url.cre }}" + url: "{{ __checkmk_agent_agent.url.cre }}" validate_certs: "{{ checkmk_agent_server_validate_certs | bool }}" - dest: "{{ checkmk_agent_agent.file.cre }}" + dest: "{{ __checkmk_agent_agent.file.cre }}" when: | checkmk_agent_edition | lower == "cre" - register: checkmk_agent_vanilla_download_state + register: __checkmk_agent_vanilla_download_state retries: 3 delay: 10 - until: "not checkmk_agent_vanilla_download_state.failed | bool" + until: "not __checkmk_agent_vanilla_download_state.failed | bool" + tags: + - download-package - name: "{{ ansible_system }}: Download host-specific {{ checkmk_agent_edition | upper }} Agent." ansible.windows.win_get_url: url: - "{{ checkmk_agent_agent.url.cee }}?\ + "{{ __checkmk_agent_agent.url.cee }}?\ host_name={{ checkmk_agent_host_name }}&\ - os_type={{ checkmk_agent_files_mapping[ansible_os_family] }}&\ + os_type={{ __checkmk_agent_files_mapping[ansible_os_family] }}&\ agent_type=host_name" validate_certs: "{{ checkmk_agent_server_validate_certs | bool }}" - dest: "{{ checkmk_agent_agent.file.host }}" + dest: "{{ __checkmk_agent_agent.file.host }}" method: GET headers: - Authorization: "Bearer {{ checkmk_agent_user }} {{ checkmk_agent_auth }}" + Authorization: "Bearer {{ checkmk_agent_user }} {{ __checkmk_agent_auth }}" Accept: "application/octet-stream" when: | checkmk_agent_edition | lower != "cre" - register: checkmk_agent_host_download_state + register: __checkmk_agent_host_download_state # This task may fail, as we fall back to the generic agent in that case failed_when: 'false' - changed_when: checkmk_agent_host_download_state.status_code is defined and checkmk_agent_host_download_state.status_code == 200 - delegate_to: "{{ checkmk_agent_delegate_download }}" + changed_when: __checkmk_agent_host_download_state.status_code is defined and __checkmk_agent_host_download_state.status_code == 200 + tags: + - download-package - name: "{{ ansible_system }}: Set Fact: Agent State: host-specific." ansible.builtin.set_fact: checkmk_agent_host_specific: >- - {{ (checkmk_agent_host_download_state.status_code is defined and checkmk_agent_host_download_state.status_code == 200) | bool }} + {{ (__checkmk_agent_host_download_state.status_code is defined and __checkmk_agent_host_download_state.status_code == 200) | bool }} + tags: + - download-package - name: "{{ ansible_system }}: Download folder-specific {{ checkmk_agent_edition | upper }} Agent." ansible.windows.win_get_url: url: - "{{ checkmk_agent_agent.url.cee }}?\ - os_type={{ checkmk_agent_files_mapping[ansible_os_family] }}&\ + "{{ __checkmk_agent_agent.url.cee }}?\ + os_type={{ __checkmk_agent_files_mapping[ansible_os_family] }}&\ folder_name={{ checkmk_agent_folder }}&\ agent_type=generic" validate_certs: "{{ checkmk_agent_server_validate_certs | bool }}" - dest: "{{ checkmk_agent_agent.file.cee }}" + dest: "{{ __checkmk_agent_agent.file.cee }}" method: GET headers: - Authorization: "Bearer {{ checkmk_agent_user }} {{ checkmk_agent_auth }}" + Authorization: "Bearer {{ checkmk_agent_user }} {{ __checkmk_agent_auth }}" Accept: "application/octet-stream" - register: checkmk_agent_folder_download_state + register: __checkmk_agent_folder_download_state when: | checkmk_agent_edition | lower != "cre" and checkmk_agent_folder is defined and not checkmk_agent_host_specific | bool retries: 3 failed_when: 'false' - changed_when: checkmk_agent_folder_download_state.status_code is defined and checkmk_agent_folder_download_state.status_code == 200 - delegate_to: "{{ checkmk_agent_delegate_download }}" + changed_when: __checkmk_agent_folder_download_state.status_code is defined and __checkmk_agent_folder_download_state.status_code == 200 + tags: + - download-package - name: "{{ ansible_system }}: Set Fact: Agent State: folder-specific." ansible.builtin.set_fact: checkmk_agent_folder_specific: >- - {{ (checkmk_agent_folder_download_state.status_code is defined and checkmk_agent_folder_download_state.status_code == 200) | bool }} + {{ (__checkmk_agent_folder_download_state.status_code is defined and __checkmk_agent_folder_download_state.status_code == 200) | bool }} + tags: + - download-package - name: "{{ ansible_system }}: Download GENERIC {{ checkmk_agent_edition | upper }} Agent." ansible.windows.win_get_url: url: - "{{ checkmk_agent_agent.url.cee }}?\ - os_type={{ checkmk_agent_files_mapping[ansible_os_family] }}&\ + "{{ __checkmk_agent_agent.url.cee }}?\ + os_type={{ __checkmk_agent_files_mapping[ansible_os_family] }}&\ agent_type=generic" validate_certs: "{{ checkmk_agent_server_validate_certs | bool }}" - dest: "{{ checkmk_agent_agent.file.cee }}" + dest: "{{ __checkmk_agent_agent.file.cee }}" method: GET headers: - Authorization: "Bearer {{ checkmk_agent_user }} {{ checkmk_agent_auth }}" + Authorization: "Bearer {{ checkmk_agent_user }} {{ __checkmk_agent_auth }}" Accept: "application/octet-stream" when: | checkmk_agent_edition | lower != "cre" and not (checkmk_agent_host_specific | bool or checkmk_agent_folder_specific | bool) retries: 3 - delegate_to: "{{ checkmk_agent_delegate_download }}" - + tags: + - download-package - name: "{{ ansible_system }}: Download to delegated Host." when: checkmk_agent_delegate_download != inventory_hostname block: - name: "{{ ansible_system }}: Download Vanilla {{ checkmk_agent_edition | upper }} Agent (delegated)." ansible.builtin.uri: - url: "{{ checkmk_agent_agent.url.cre }}" + url: "{{ __checkmk_agent_agent.url.cre }}" validate_certs: "{{ checkmk_agent_server_validate_certs | bool }}" - dest: "{{ checkmk_agent_agent.file.cre }}" + dest: "{{ __checkmk_agent_agent.file.cre }}" when: | checkmk_agent_edition | lower == "cre" - register: checkmk_agent_vanilla_download_state + register: __checkmk_agent_vanilla_download_state retries: 3 delay: 10 - until: "not checkmk_agent_vanilla_download_state.failed | bool" + until: "not __checkmk_agent_vanilla_download_state.failed | bool" delegate_to: "{{ checkmk_agent_delegate_download }}" + tags: + - download-package - name: "{{ ansible_system }}: Download host-specific {{ checkmk_agent_edition | upper }} Agent (delegated)." ansible.builtin.uri: url: - "{{ checkmk_agent_agent.url.cee }}?\ + "{{ __checkmk_agent_agent.url.cee }}?\ host_name={{ checkmk_agent_host_name }}&\ - os_type={{ checkmk_agent_files_mapping[ansible_os_family] }}&\ + os_type={{ __checkmk_agent_files_mapping[ansible_os_family] }}&\ agent_type=host_name" validate_certs: "{{ checkmk_agent_server_validate_certs | bool }}" - dest: "{{ checkmk_agent_agent.file.host }}" + dest: "{{ __checkmk_agent_agent.file.host }}" method: GET headers: - Authorization: "Bearer {{ checkmk_agent_user }} {{ checkmk_agent_auth }}" + Authorization: "Bearer {{ checkmk_agent_user }} {{ __checkmk_agent_auth }}" Accept: "application/octet-stream" when: | checkmk_agent_edition | lower != "cre" - register: checkmk_agent_host_download_state + register: __checkmk_agent_host_download_state # This task may fail, as we fall back to the generic agent in that case failed_when: 'false' - changed_when: checkmk_agent_host_download_state.status_code is defined and checkmk_agent_host_download_state.status_code == 200 + changed_when: __checkmk_agent_host_download_state.status is defined and __checkmk_agent_host_download_state.status == 200 delegate_to: "{{ checkmk_agent_delegate_download }}" + tags: + - download-package - name: "{{ ansible_system }}: Set Fact: Agent State: host-specific." ansible.builtin.set_fact: checkmk_agent_host_specific: >- - {{ (checkmk_agent_host_download_state.status_code is defined and checkmk_agent_host_download_state.status_code == 200) | bool }} + {{ (__checkmk_agent_host_download_state.status is defined and __checkmk_agent_host_download_state.status == 200) | bool }} + tags: + - download-package - name: "{{ ansible_system }}: Download folder-specific {{ checkmk_agent_edition | upper }} Agent (delegated)." ansible.builtin.uri: url: - "{{ checkmk_agent_agent.url.cee }}?\ - os_type={{ checkmk_agent_files_mapping[ansible_os_family] }}&\ + "{{ __checkmk_agent_agent.url.cee }}?\ + os_type={{ __checkmk_agent_files_mapping[ansible_os_family] }}&\ folder_name={{ checkmk_agent_folder }}&\ agent_type=generic" validate_certs: "{{ checkmk_agent_server_validate_certs | bool }}" - dest: "{{ checkmk_agent_agent.file.cee }}" + dest: "{{ __checkmk_agent_agent.file.cee }}" method: GET headers: - Authorization: "Bearer {{ checkmk_agent_user }} {{ checkmk_agent_auth }}" + Authorization: "Bearer {{ checkmk_agent_user }} {{ __checkmk_agent_auth }}" Accept: "application/octet-stream" - register: checkmk_agent_folder_download_state + register: __checkmk_agent_folder_download_state when: | checkmk_agent_edition | lower != "cre" and checkmk_agent_folder is defined and not checkmk_agent_host_specific | bool retries: 3 failed_when: 'false' - changed_when: checkmk_agent_folder_download_state.status_code is defined and checkmk_agent_folder_download_state.status_code == 200 + changed_when: __checkmk_agent_folder_download_state.status is defined and __checkmk_agent_folder_download_state.status == 200 delegate_to: "{{ checkmk_agent_delegate_download }}" + tags: + - download-package - name: "{{ ansible_system }}: Set Fact: Agent State: folder-specific." ansible.builtin.set_fact: checkmk_agent_folder_specific: >- - {{ (checkmk_agent_folder_download_state.status_code is defined and checkmk_agent_folder_download_state.status_code == 200) | bool }} + {{ (__checkmk_agent_folder_download_state.status is defined and __checkmk_agent_folder_download_state.status == 200) | bool }} + tags: + - download-package - name: "{{ ansible_system }}: Download GENERIC {{ checkmk_agent_edition | upper }} Agent (delegated)." ansible.builtin.uri: url: - "{{ checkmk_agent_agent.url.cee }}?\ - os_type={{ checkmk_agent_files_mapping[ansible_os_family] }}&\ + "{{ __checkmk_agent_agent.url.cee }}?\ + os_type={{ __checkmk_agent_files_mapping[ansible_os_family] }}&\ agent_type=generic" validate_certs: "{{ checkmk_agent_server_validate_certs | bool }}" - dest: "{{ checkmk_agent_agent.file.cee }}" + dest: "{{ __checkmk_agent_agent.file.cee }}" method: GET headers: - Authorization: "Bearer {{ checkmk_agent_user }} {{ checkmk_agent_auth }}" + Authorization: "Bearer {{ checkmk_agent_user }} {{ __checkmk_agent_auth }}" Accept: "application/octet-stream" when: | checkmk_agent_edition | lower != "cre" and not (checkmk_agent_host_specific | bool or checkmk_agent_folder_specific | bool) retries: 3 delegate_to: "{{ checkmk_agent_delegate_download }}" + tags: + - download-package - name: "{{ ansible_system }}: Transfer host-specific {{ checkmk_agent_edition | upper }} Agent." ansible.windows.win_copy: - src: "{{ checkmk_agent_agent.file.host }}" - dest: "{{ checkmk_agent_agent.file.host }}" + src: "{{ __checkmk_agent_agent.file.host }}" + dest: "{{ __checkmk_agent_agent.file.host }}" when: | checkmk_agent_edition | lower != "cre" and checkmk_agent_host_specific | bool + tags: + - download-package - name: "{{ ansible_system }}: Transfer GENERIC or folder-specific {{ checkmk_agent_edition | upper }} Agent." ansible.windows.win_copy: - src: "{{ checkmk_agent_agent.file.cee }}" - dest: "{{ checkmk_agent_agent.file.cee }}" + src: "{{ __checkmk_agent_agent.file.cee }}" + dest: "{{ __checkmk_agent_agent.file.cee }}" when: | checkmk_agent_edition | lower != "cre" and not checkmk_agent_host_specific | bool + tags: + - download-package - name: "{{ ansible_system }}: Transfer Vanilla {{ checkmk_agent_edition | upper }} Agent." ansible.windows.win_copy: - src: "{{ checkmk_agent_agent.file.cre }}" - dest: "{{ checkmk_agent_agent.file.cre }}" + src: "{{ __checkmk_agent_agent.file.cre }}" + dest: "{{ __checkmk_agent_agent.file.cre }}" when: | checkmk_agent_edition | lower == "cre" + tags: + - download-package diff --git a/roles/agent/tasks/Win32NT.yml b/roles/agent/tasks/Win32NT.yml index f98e1ed3c..5cbe3eb95 100644 --- a/roles/agent/tasks/Win32NT.yml +++ b/roles/agent/tasks/Win32NT.yml @@ -10,66 +10,82 @@ site: "{{ checkmk_agent_site }}" validate_certs: "{{ checkmk_agent_server_validate_certs | bool }}" automation_user: "{{ checkmk_agent_user }}" - automation_secret: "{{ checkmk_agent_auth }}" + automation_secret: "{{ __checkmk_agent_auth }}" folder: "{{ checkmk_agent_folder | default(omit) }}" name: "{{ checkmk_agent_host_name }}" attributes: "{{ checkmk_agent_host_attributes }}" state: "present" become: false - register: checkmk_agent_create_result + register: __checkmk_agent_create_result failed_when: | - (checkmk_agent_create_result.failed == true) and - ("The host is already part of the specified target folder" not in checkmk_agent_create_result.msg) + (__checkmk_agent_create_result.failed == true) and + ("The host is already part of the specified target folder" not in __checkmk_agent_create_result.msg) delegate_to: "{{ checkmk_agent_delegate_api_calls }}" when: checkmk_agent_add_host | bool notify: "Activate changes" - name: "Ensure registration readyness." # noqa no-handler - when: checkmk_agent_create_result.changed | bool + when: __checkmk_agent_create_result.changed | bool block: - name: "Trigger activation of changes." ansible.builtin.meta: flush_handlers - name: "Check for Agent Controller Binary." ansible.windows.win_stat: - path: "{{ checkmk_agent_controller_binary_path }}" - register: checkmk_agent_controller_binary + path: "{{ __checkmk_agent_controller_binary_path }}" + register: __checkmk_agent_controller_binary - name: "{{ ansible_system }}: Check for Agent Binary." ansible.windows.win_stat: - path: "{{ checkmk_agent_binary_path }}" - register: checkmk_agent_binary + path: "{{ __checkmk_agent_binary_path }}" + register: __checkmk_agent_binary + +- name: "{{ ansible_system }}: Read Agent Controller State." + ansible.windows.win_command: powershell.exe - + args: + stdin: Get-Content -ErrorAction Ignore -LiteralPath C:\ProgramData\checkmk\agent\registered_connections.json ; Exit 0 + register: __checkmk_agent_registered_connections + changed_when: false + +- name: "{{ ansible_system }}: Read Updater State." + ansible.windows.win_command: powershell.exe - + args: + stdin: Get-Content -ErrorAction Ignore -LiteralPath C:\ProgramData\checkmk\agent\config\cmk-update-agent.state ; Exit 0 + register: __checkmk_agent_updater_state + changed_when: false - name: "{{ ansible_system }}: Register Agent for automatic Updates using User Password." # noqa no-changed-when ansible.windows.win_command: | check_mk_agent.exe updater register -H {{ checkmk_agent_host_name }} \ -s {{ checkmk_agent_registration_server }} -i {{ checkmk_agent_registration_site }} -p {{ checkmk_agent_server_protocol }} \ - -U {{ checkmk_agent_user }} -P {{ checkmk_agent_auth }} + -U {{ checkmk_agent_user }} -P {{ __checkmk_agent_auth }} no_log: "{{ checkmk_agent_no_log | bool }}" - register: checkmk_agent_update_state + register: __checkmk_agent_update_state args: chdir: "C:\\Program Files (x86)\\checkmk\\service\\" when: | checkmk_agent_edition | lower != "cre" - and checkmk_agent_binary.stat.exists | bool + and __checkmk_agent_binary.stat.exists | bool and checkmk_agent_update | bool and (checkmk_agent_pass is defined and checkmk_agent_pass | length) and (checkmk_agent_secret is not defined) + and not '\'server\': \'' + checkmk_agent_registration_server + '\', \'site\': \'' + checkmk_agent_registration_site + '\'' in __checkmk_agent_updater_state.stdout - name: "{{ ansible_system }}: Register Agent for automatic Updates using Automation Secret." # noqa no-changed-when ansible.windows.win_command: | check_mk_agent.exe updater register -H {{ checkmk_agent_host_name }} \ -s {{ checkmk_agent_registration_server }} -i {{ checkmk_agent_registration_site }} -p {{ checkmk_agent_server_protocol }} \ - -U {{ checkmk_agent_user }} -S {{ checkmk_agent_auth }} + -U {{ checkmk_agent_user }} -S {{ __checkmk_agent_auth }} no_log: "{{ checkmk_agent_no_log | bool }}" - register: checkmk_agent_update_state + register: __checkmk_agent_update_state args: chdir: "C:\\Program Files (x86)\\checkmk\\service\\" when: | checkmk_agent_edition | lower != "cre" - and checkmk_agent_binary.stat.exists | bool + and __checkmk_agent_binary.stat.exists | bool and checkmk_agent_update | bool and (checkmk_agent_secret is defined and checkmk_agent_secret | length) + and not '\'server\': \'' + checkmk_agent_registration_server + '\', \'site\': \'' + checkmk_agent_registration_site + '\'' in __checkmk_agent_updater_state.stdout - name: "Trigger Activate Changes to enable TLS registration." ansible.builtin.meta: @@ -79,15 +95,16 @@ ansible.windows.win_command: | cmk-agent-ctl.exe register -H {{ checkmk_agent_host_name }} \ -s {{ checkmk_agent_registration_server }} -i {{ checkmk_agent_registration_site }} \ - -U {{ checkmk_agent_user }} -P {{ checkmk_agent_auth }} --trust-cert + -U {{ checkmk_agent_user }} -P {{ __checkmk_agent_auth }} --trust-cert no_log: "{{ checkmk_agent_no_log | bool }}" - register: checkmk_agent_tls_state + register: __checkmk_agent_tls_state args: chdir: "C:\\Program Files (x86)\\checkmk\\service\\" when: | - checkmk_agent_controller_binary.stat.exists | bool + __checkmk_agent_controller_binary.stat.exists | bool and checkmk_agent_tls | bool - and (checkmk_agent_auth is defined and checkmk_agent_auth | length) + and (__checkmk_agent_auth is defined and __checkmk_agent_auth | length) + and not checkmk_agent_registration_server + '/' + checkmk_agent_registration_site in __checkmk_agent_registered_connections.stdout - name: "{{ ansible_system }}: Verify Checkmk Agent Port is open." ansible.windows.win_wait_for: diff --git a/roles/agent/tasks/Windows.yml b/roles/agent/tasks/Windows.yml index 182f8619d..f3cea01a7 100644 --- a/roles/agent/tasks/Windows.yml +++ b/roles/agent/tasks/Windows.yml @@ -1,7 +1,7 @@ --- - name: "{{ ansible_os_family }}: Install host-specific {{ checkmk_agent_edition | upper }} Agent." ansible.windows.win_package: - path: "{{ checkmk_agent_agent.file.host }}" + path: "{{ __checkmk_agent_agent.file.host }}" state: present when: | checkmk_agent_edition | lower != "cre" @@ -11,7 +11,7 @@ - name: "{{ ansible_os_family }}: Install GENERIC or folder-specific {{ checkmk_agent_edition | upper }} Agent." ansible.windows.win_package: - path: "{{ checkmk_agent_agent.file.cee }}" + path: "{{ __checkmk_agent_agent.file.cee }}" state: present when: | checkmk_agent_edition | lower != "cre" @@ -21,7 +21,7 @@ - name: "{{ ansible_os_family }}: Install Vanilla agent." ansible.windows.win_package: - path: "{{ checkmk_agent_agent.file.cre }}" + path: "{{ __checkmk_agent_agent.file.cre }}" state: present when: checkmk_agent_edition | lower == "cre" tags: diff --git a/roles/agent/tasks/main.yml b/roles/agent/tasks/main.yml index 19a789038..594f8bd7f 100644 --- a/roles/agent/tasks/main.yml +++ b/roles/agent/tasks/main.yml @@ -2,7 +2,7 @@ - name: "Preflight - Fail if Checkmk Edition is incorrect." ansible.builtin.fail: msg: "The provided Checkmk Edition '{{ checkmk_agent_edition }}' does not exist or is not supported by this role." - when: checkmk_agent_edition | lower not in checkmk_agent_edition_mapping + when: checkmk_agent_edition | lower not in __checkmk_agent_edition_mapping - name: "Include OS family specific variables." ansible.builtin.include_vars: "{{ ansible_os_family }}.yml" @@ -27,16 +27,16 @@ site: "{{ checkmk_agent_site }}" validate_certs: "{{ checkmk_agent_server_validate_certs | bool }}" automation_user: "{{ checkmk_agent_user }}" - automation_secret: "{{ checkmk_agent_auth }}" + automation_secret: "{{ __checkmk_agent_auth }}" host_name: "{{ checkmk_agent_host_name }}" state: "refresh" throttle: "{{ checkmk_agent_discover_max_parallel_tasks }}" delegate_to: "{{ checkmk_agent_delegate_api_calls }}" when: checkmk_agent_discover | bool - register: checkmk_agent_refresh_state + register: __checkmk_agent_refresh_state retries: 3 delay: 10 - until: "checkmk_agent_refresh_state.changed | bool" + until: "__checkmk_agent_refresh_state.changed | bool" - name: "Update monitored services and labels on host." become: false @@ -45,14 +45,14 @@ site: "{{ checkmk_agent_site }}" validate_certs: "{{ checkmk_agent_server_validate_certs | bool }}" automation_user: "{{ checkmk_agent_user }}" - automation_secret: "{{ checkmk_agent_auth }}" + automation_secret: "{{ __checkmk_agent_auth }}" host_name: "{{ checkmk_agent_host_name }}" state: "fix_all" throttle: "{{ checkmk_agent_discover_max_parallel_tasks }}" delegate_to: "{{ checkmk_agent_delegate_api_calls }}" when: checkmk_agent_discover | bool - register: checkmk_agent_discovery_state + register: __checkmk_agent_discovery_state retries: 3 delay: 10 - until: "checkmk_agent_discovery_state.changed | bool" + until: "__checkmk_agent_discovery_state.changed | bool" notify: "Activate changes" diff --git a/roles/agent/vars/Debian.yml b/roles/agent/vars/Debian.yml index 3504a9eb3..8cab9556e 100644 --- a/roles/agent/vars/Debian.yml +++ b/roles/agent/vars/Debian.yml @@ -1,11 +1,11 @@ --- -checkmk_agent_host_tmp_dir: "/tmp" +__checkmk_agent_host_tmp_dir: "/tmp" -checkmk_agent_agent: +__checkmk_agent_agent: url: - cre: "{{ checkmk_agent_site_url }}/check_mk/agents/check-mk-agent_{{ checkmk_agent_version }}-1_all.deb" - cee: "{{ checkmk_agent_site_url }}/check_mk/api/1.0/domain-types/agent/actions/download_by_host/invoke" + cre: "{{ __checkmk_agent_site_url }}/check_mk/agents/check-mk-agent_{{ checkmk_agent_version }}-1_all.deb" + cee: "{{ __checkmk_agent_site_url }}/check_mk/api/1.0/domain-types/agent/actions/download_by_host/invoke" file: - cre: "{{ checkmk_agent_host_tmp_dir }}/check-mk-agent_{{ checkmk_agent_version }}-vanilla.deb" - cee: "{{ checkmk_agent_host_tmp_dir }}/check-mk-agent_{{ checkmk_agent_version }}-generic.deb" - host: "{{ checkmk_agent_host_tmp_dir }}/check-mk-agent_{{ checkmk_agent_version }}-{{ inventory_hostname }}.deb" + cre: "{{ __checkmk_agent_host_tmp_dir }}/check-mk-agent_{{ checkmk_agent_version }}-vanilla.deb" + cee: "{{ __checkmk_agent_host_tmp_dir }}/check-mk-agent_{{ checkmk_agent_version }}-generic.deb" + host: "{{ __checkmk_agent_host_tmp_dir }}/check-mk-agent_{{ checkmk_agent_version }}-{{ inventory_hostname }}.deb" diff --git a/roles/agent/vars/RedHat.yml b/roles/agent/vars/RedHat.yml index abfb465da..25b229055 100644 --- a/roles/agent/vars/RedHat.yml +++ b/roles/agent/vars/RedHat.yml @@ -1,11 +1,11 @@ --- -checkmk_agent_host_tmp_dir: "/tmp" +__checkmk_agent_host_tmp_dir: "/tmp" -checkmk_agent_agent: +__checkmk_agent_agent: url: - cre: "{{ checkmk_agent_site_url }}/check_mk/agents/check-mk-agent-{{ checkmk_agent_version }}-1.noarch.rpm" - cee: "{{ checkmk_agent_site_url }}/check_mk/api/1.0/domain-types/agent/actions/download_by_host/invoke" + cre: "{{ __checkmk_agent_site_url }}/check_mk/agents/check-mk-agent-{{ checkmk_agent_version }}-1.noarch.rpm" + cee: "{{ __checkmk_agent_site_url }}/check_mk/api/1.0/domain-types/agent/actions/download_by_host/invoke" file: - cre: "{{ checkmk_agent_host_tmp_dir }}/check-mk-agent-{{ checkmk_agent_version }}-1.noarch-vanilla.rpm" - cee: "{{ checkmk_agent_host_tmp_dir }}/check-mk-agent-{{ checkmk_agent_version }}-1.noarch-generic.rpm" - host: "{{ checkmk_agent_host_tmp_dir }}/check-mk-agent-{{ checkmk_agent_version }}-1.noarch-{{ inventory_hostname }}.rpm" + cre: "{{ __checkmk_agent_host_tmp_dir }}/check-mk-agent-{{ checkmk_agent_version }}-1.noarch-vanilla.rpm" + cee: "{{ __checkmk_agent_host_tmp_dir }}/check-mk-agent-{{ checkmk_agent_version }}-1.noarch-generic.rpm" + host: "{{ __checkmk_agent_host_tmp_dir }}/check-mk-agent-{{ checkmk_agent_version }}-1.noarch-{{ inventory_hostname }}.rpm" diff --git a/roles/agent/vars/Suse.yml b/roles/agent/vars/Suse.yml index abfb465da..25b229055 100644 --- a/roles/agent/vars/Suse.yml +++ b/roles/agent/vars/Suse.yml @@ -1,11 +1,11 @@ --- -checkmk_agent_host_tmp_dir: "/tmp" +__checkmk_agent_host_tmp_dir: "/tmp" -checkmk_agent_agent: +__checkmk_agent_agent: url: - cre: "{{ checkmk_agent_site_url }}/check_mk/agents/check-mk-agent-{{ checkmk_agent_version }}-1.noarch.rpm" - cee: "{{ checkmk_agent_site_url }}/check_mk/api/1.0/domain-types/agent/actions/download_by_host/invoke" + cre: "{{ __checkmk_agent_site_url }}/check_mk/agents/check-mk-agent-{{ checkmk_agent_version }}-1.noarch.rpm" + cee: "{{ __checkmk_agent_site_url }}/check_mk/api/1.0/domain-types/agent/actions/download_by_host/invoke" file: - cre: "{{ checkmk_agent_host_tmp_dir }}/check-mk-agent-{{ checkmk_agent_version }}-1.noarch-vanilla.rpm" - cee: "{{ checkmk_agent_host_tmp_dir }}/check-mk-agent-{{ checkmk_agent_version }}-1.noarch-generic.rpm" - host: "{{ checkmk_agent_host_tmp_dir }}/check-mk-agent-{{ checkmk_agent_version }}-1.noarch-{{ inventory_hostname }}.rpm" + cre: "{{ __checkmk_agent_host_tmp_dir }}/check-mk-agent-{{ checkmk_agent_version }}-1.noarch-vanilla.rpm" + cee: "{{ __checkmk_agent_host_tmp_dir }}/check-mk-agent-{{ checkmk_agent_version }}-1.noarch-generic.rpm" + host: "{{ __checkmk_agent_host_tmp_dir }}/check-mk-agent-{{ checkmk_agent_version }}-1.noarch-{{ inventory_hostname }}.rpm" diff --git a/roles/agent/vars/Windows.yml b/roles/agent/vars/Windows.yml index 0bc4c5194..29833d9e0 100644 --- a/roles/agent/vars/Windows.yml +++ b/roles/agent/vars/Windows.yml @@ -1,13 +1,13 @@ --- -checkmk_agent_host_tmp_dir: "C:\\Windows\\Temp" -checkmk_agent_controller_binary_path: "C:\\Program Files (x86)\\checkmk\\service\\cmk-agent-ctl.exe" -checkmk_agent_binary_path: "C:\\Program Files (x86)\\checkmk\\service\\check_mk_agent.exe" +__checkmk_agent_host_tmp_dir: "C:\\Windows\\Temp" +__checkmk_agent_controller_binary_path: "C:\\Program Files (x86)\\checkmk\\service\\cmk-agent-ctl.exe" +__checkmk_agent_binary_path: "C:\\Program Files (x86)\\checkmk\\service\\check_mk_agent.exe" -checkmk_agent_agent: +__checkmk_agent_agent: url: - cre: "{{ checkmk_agent_site_url }}/check_mk/agents/windows/check_mk_agent.msi" - cee: "{{ checkmk_agent_site_url }}/check_mk/api/1.0/domain-types/agent/actions/download_by_host/invoke" + cre: "{{ __checkmk_agent_site_url }}/check_mk/agents/windows/check_mk_agent.msi" + cee: "{{ __checkmk_agent_site_url }}/check_mk/api/1.0/domain-types/agent/actions/download_by_host/invoke" file: - cre: "{{ checkmk_agent_host_tmp_dir }}\\check-mk-agent_{{ checkmk_agent_version }}.msi" - cee: "{{ checkmk_agent_host_tmp_dir }}\\check-mk-agent_{{ checkmk_agent_version }}.msi" - host: "{{ checkmk_agent_host_tmp_dir }}\\check-mk-agent_{{ checkmk_agent_version }}-{{ inventory_hostname }}.msi" + cre: "{{ __checkmk_agent_host_tmp_dir }}\\check-mk-agent_{{ checkmk_agent_version }}.msi" + cee: "{{ __checkmk_agent_host_tmp_dir }}\\check-mk-agent_{{ checkmk_agent_version }}.msi" + host: "{{ __checkmk_agent_host_tmp_dir }}\\check-mk-agent_{{ checkmk_agent_version }}-{{ inventory_hostname }}.msi" diff --git a/roles/agent/vars/main.yml b/roles/agent/vars/main.yml index 225a33273..92a686454 100644 --- a/roles/agent/vars/main.yml +++ b/roles/agent/vars/main.yml @@ -1,18 +1,18 @@ --- -checkmk_agent_site_url: "{{ checkmk_agent_server_protocol }}://{{ checkmk_agent_server }}:{{ checkmk_agent_server_port }}/{{ checkmk_agent_site }}" +__checkmk_agent_site_url: "{{ checkmk_agent_server_protocol }}://{{ checkmk_agent_server }}:{{ checkmk_agent_server_port }}/{{ checkmk_agent_site }}" -checkmk_agent_auth: |- +__checkmk_agent_auth: |- {% if checkmk_agent_secret is defined and checkmk_agent_secret | length %}{{ checkmk_agent_secret }}{% else %}{{ checkmk_agent_pass }}{% endif %} # Due to inconsistent naming of editions, we normalize them here for convenience -checkmk_agent_edition_mapping: +__checkmk_agent_edition_mapping: cre: raw cfe: free cee: enterprise cce: cloud cme: managed -checkmk_agent_files_mapping: +__checkmk_agent_files_mapping: Debian: linux_deb RedHat: linux_rpm Suse: linux_rpm diff --git a/roles/server/README.md b/roles/server/README.md index eee968357..91d963a6f 100644 --- a/roles/server/README.md +++ b/roles/server/README.md @@ -25,7 +25,7 @@ To learn about the distributions used in automated tests, inspect the correspond ## Role Variables - checkmk_server_version: "2.3.0p5" + checkmk_server_version: "2.3.0p6" The global Checkmk version. This is used for installing Checkmk. To manage sites and their version, see `checkmk_server_sites`. diff --git a/roles/server/defaults/main.yml b/roles/server/defaults/main.yml index d28f50157..8e8dd4694 100644 --- a/roles/server/defaults/main.yml +++ b/roles/server/defaults/main.yml @@ -25,7 +25,7 @@ checkmk_server_server_stable_os: - Ubuntu-22 - Ubuntu-24 -checkmk_server_version: "2.3.0p5" +checkmk_server_version: "2.3.0p6" checkmk_server_edition: cre checkmk_server_verify_setup: 'true' diff --git a/roles/server/molecule/2.3.0/group_vars/all.yml b/roles/server/molecule/2.3.0/group_vars/all.yml index e2459864d..6e1d82d7c 100644 --- a/roles/server/molecule/2.3.0/group_vars/all.yml +++ b/roles/server/molecule/2.3.0/group_vars/all.yml @@ -1,6 +1,6 @@ --- # General -checkmk_var_version: "2.3.0p5" +checkmk_var_version: "2.3.0p6" checkmk_var_edition: "cre" checkmk_server_verify_setup: 'true' checkmk_var_server_url: "http://127.0.0.1/" diff --git a/roles/server/tasks/Debian.yml b/roles/server/tasks/Debian.yml index d333332ff..76a550c1e 100644 --- a/roles/server/tasks/Debian.yml +++ b/roles/server/tasks/Debian.yml @@ -1,9 +1,9 @@ --- - name: "Install Checkmk Server." - when: not 'check-mk-' + checkmk_server_edition_mapping[checkmk_server_edition] + '-' +checkmk_server_version in ansible_facts.packages + when: not 'check-mk-' + __checkmk_server_edition_mapping[checkmk_server_edition] + '-' +checkmk_server_version in ansible_facts.packages become: true ansible.builtin.apt: - deb: "/tmp/{{ checkmk_server_setup_file }}" + deb: "/tmp/{{ __checkmk_server_setup_file }}" update_cache: 'yes' state: present notify: Start Apache diff --git a/roles/server/tasks/RedHat.yml b/roles/server/tasks/RedHat.yml index ecce0dd66..a42237317 100644 --- a/roles/server/tasks/RedHat.yml +++ b/roles/server/tasks/RedHat.yml @@ -6,7 +6,7 @@ block: - name: "Download EPEL GPG Key on CentOS & RHEL 8." ansible.builtin.get_url: - url: "{{ checkmk_server_epel_gpg_key }}" + url: "{{ __checkmk_server_epel_gpg_key }}" dest: "/tmp/EPEL-pubkey.gpg" mode: "0640" when: checkmk_server_verify_setup | bool @@ -27,7 +27,7 @@ - name: "Install epel-release from URL on CentOS & RHEL 8." become: true ansible.builtin.dnf: - name: "{{ checkmk_server_epel_url }}" + name: "{{ __checkmk_server_epel_url }}" state: present disable_gpg_check: "{{ not checkmk_server_epel_gpg_check | bool }}" tags: @@ -77,10 +77,10 @@ - enable-repos - name: "Install Checkmk Server." - when: not 'check-mk-' + checkmk_server_edition_mapping[checkmk_server_edition] + '-' +checkmk_server_version in ansible_facts.packages + when: not 'check-mk-' + __checkmk_server_edition_mapping[checkmk_server_edition] + '-' +checkmk_server_version in ansible_facts.packages become: true ansible.builtin.dnf: - name: "/tmp/{{ checkmk_server_setup_file }}" + name: "/tmp/{{ __checkmk_server_setup_file }}" state: present disable_gpg_check: '{{ not checkmk_server_verify_setup | bool }}' notify: Start httpd @@ -112,5 +112,5 @@ permanent: true immediate: true state: enabled - loop: "{{ checkmk_server_ports }}" + loop: "{{ __checkmk_server_ports }}" when: checkmk_server_configure_firewall | bool diff --git a/roles/server/tasks/main.yml b/roles/server/tasks/main.yml index 7f9461700..b8e5a5149 100644 --- a/roles/server/tasks/main.yml +++ b/roles/server/tasks/main.yml @@ -9,7 +9,7 @@ - name: "Preflight - Fail if Checkmk Edition is incorrect." ansible.builtin.fail: msg: "The provided Checkmk Edition '{{ checkmk_server_edition | lower }}' does not exist or is not supported by this role." - when: checkmk_server_edition | lower not in checkmk_server_edition_mapping + when: checkmk_server_edition | lower not in __checkmk_server_edition_mapping - name: "Include OS Family specific Variables." ansible.builtin.include_vars: "{{ ansible_os_family }}.yml" @@ -32,19 +32,19 @@ name: "{{ item }}" state: present loop: - - "{{ checkmk_server_prerequisites }}" + - "{{ __checkmk_server_prerequisites }}" tags: - install-package - install-prerequisites - name: "Downloads Management." - when: not 'check-mk-' + checkmk_server_edition_mapping[checkmk_server_edition] + '-' +checkmk_server_version in ansible_facts.packages + when: not 'check-mk-' + __checkmk_server_edition_mapping[checkmk_server_edition] + '-' +checkmk_server_version in ansible_facts.packages block: - name: "Download Checkmk Server Setup." ansible.builtin.get_url: url: "{{ checkmk_server_download_url }}" - dest: "/tmp/{{ checkmk_server_setup_file }}" + dest: "/tmp/{{ __checkmk_server_setup_file }}" mode: "0640" url_username: "{{ checkmk_server_download_user | default(omit) }}" url_password: "{{ checkmk_server_download_pass | default(omit) }}" @@ -67,17 +67,17 @@ block: - name: "Import Checkmk GPG Key." ansible.builtin.command: "gpg --import /tmp/Check_MK-pubkey.gpg" - register: checkmk_server_gpg_import + register: __checkmk_server_gpg_import when: checkmk_server_verify_setup | bool - changed_when: "'imported: 1' in checkmk_server_gpg_import" + changed_when: "'imported: 1' in __checkmk_server_gpg_import" tags: - import-gpg-key - name: "Verify Checkmk Setup." - ansible.builtin.command: gpg --verify "/tmp/{{ checkmk_server_setup_file }}" - register: checkmk_server_verify_state + ansible.builtin.command: gpg --verify "/tmp/{{ __checkmk_server_setup_file }}" + register: __checkmk_server_verify_state changed_when: false - failed_when: "'Bad signature' in checkmk_server_verify_state.stderr" + failed_when: "'Bad signature' in __checkmk_server_verify_state.stderr" - name: "Import Checkmk GPG Key." become: true @@ -102,8 +102,8 @@ omd cleanup args: executable: /bin/bash - changed_when: "'Uninstalling' in checkmk_server_cleanup_state.stdout" - register: checkmk_server_cleanup_state + changed_when: "'Uninstalling' in __checkmk_server_cleanup_state.stdout" + register: __checkmk_server_cleanup_state when: checkmk_server_cleanup | bool tags: - cleanup diff --git a/roles/server/tasks/sites.yml b/roles/server/tasks/sites.yml index 5d0857d84..ba035d0f4 100644 --- a/roles/server/tasks/sites.yml +++ b/roles/server/tasks/sites.yml @@ -10,7 +10,7 @@ no_log: "{{ checkmk_server_no_log | bool }}" loop: "{{ checkmk_server_sites }}" when: item.state != "absent" - register: checkmk_server_sites_created + register: __checkmk_server_sites_created tags: - create-sites @@ -23,15 +23,15 @@ executable: /bin/bash no_log: "{{ checkmk_server_no_log | bool }}" loop: "{{ checkmk_server_sites }}" - changed_when: "checkmk_server_sites_versions.stdout != item.version + '.' + checkmk_server_edition | lower" + changed_when: "__checkmk_server_sites_versions.stdout != item.version + '.' + checkmk_server_edition | lower" when: item.state != "absent" - register: checkmk_server_sites_versions + register: __checkmk_server_sites_versions tags: - update-sites - name: "Include update site tasks." # noqa no-handler ansible.builtin.include_tasks: update-site.yml - loop: "{{ checkmk_server_sites_versions.results }}" + loop: "{{ __checkmk_server_sites_versions.results }}" when: "item.changed" tags: - update-sites @@ -50,8 +50,8 @@ no_log: "{{ checkmk_server_no_log | bool }}" loop: "{{ checkmk_server_sites }}" when: (item.state == "enabled") or (item.state == "started") - register: checkmk_server_sites_stopped - changed_when: "'Autostart enabled.' in checkmk_server_sites_stopped.stdout" + register: __checkmk_server_sites_stopped + changed_when: "'Autostart enabled.' in __checkmk_server_sites_stopped.stdout" tags: - enable-sites @@ -66,7 +66,7 @@ no_log: "{{ checkmk_server_no_log | bool }}" loop: "{{ checkmk_server_sites }}" when: item.state == "started" - register: checkmk_server_sites_started + register: __checkmk_server_sites_started tags: - start-sites @@ -81,7 +81,7 @@ no_log: "{{ checkmk_server_no_log | bool }}" loop: "{{ checkmk_server_sites }}" when: item.state != "started" - register: checkmk_server_sites_stopped + register: __checkmk_server_sites_stopped tags: - stop-sites @@ -98,8 +98,8 @@ no_log: "{{ checkmk_server_no_log | bool }}" loop: "{{ checkmk_server_sites }}" when: (item.state == "disabled") or (item.state == "present") or (item.state == "stopped") - register: checkmk_server_sites_stopped - changed_when: "'Autostart disabled.' in checkmk_server_sites_stopped.stdout" + register: __checkmk_server_sites_stopped + changed_when: "'Autostart disabled.' in __checkmk_server_sites_stopped.stdout" tags: - disable-sites @@ -114,7 +114,7 @@ no_log: "{{ checkmk_server_no_log | bool }}" loop: "{{ checkmk_server_sites }}" when: item.state == "absent" - register: checkmk_server_sites_removed + register: __checkmk_server_sites_removed tags: - destroy-sites @@ -162,8 +162,8 @@ ansible.builtin.debug: msg: - "Just a trigger." - loop: "{{ checkmk_server_sites_created.results }}" - when: checkmk_server_sites_created.changed | bool and not item.item.admin_pw is defined + loop: "{{ __checkmk_server_sites_created.results }}" + when: __checkmk_server_sites_created.changed | bool and not item.item.admin_pw is defined changed_when: true notify: Warn site admin password no_log: "{{ checkmk_server_no_log | bool }}" diff --git a/roles/server/tasks/update-site.yml b/roles/server/tasks/update-site.yml index 6e5fd93b4..4b4946c32 100644 --- a/roles/server/tasks/update-site.yml +++ b/roles/server/tasks/update-site.yml @@ -11,7 +11,7 @@ omd versions | egrep -o '{{ item.item.version }}.{{ checkmk_server_edition | lower }}' args: executable: /bin/bash - register: checkmk_server_sites_versions + register: __checkmk_server_sites_versions changed_when: false - name: "Fail if this is a downgrade." @@ -64,5 +64,5 @@ omd -f -V {{ item.item.version }}.{{ checkmk_server_edition | lower }} update --conflict {{ item.item.update_conflict_resolution }} {{ item.item.name }} args: executable: /bin/bash - register: checkmk_server_sites_updated - changed_when: ("Finished update" in checkmk_server_sites_updated.stdout) + register: __checkmk_server_sites_updated + changed_when: ("Finished update" in __checkmk_server_sites_updated.stdout) diff --git a/roles/server/vars/Debian.yml b/roles/server/vars/Debian.yml index 36c07a4cd..619e4537e 100644 --- a/roles/server/vars/Debian.yml +++ b/roles/server/vars/Debian.yml @@ -1,8 +1,8 @@ --- -checkmk_server_setup_file: |- - check-mk-{{ checkmk_server_edition_mapping[checkmk_server_edition | lower] }}-{{ checkmk_server_version }}_0.{{ ansible_distribution_release }}_amd64.deb +__checkmk_server_setup_file: |- + check-mk-{{ __checkmk_server_edition_mapping[checkmk_server_edition | lower] }}-{{ checkmk_server_version }}_0.{{ ansible_distribution_release }}_amd64.deb -checkmk_server_prerequisites: +__checkmk_server_prerequisites: - freeipmi - gpg - gpg-agent diff --git a/roles/server/vars/RedHat.yml b/roles/server/vars/RedHat.yml index 1177694d2..d28da0c70 100644 --- a/roles/server/vars/RedHat.yml +++ b/roles/server/vars/RedHat.yml @@ -1,14 +1,14 @@ --- -checkmk_server_setup_file: |- - check-mk-{{ checkmk_server_edition_mapping[checkmk_server_edition | lower] }}-{{ checkmk_server_version }}-el{{ ansible_distribution_major_version }}-38.x86_64.rpm +__checkmk_server_setup_file: |- + check-mk-{{ __checkmk_server_edition_mapping[checkmk_server_edition | lower] }}-{{ checkmk_server_version }}-el{{ ansible_distribution_major_version }}-38.x86_64.rpm -checkmk_server_ports: +__checkmk_server_ports: - 80/tcp - 443/tcp - 8000/tcp -checkmk_server_prerequisites_per_distro: +__checkmk_server_prerequisites_per_distro: RedHat: - firewalld - dnf-plugins-core @@ -37,9 +37,8 @@ checkmk_server_prerequisites_per_distro: - dnf-plugins-core - python3-libsemanage +__checkmk_server_prerequisites: "{{ __checkmk_server_prerequisites_per_distro[ansible_facts.distribution ~ '-' ~ ansible_facts.distribution_major_version] + | default( __checkmk_server_prerequisites_per_distro[ ansible_distribution_file_variety ]) }}" -checkmk_server_prerequisites: "{{ checkmk_server_prerequisites_per_distro[ansible_facts.distribution ~ '-' ~ ansible_facts.distribution_major_version] - | default( checkmk_server_prerequisites_per_distro[ ansible_distribution_file_variety ]) }}" - -checkmk_server_epel_url: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_facts.distribution_major_version }}.noarch.rpm" -checkmk_server_epel_gpg_key: "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-{{ ansible_facts.distribution_major_version }}" +__checkmk_server_epel_url: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_facts.distribution_major_version }}.noarch.rpm" +__checkmk_server_epel_gpg_key: "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-{{ ansible_facts.distribution_major_version }}" diff --git a/roles/server/vars/main.yml b/roles/server/vars/main.yml index 72a2e387d..0ae79183f 100644 --- a/roles/server/vars/main.yml +++ b/roles/server/vars/main.yml @@ -1,9 +1,9 @@ --- -checkmk_server_base_url: "https://download.checkmk.com/checkmk" -checkmk_server_download_url: "{{ checkmk_server_base_url }}/{{ checkmk_server_version }}/{{ checkmk_server_setup_file }}" +__checkmk_server_base_url: "https://download.checkmk.com/checkmk" +checkmk_server_download_url: "{{ __checkmk_server_base_url }}/{{ checkmk_server_version }}/{{ __checkmk_server_setup_file }}" # Due to inconsistent naming of editions, we normalize them here for convenience -checkmk_server_edition_mapping: +__checkmk_server_edition_mapping: cre: raw cfe: free cee: enterprise diff --git a/scripts/release.sh b/scripts/release.sh index bd5ae53ac..a24a26981 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -17,7 +17,7 @@ collection_dir="${script_dir%/*}" # Update these as necessary: checkmk_ancient="2.1.0p44" checkmk_oldstable="2.2.0p27" -checkmk_stable="2.3.0p5" +checkmk_stable="2.3.0p6" while getopts 's:t:' OPTION; do case "$OPTION" in diff --git a/tests/integration/files/includes/tasks/prep.yml b/tests/integration/files/includes/tasks/prep.yml index f9b515aad..018511bd2 100644 --- a/tests/integration/files/includes/tasks/prep.yml +++ b/tests/integration/files/includes/tasks/prep.yml @@ -1,4 +1,8 @@ --- +- name: "Print OS Information." + ansible.builtin.debug: + var: ansible_lsb + - name: "Install dependencies." ansible.builtin.package: name: python3-apt @@ -17,7 +21,7 @@ loop: "{{ test_sites }}" when: | ((download_pass is defined and download_pass | length) or item.edition == "cre") - and not 'check-mk-' + checkmk_server_edition_mapping[item.edition] + '-' +item.version in ansible_facts.packages + and not 'check-mk-' + __checkmk_server_edition_mapping[item.edition] + '-' +item.version in ansible_facts.packages - name: "Install Checkmk Versions." ansible.builtin.apt: @@ -26,7 +30,7 @@ loop: "{{ test_sites }}" when: | ((download_pass is defined and download_pass | length) or item.edition == "cre") - and not 'check-mk-' + checkmk_server_edition_mapping[item.edition] + '-' +item.version in ansible_facts.packages + and not 'check-mk-' + __checkmk_server_edition_mapping[item.edition] + '-' +item.version in ansible_facts.packages - name: "Create Sites." ansible.builtin.command: "omd -V {{ item.version }}.{{ item.edition }} create --no-tmpfs --admin-password {{ checkmk_var_automation_secret }} {{ item.site }}" diff --git a/tests/integration/files/includes/vars/global.yml b/tests/integration/files/includes/vars/global.yml index f243be9f5..cd11de102 100644 --- a/tests/integration/files/includes/vars/global.yml +++ b/tests/integration/files/includes/vars/global.yml @@ -5,12 +5,12 @@ checkmk_var_automation_user: "cmkadmin" checkmk_var_automation_secret: "Sup3rSec4et!" # Generate download URL and provide credentials to download Checkmk setups -download_url: "https://download.checkmk.com/checkmk/{{ item.version }}/check-mk-{{ checkmk_server_edition_mapping[item.edition] }}-{{ item.version }}_0.{{ ansible_distribution_release }}_amd64.deb" # noqa yaml[line-length] +download_url: "https://download.checkmk.com/checkmk/{{ item.version }}/check-mk-{{ __checkmk_server_edition_mapping[item.edition] }}-{{ item.version }}_0.{{ ansible_distribution_release }}_amd64.deb" # noqa yaml[line-length] download_user: "d-gh-ansible-dl" download_pass: "{{ lookup('ansible.builtin.file', '/root/ansible_collections/checkmk/general/tests/integration/files/.dl-secret', errors='ignore') | default(omit) }}" # noqa yaml[line-length] # Due to inconsistent naming of editions, we normalize them here for convenience -checkmk_server_edition_mapping: +__checkmk_server_edition_mapping: cre: raw cee: enterprise cce: cloud diff --git a/tests/integration/targets/activation/vars/main.yml b/tests/integration/targets/activation/vars/main.yml index 1fd76dde8..f585e889e 100644 --- a/tests/integration/targets/activation/vars/main.yml +++ b/tests/integration/targets/activation/vars/main.yml @@ -1,9 +1,9 @@ --- test_sites: - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cre" site: "stable_cre" - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cee" site: "stable_cee" - version: "2.2.0p27" diff --git a/tests/integration/targets/bakery/vars/main.yml b/tests/integration/targets/bakery/vars/main.yml index 9b1d69f8c..7a5134e76 100644 --- a/tests/integration/targets/bakery/vars/main.yml +++ b/tests/integration/targets/bakery/vars/main.yml @@ -1,14 +1,14 @@ --- test_sites: - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cee" site: "stable_cee" - version: "2.2.0p27" edition: "cee" site: "old_cee" - - version: "2.1.0p44" - edition: "cee" - site: "ancient_cee" + # - version: "2.1.0p44" + # edition: "cee" + # site: "ancient_cee" signature_key_id: 1 signature_key_passphrase: "{{ checkmk_var_automation_secret }}" diff --git a/tests/integration/targets/contact_group/vars/main.yml b/tests/integration/targets/contact_group/vars/main.yml index 9af32b735..88c89f580 100644 --- a/tests/integration/targets/contact_group/vars/main.yml +++ b/tests/integration/targets/contact_group/vars/main.yml @@ -1,20 +1,20 @@ --- test_sites: - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cme" site: "stable_cme" - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cee" site: "stable_cee" - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cre" site: "stable_cre" - version: "2.2.0p27" edition: "cre" site: "old_cre" - - version: "2.1.0p44" - edition: "cre" - site: "ancient_cre" + # - version: "2.1.0p44" + # edition: "cre" + # site: "ancient_cre" checkmk_contact_groups_create: - name: "test1" diff --git a/tests/integration/targets/discovery/vars/main.yml b/tests/integration/targets/discovery/vars/main.yml index b3b03d38a..ae77e6b40 100644 --- a/tests/integration/targets/discovery/vars/main.yml +++ b/tests/integration/targets/discovery/vars/main.yml @@ -1,17 +1,17 @@ --- test_sites: - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cee" site: "stable_cee" - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cre" site: "stable_cre" - version: "2.2.0p27" edition: "cre" site: "old_cre" - - version: "2.1.0p44" - edition: "cre" - site: "ancient_cre" + # - version: "2.1.0p44" + # edition: "cre" + # site: "ancient_cre" checkmk_hosts: - name: test1.tld diff --git a/tests/integration/targets/downtime/vars/main.yml b/tests/integration/targets/downtime/vars/main.yml index 8c4301d99..c330700fe 100644 --- a/tests/integration/targets/downtime/vars/main.yml +++ b/tests/integration/targets/downtime/vars/main.yml @@ -1,17 +1,17 @@ --- test_sites: - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cee" site: "stable_cee" - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cre" site: "stable_cre" - version: "2.2.0p27" edition: "cre" site: "old_cre" - - version: "2.1.0p44" - edition: "cre" - site: "ancient_cre" + # - version: "2.1.0p44" + # edition: "cre" + # site: "ancient_cre" checkmk_hosts: - name: test1.tld diff --git a/tests/integration/targets/folder/vars/main.yml b/tests/integration/targets/folder/vars/main.yml index 8b611a37e..dbcf54d20 100644 --- a/tests/integration/targets/folder/vars/main.yml +++ b/tests/integration/targets/folder/vars/main.yml @@ -1,17 +1,17 @@ --- test_sites: - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cee" site: "stable_cee" - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cre" site: "stable_cre" - version: "2.2.0p27" edition: "cre" site: "old_cre" - - version: "2.1.0p44" - edition: "cre" - site: "ancient_cre" + # - version: "2.1.0p44" + # edition: "cre" + # site: "ancient_cre" checkmk_var_folders: - path: /test diff --git a/tests/integration/targets/host/vars/main.yml b/tests/integration/targets/host/vars/main.yml index db80bc402..09b9540c6 100644 --- a/tests/integration/targets/host/vars/main.yml +++ b/tests/integration/targets/host/vars/main.yml @@ -1,17 +1,17 @@ --- test_sites: - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cre" site: "stable_cre" - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cee" site: "stable_cee" - version: "2.2.0p27" edition: "cre" site: "old_cre" - - version: "2.1.0p44" - edition: "cre" - site: "ancient_cre" + # - version: "2.1.0p44" + # edition: "cre" + # site: "ancient_cre" checkmk_var_folders: - path: /foo diff --git a/tests/integration/targets/host_group/vars/main.yml b/tests/integration/targets/host_group/vars/main.yml index 780d6adcf..95b148a57 100644 --- a/tests/integration/targets/host_group/vars/main.yml +++ b/tests/integration/targets/host_group/vars/main.yml @@ -1,20 +1,20 @@ --- test_sites: - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cme" site: "stable_cme" - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cee" site: "stable_cee" - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cre" site: "stable_cre" - version: "2.2.0p27" edition: "cre" site: "old_cre" - - version: "2.1.0p44" - edition: "cre" - site: "ancient_cre" + # - version: "2.1.0p44" + # edition: "cre" + # site: "ancient_cre" checkmk_host_groups_create: - name: "test1" diff --git a/tests/integration/targets/lookup_bakery/vars/main.yml b/tests/integration/targets/lookup_bakery/vars/main.yml index d11082443..2a38841d5 100644 --- a/tests/integration/targets/lookup_bakery/vars/main.yml +++ b/tests/integration/targets/lookup_bakery/vars/main.yml @@ -1,11 +1,11 @@ --- test_sites: - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cee" site: "stable_cee" - version: "2.2.0p27" edition: "cee" site: "old_cee" - - version: "2.1.0p44" - edition: "cee" - site: "ancient_cee" + # - version: "2.1.0p44" + # edition: "cee" + # site: "ancient_cee" diff --git a/tests/integration/targets/lookup_folder/vars/main.yml b/tests/integration/targets/lookup_folder/vars/main.yml index 62c0680a6..380a1a7cb 100644 --- a/tests/integration/targets/lookup_folder/vars/main.yml +++ b/tests/integration/targets/lookup_folder/vars/main.yml @@ -1,17 +1,17 @@ --- test_sites: - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cee" site: "stable_cee" - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cre" site: "stable_cre" - version: "2.2.0p27" edition: "cre" site: "old_cre" - - version: "2.1.0p44" - edition: "cre" - site: "ancient_cre" + # - version: "2.1.0p44" + # edition: "cre" + # site: "ancient_cre" checkmk_folder: name: "Folder 1" diff --git a/tests/integration/targets/lookup_folders/vars/main.yml b/tests/integration/targets/lookup_folders/vars/main.yml index c747dd8de..788aa6eea 100644 --- a/tests/integration/targets/lookup_folders/vars/main.yml +++ b/tests/integration/targets/lookup_folders/vars/main.yml @@ -1,17 +1,17 @@ --- test_sites: - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cee" site: "stable_cee" - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cre" site: "stable_cre" - version: "2.2.0p27" edition: "cre" site: "old_cre" - - version: "2.1.0p44" - edition: "cre" - site: "ancient_cre" + # - version: "2.1.0p44" + # edition: "cre" + # site: "ancient_cre" checkmk_var_folders: - name: "Folder 1" diff --git a/tests/integration/targets/lookup_host/vars/main.yml b/tests/integration/targets/lookup_host/vars/main.yml index b88415831..3b9a8db3a 100644 --- a/tests/integration/targets/lookup_host/vars/main.yml +++ b/tests/integration/targets/lookup_host/vars/main.yml @@ -1,17 +1,17 @@ --- test_sites: - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cee" site: "stable_cee" - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cre" site: "stable_cre" - version: "2.2.0p27" edition: "cre" site: "old_cre" - - version: "2.1.0p44" - edition: "cre" - site: "ancient_cre" + # - version: "2.1.0p44" + # edition: "cre" + # site: "ancient_cre" checkmk_host: name: "host1.tld" diff --git a/tests/integration/targets/lookup_hosts/vars/main.yml b/tests/integration/targets/lookup_hosts/vars/main.yml index 117af9770..9c859c5fa 100644 --- a/tests/integration/targets/lookup_hosts/vars/main.yml +++ b/tests/integration/targets/lookup_hosts/vars/main.yml @@ -1,17 +1,17 @@ --- test_sites: - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cee" site: "stable_cee" - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cre" site: "stable_cre" - version: "2.2.0p27" edition: "cre" site: "old_cre" - - version: "2.1.0p44" - edition: "cre" - site: "ancient_cre" + # - version: "2.1.0p44" + # edition: "cre" + # site: "ancient_cre" checkmk_hosts: - name: "host1.tld" diff --git a/tests/integration/targets/lookup_rules/vars/main.yml b/tests/integration/targets/lookup_rules/vars/main.yml index f7aa3234c..564eda6bc 100644 --- a/tests/integration/targets/lookup_rules/vars/main.yml +++ b/tests/integration/targets/lookup_rules/vars/main.yml @@ -1,17 +1,17 @@ --- test_sites: - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cee" site: "stable_cee" - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cre" site: "stable_cre" - version: "2.2.0p27" edition: "cre" site: "old_cre" - - version: "2.1.0p44" - edition: "cre" - site: "ancient_cre" + # - version: "2.1.0p44" + # edition: "cre" + # site: "ancient_cre" checkmk_rulesets: - "checkgroup_parameters:filesystem" diff --git a/tests/integration/targets/lookup_rulesets/vars/main.yml b/tests/integration/targets/lookup_rulesets/vars/main.yml index 51efe5775..0b769156b 100644 --- a/tests/integration/targets/lookup_rulesets/vars/main.yml +++ b/tests/integration/targets/lookup_rulesets/vars/main.yml @@ -1,17 +1,17 @@ --- test_sites: - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cee" site: "stable_cee" - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cre" site: "stable_cre" - version: "2.2.0p27" edition: "cre" site: "old_cre" - - version: "2.1.0p44" - edition: "cre" - site: "ancient_cre" + # - version: "2.1.0p44" + # edition: "cre" + # site: "ancient_cre" checkmk_ruleset_regexes: - "checkgroup_parameters:filesystem" diff --git a/tests/integration/targets/lookup_version/vars/main.yml b/tests/integration/targets/lookup_version/vars/main.yml index 2f18253b6..27dae0a2f 100644 --- a/tests/integration/targets/lookup_version/vars/main.yml +++ b/tests/integration/targets/lookup_version/vars/main.yml @@ -1,14 +1,14 @@ --- test_sites: - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cee" site: "stable_cee" - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cre" site: "stable_cre" - version: "2.2.0p27" edition: "cre" site: "old_cre" - - version: "2.1.0p44" - edition: "cre" - site: "ancient_cre" + # - version: "2.1.0p44" + # edition: "cre" + # site: "ancient_cre" diff --git a/tests/integration/targets/password/vars/main.yml b/tests/integration/targets/password/vars/main.yml index 93100f1dc..c12b45baf 100644 --- a/tests/integration/targets/password/vars/main.yml +++ b/tests/integration/targets/password/vars/main.yml @@ -1,20 +1,20 @@ --- test_sites: - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cme" site: "stable_cme" - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cee" site: "stable_cee" - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cre" site: "stable_cre" - version: "2.2.0p27" edition: "cre" site: "old_cre" - - version: "2.1.0p44" - edition: "cre" - site: "ancient_cre" + # - version: "2.1.0p44" + # edition: "cre" + # site: "ancient_cre" checkmk_passwords_create: - name: "pwtest1" diff --git a/tests/integration/targets/rule/vars/main.yml b/tests/integration/targets/rule/vars/main.yml index 2f18253b6..27dae0a2f 100644 --- a/tests/integration/targets/rule/vars/main.yml +++ b/tests/integration/targets/rule/vars/main.yml @@ -1,14 +1,14 @@ --- test_sites: - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cee" site: "stable_cee" - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cre" site: "stable_cre" - version: "2.2.0p27" edition: "cre" site: "old_cre" - - version: "2.1.0p44" - edition: "cre" - site: "ancient_cre" + # - version: "2.1.0p44" + # edition: "cre" + # site: "ancient_cre" diff --git a/tests/integration/targets/service_group/vars/main.yml b/tests/integration/targets/service_group/vars/main.yml index 62ebec255..50b072c65 100644 --- a/tests/integration/targets/service_group/vars/main.yml +++ b/tests/integration/targets/service_group/vars/main.yml @@ -1,20 +1,20 @@ --- test_sites: - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cme" site: "stable_cme" - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cee" site: "stable_cee" - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cre" site: "stable_cre" - version: "2.2.0p27" edition: "cre" site: "old_cre" - - version: "2.1.0p44" - edition: "cre" - site: "ancient_cre" + # - version: "2.1.0p44" + # edition: "cre" + # site: "ancient_cre" checkmk_service_groups_create: - name: "test1" diff --git a/tests/integration/targets/tag_group/vars/main.yml b/tests/integration/targets/tag_group/vars/main.yml index 9e46f3e48..bfc6b4669 100644 --- a/tests/integration/targets/tag_group/vars/main.yml +++ b/tests/integration/targets/tag_group/vars/main.yml @@ -1,20 +1,20 @@ --- test_sites: - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cme" site: "stable_cme" - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cee" site: "stable_cee" - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cre" site: "stable_cre" - version: "2.2.0p27" edition: "cre" site: "old_cre" - - version: "2.1.0p44" - edition: "cre" - site: "ancient_cre" + # - version: "2.1.0p44" + # edition: "cre" + # site: "ancient_cre" checkmk_taggroups_create: - name: Datacenter diff --git a/tests/integration/targets/timeperiod/vars/main.yml b/tests/integration/targets/timeperiod/vars/main.yml index 566913f02..cad47a10c 100644 --- a/tests/integration/targets/timeperiod/vars/main.yml +++ b/tests/integration/targets/timeperiod/vars/main.yml @@ -1,17 +1,17 @@ --- test_sites: - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cee" site: "stable_cee" - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cre" site: "stable_cre" - version: "2.2.0p27" edition: "cre" site: "old_cre" - - version: "2.1.0p44" - edition: "cre" - site: "ancient_cre" + # - version: "2.1.0p44" + # edition: "cre" + # site: "ancient_cre" checkmk_timeperiods_create: - name: "lunchtime" diff --git a/tests/integration/targets/user/vars/main.yml b/tests/integration/targets/user/vars/main.yml index c3db47f91..103b1e162 100644 --- a/tests/integration/targets/user/vars/main.yml +++ b/tests/integration/targets/user/vars/main.yml @@ -1,20 +1,20 @@ --- test_sites: - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cme" site: "stable_cme" - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cee" site: "stable_cee" - - version: "2.3.0p5" + - version: "2.3.0p6" edition: "cre" site: "stable_cre" - version: "2.2.0p27" edition: "cre" site: "old_cre" - - version: "2.1.0p44" - edition: "cre" - site: "ancient_cre" + # - version: "2.1.0p44" + # edition: "cre" + # site: "ancient_cre" checkmk_var_contact_groups: - team1 diff --git a/tests/sanity/ignore-2.18.txt b/tests/sanity/ignore-2.18.txt index 439637947..7a7996325 100644 --- a/tests/sanity/ignore-2.18.txt +++ b/tests/sanity/ignore-2.18.txt @@ -1,4 +1,5 @@ tests/container/files/systemctl3.py pep8!skip tests/container/files/systemctl3.py pylint!skip tests/container/files/systemctl3.py shebang!skip -tests/container/files/systemctl3.py compile-3.12!skip \ No newline at end of file +tests/container/files/systemctl3.py compile-3.12!skip +tests/container/files/systemctl3.py compile-3.13!skip \ No newline at end of file diff --git a/tests/sanity/ignore-2.19.txt b/tests/sanity/ignore-2.19.txt new file mode 100644 index 000000000..7a7996325 --- /dev/null +++ b/tests/sanity/ignore-2.19.txt @@ -0,0 +1,5 @@ +tests/container/files/systemctl3.py pep8!skip +tests/container/files/systemctl3.py pylint!skip +tests/container/files/systemctl3.py shebang!skip +tests/container/files/systemctl3.py compile-3.12!skip +tests/container/files/systemctl3.py compile-3.13!skip \ No newline at end of file