Git initial commit
This commit is contained in:
commit
6af2bb6f5d
8 files changed
+142
No files matched your search
@@ -0,0 +1,9 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) <year> <copyright holders>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# cloud-checkmk
|
||||||
|
|
||||||
|
Ansible role in order to setup a checkmk node for monitoring.
|
||||||
Executable
+28
@@ -0,0 +1,28 @@
|
|||||||
|
---
|
||||||
|
cloud_apps: /opt
|
||||||
|
cloud_storage: /opt/storage
|
||||||
|
cloud_stage: prod
|
||||||
|
cloud_update: false
|
||||||
|
|
||||||
|
domain_external: my-domain.tld
|
||||||
|
|
||||||
|
|
||||||
|
checkmk_edition: free
|
||||||
|
checkmk_version: 2.0.0p22
|
||||||
|
|
||||||
|
checkmk_server_arch: _0.bullseye_amd64.deb
|
||||||
|
checkmk_server_source: "https://download.checkmk.com/checkmk/{{ checkmk_version }}/check-mk-{{ checkmk_edition }}-{{ checkmk_version }}{{ checkmk_server_arch }}"
|
||||||
|
checkmk_server_sites:
|
||||||
|
- monitoring
|
||||||
|
checkmk_server_host: "{{ domain_external }}"
|
||||||
|
checkmk_server_scheme: https
|
||||||
|
# allow requests only from that ip (server), otherwise
|
||||||
|
# metrics are available from the entire world
|
||||||
|
checkmk_server_ip: 12.34.56.78
|
||||||
|
|
||||||
|
checkmk_agent_arch: "-1_all.deb"
|
||||||
|
checkmk_agent_site: "{{ checkmk_server_sites[0] }}"
|
||||||
|
checkmk_agent_source: "{{ checkmk_server_scheme }}://{{ checkmk_server_host }}/{{ checkmk_agent_site }}/check_mk/agents/check-mk-agent_{{ checkmk_version }}{{ checkmk_agent_arch }}"
|
||||||
|
|
||||||
|
checkmk_admin_pass: VeryStrongAdminPass
|
||||||
|
checkmk_is_server: false
|
||||||
Executable
+10
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
- name: restart omd
|
||||||
|
systemd:
|
||||||
|
name: omd
|
||||||
|
state: restarted
|
||||||
|
|
||||||
|
- name: restart xinetd
|
||||||
|
systemd:
|
||||||
|
name: xinetd
|
||||||
|
state: restarted
|
||||||
Executable
+16
@@ -0,0 +1,16 @@
|
|||||||
|
---
|
||||||
|
galaxy_info:
|
||||||
|
role_name: checkmk
|
||||||
|
namespace: hahn-cloud
|
||||||
|
author: Lars Hahn
|
||||||
|
company: OpenDevChain
|
||||||
|
license: MIT
|
||||||
|
description: Role to setup CheckMK as server or agent.
|
||||||
|
min_ansible_version: 2.7
|
||||||
|
platforms:
|
||||||
|
- name: Debian
|
||||||
|
versions:
|
||||||
|
- 11
|
||||||
|
galaxy_tags:
|
||||||
|
- checkmk
|
||||||
|
dependencies: []
|
||||||
Executable
+29
@@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
- name: install checkmk server
|
||||||
|
include_tasks: server.yml
|
||||||
|
when: checkmk_is_server | bool
|
||||||
|
|
||||||
|
- name: install requirements for checkmk agents
|
||||||
|
apt:
|
||||||
|
update_cache: yes
|
||||||
|
state: "{% if cloud_update | bool %}latest{% else %}present{% endif %}"
|
||||||
|
install_recommends: yes
|
||||||
|
pkg:
|
||||||
|
- xinetd
|
||||||
|
|
||||||
|
- name: install agent from monitoring server
|
||||||
|
apt:
|
||||||
|
deb: "{{ checkmk_agent_source }}"
|
||||||
|
state: "{% if cloud_update | bool %}latest{% else %}present{% endif %}"
|
||||||
|
install_recommends: yes
|
||||||
|
ignore_errors: yes
|
||||||
|
# if the monitoring server is not fast enough online...
|
||||||
|
|
||||||
|
- name: restrict metrics access via xinetd only for montoring server
|
||||||
|
lineinfile:
|
||||||
|
path: "/etc/xinetd.d/check_mk"
|
||||||
|
regexp: '^\s*#?only_from\s*='
|
||||||
|
line: "\tonly_from = {{ checkmk_server_ip }}"
|
||||||
|
ignore_errors: yes # if the monitoring server is not fast enough online...
|
||||||
|
notify: restart xinetd
|
||||||
|
|
||||||
Executable
+45
@@ -0,0 +1,45 @@
|
|||||||
|
---
|
||||||
|
- name: install requirements for checkmk
|
||||||
|
apt:
|
||||||
|
update_cache: yes
|
||||||
|
state: "{% if cloud_update | bool %}latest{% else %}present{% endif %}"
|
||||||
|
install_recommends: yes
|
||||||
|
pkg:
|
||||||
|
- python3-passlib
|
||||||
|
|
||||||
|
|
||||||
|
- name: install checkmk from deb file
|
||||||
|
apt:
|
||||||
|
deb: "{{ checkmk_server_source }}"
|
||||||
|
state: "{% if cloud_update | bool %}latest{% else %}present{% endif %}"
|
||||||
|
install_recommends: yes
|
||||||
|
|
||||||
|
# apache2 is default installed via e.g. deb file
|
||||||
|
# in order to run e.g. nginx as webserver, we should disable it
|
||||||
|
- name: adjust apache2 systemd unit state
|
||||||
|
systemd:
|
||||||
|
name: apache2
|
||||||
|
enabled: "{{ checkmk_system_apache2 | default('no') | bool }}"
|
||||||
|
daemon_reload: yes
|
||||||
|
|
||||||
|
- name: generate checkmk sites
|
||||||
|
command:
|
||||||
|
cmd: "omd create {{ item }}"
|
||||||
|
creates: "/omd/sites/{{ item }}"
|
||||||
|
notify: restart omd
|
||||||
|
loop: "{{ checkmk_server_sites }}"
|
||||||
|
|
||||||
|
- name: setup admin password for sites
|
||||||
|
htpasswd:
|
||||||
|
path: "/omd/sites/{{ cmk_site }}/etc/htpasswd"
|
||||||
|
name: "{{ checkmk_admin_user }}"
|
||||||
|
password: "{{ checkmk_admin_pass }}"
|
||||||
|
owner: "{{ cmk_site }}"
|
||||||
|
group: "{{ cmk_site }}"
|
||||||
|
mode: 0660
|
||||||
|
become: yes
|
||||||
|
become_user: "{{ cmk_site }}"
|
||||||
|
loop: "{{ checkmk_server_sites }}"
|
||||||
|
loop_control:
|
||||||
|
loop_var: cmk_site
|
||||||
|
label: "site: {{ cmk_site }}"
|
||||||
Executable
+2
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
checkmk_admin_user: cmkadmin
|
||||||
Reference in new issue
Block a user