-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #654 from Checkmk/feature/module-distributed
Implement module "site" for configuring distributed monitoring
- Loading branch information
Showing
12 changed files
with
1,740 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# README: | ||
# - When changing the module name, it needs to be changed in 'env:MODULE_NAME' and in 'on:pull_requests:path'! | ||
# | ||
# Resources: | ||
# - Template for this file: https://github.com/ansible-collections/collection_template/blob/main/.github/workflows/ansible-test.yml | ||
# - About Ansible integration tests: https://docs.ansible.com/ansible/latest/dev_guide/testing_integration.html | ||
|
||
env: | ||
NAMESPACE: checkmk | ||
COLLECTION_NAME: general | ||
MODULE_NAME: site | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
name: Ansible Integration Tests for Site Management Module | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 0 * * 0' | ||
pull_request: | ||
branches: | ||
- main | ||
- devel | ||
paths: | ||
- 'plugins/modules/site.py' | ||
push: | ||
paths: | ||
- 'plugins/modules/site.py' | ||
|
||
jobs: | ||
|
||
integration: | ||
runs-on: ubuntu-22.04 | ||
name: Ⓐ${{ matrix.ansible }}+py${{ matrix.python }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
ansible: | ||
- stable-2.15 | ||
- stable-2.16 | ||
- stable-2.17 | ||
- devel | ||
python: | ||
- '3.9' | ||
- '3.10' | ||
- '3.11' | ||
- '3.12' | ||
exclude: | ||
# Exclude unsupported sets. | ||
- ansible: stable-2.15 | ||
python: '3.12' | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
with: | ||
path: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Install ansible-base (${{ matrix.ansible }}) | ||
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check | ||
|
||
- name: Provide secrets file | ||
run: echo "${{ secrets.CHECKMK_DOWNLOAD_PW }}" > ./tests/integration/files/.dl-secret | ||
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} | ||
env: | ||
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 default | ||
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
major_changes: | ||
- Site module - Added a module for distributed monitoring. | ||
Refer to the module documentation for further details. | ||
|
||
known_issues: | ||
- Site module - To completely enable a site, the livestatus certificate | ||
needs to be trusted. This cannot be done with the site module. | ||
As of now, there is no automatic way to do this, so you need to log into | ||
the site and add the certificate to the trusted certificates manually. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
--- | ||
# This playbook uses the inventory from the 'playbooks/hosts' file and expects | ||
# The VM 'debsible' to be running. | ||
|
||
- name: "Install a Central and Remote Site and connect them." | ||
hosts: debsible | ||
strategy: linear | ||
vars: | ||
checkmk_server_version: "2.3.0p14" | ||
checkmk_server_edition: "cre" | ||
checkmk_server_admin_pass: "password" | ||
checkmk_server_sites: | ||
- name: central | ||
version: "{{ checkmk_server_version }}" | ||
state: started | ||
admin_pw: "{{ checkmk_server_admin_pass }}" | ||
update_conflict_resolution: install | ||
- name: remote | ||
version: "{{ checkmk_server_version }}" | ||
state: started | ||
admin_pw: "{{ checkmk_server_admin_pass }}" | ||
update_conflict_resolution: install | ||
omd_auto_restart: 'true' | ||
omd_config: | ||
- var: LIVESTATUS_TCP | ||
value: "on" | ||
- var: LIVESTATUS_TCP_TLS | ||
value: "on" | ||
- var: LIVESTATUS_TCP_PORT | ||
value: "6558" | ||
tasks: | ||
- name: "Install Checkmk and create Sites." | ||
ansible.builtin.import_role: | ||
name: checkmk.general.server | ||
- name: "Connect Central Site to Remote Site." | ||
checkmk.general.site: | ||
server_url: "http://localhost/" | ||
site: "central" | ||
automation_user: "cmkadmin" | ||
automation_secret: "{{ checkmk_server_admin_pass }}" | ||
site_id: "remote" | ||
site_connection: | ||
site_config: | ||
status_connection: | ||
connection: | ||
socket_type: tcp | ||
port: 6558 | ||
encrypted: true | ||
host: localhost | ||
verify: true | ||
proxy: | ||
use_livestatus_daemon: "direct" | ||
connect_timeout: 2 | ||
status_host: | ||
status_host_set: "disabled" | ||
url_prefix: "/remote/" | ||
configuration_connection: | ||
enable_replication: true | ||
url_of_remote_site: "http://localhost/remote/check_mk/" | ||
basic_settings: | ||
site_id: "remote" | ||
alias: "My Remote Site" | ||
state: "present" | ||
- name: "Log in to Remote Site." | ||
checkmk.general.site: | ||
server_url: "http://localhost/" | ||
site: "central" | ||
automation_user: "cmkadmin" | ||
automation_secret: "{{ checkmk_server_admin_pass }}" | ||
site_id: "remote" | ||
site_connection: | ||
authentication: | ||
username: "cmkadmin" | ||
password: "{{ checkmk_server_admin_pass }}" | ||
state: "login" | ||
- name: "Activate Changes on all Sites." | ||
checkmk.general.activation: | ||
server_url: "http://localhost/" | ||
site: "central" | ||
automation_user: "cmkadmin" | ||
automation_secret: "{{ checkmk_server_admin_pass }}" |
Oops, something went wrong.