adfinis / ansible-role-icinga2_master Goto Github PK
View Code? Open in Web Editor NEWThis role is used to configure an icinga2 master
License: GNU General Public License v3.0
This role is used to configure an icinga2 master
License: GNU General Public License v3.0
In several descriptions the default value for include_recursive
in the icinga2 configuration will be overriden.
it is considered best practice to not mess with defaults from icinga package configuration files in the conf.d
.
if you use a different custom directory the structure remains clean after an update. some backup or rpmnew files can be omitted by this practice. maintenance with tools like rpmconf will be easier.
Fresh Debian 11 setup
If lsb_release
isn't installed (which is not on Debian 11), the rolewill fail:
fatal: []: FAILED! => {"msg": "The conditional check '(ansible_lsb.id != 'Univention' or ansible_distribution_release != 'stretch')' failed. The error was: error while evaluating conditional ((ansible_lsb.id != 'Univention' or ansible_distribution_release != 'stretch')): 'dict object' has no attribute 'id'\n\nThe error appears to be in '/tmp/semaphore/.ansible/roles/adfinis-sygroup.icinga2_agent/tasks/installation.yml': line 38, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: configure icinga apt repository\n ^ here\n"}
Run role against Debian 11 Host
Currently, runs for around 100 hosts take approximately 1 minute and 15 seconds. This change would remove one template and have both zone and host configuration in one file.
The runs should be faster. mitogen already helps but shorter runs are better.
ansible 2.9.6
config file = None
configured module search path = ['/Users/christian/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ansible
executable location = /Library/Frameworks/Python.framework/Versions/3.8/bin/ansible
python version = 3.8.2 (v3.8.2:7b3ab5921f, Feb 24 2020, 17:52:18) [Clang 6.0 (clang-600.0.57)]
Apple macOS 10.15.3, but it also applies to other systems.
There are several templates missing in templates.conf
in comparison with the upstream templates.conf
:
generic-host
generic-service
generic-user
Try to deploy Icinga2 using the example playbook on a Debian system:
- hosts: monitoring-master
roles:
- { role: adfinis-sygroup.icinga2_agent }
- { role: adfinis-sygroup.icinga2_master }
Icinga2 master is installed and enabled.
Installing the configuration files fails due to missing templates:
RUNNING HANDLER [adfinis-sygroup.icinga2_master : icinga2_master reload icinga2] ****************************************************************************
fatal: [192.168.0.245]: FAILED! => {"changed": false, "msg": "Unable to reload service icinga2: Job for icinga2.service failed.\nSee \"systemctl status icinga2.service\" and \"journalctl -xe\" for details.\n"}
The status shows that the template generic-user
is unknown:
[2020-04-05 11:12:39 +0100] critical/config: Error: Import references unknown template: 'generic-user'
Location: in /etc/icinga2/conf.d/users.conf: 13:3-13:23
/etc/icinga2/conf.d/users.conf(11):
/etc/icinga2/conf.d/users.conf(12): object User "admin" {
/etc/icinga2/conf.d/users.conf(13): import "generic-user"
^^^^^^^^^^^^^^^^^^^^^
Applying this role with minimal mentioned variables, will result in the following failed task:
TASK [adfinis-sygroup.icinga2_master : create global zones configuration] ******
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ansible.errors.AnsibleUndefinedVariable: 'dict object' has no attribute 'monitoring_sat'
fatal: [icinga2srv01]: FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: 'dict object' has no attribute 'monitoring_sat'"}
fixing may include something of the follwing:
zones.conf.j2
should be more tolerant to missing groupscheck the twilio scripts
ansible 2.9.6
config file = None
configured module search path = ['/Users/christian/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ansible
executable location = /Library/Frameworks/Python.framework/Versions/3.8/bin/ansible
python version = 3.8.2 (v3.8.2:7b3ab5921f, Feb 24 2020, 17:52:18) [Clang 6.0 (clang-600.0.57)]
Apple macOS 10.15.3, but it also applies to other systems.
Currently, the configuration file owner and group is always icinga
which is correct for Red Hat-based systems. Anyhow, Debian-based systems name this user nagios
for "historical reasons" - see also the official documentation: https://icinga.com/docs/icinga2/latest/doc/02-installation/#init-script
Try to deploy Icinga2 using the example playbook on a Debian system:
- hosts: monitoring-master
roles:
- { role: adfinis-sygroup.icinga2_agent }
- { role: adfinis-sygroup.icinga2_master }
Icinga2 master is installed and enabled.
Installing the configuration files fails due to non-existent users and groups:
TASK [adfinis-sygroup.icinga2_master : install icinga2 configuration] ***************************************************************************************
fatal: [192.168.0.245]: FAILED! => {"changed": false, "checksum": "7952b01c49ff5f2250f3a3ded7458b522608500d", "gid": 116, "group": "icinga", "mode": "0640", "msg": "chown failed: failed to look up user icinga", "owner": "icinga", "path": "/etc/icinga2/icinga2.conf", "size": 1799, "state": "file", "uid": 111}
...
Would it not be better to introduce a variable here which might be preinitilized with inventory_hostname but can be overriden?
compare and check with this default? Maybe it should just be this one:
create all needed directories before
error:
TASK [adfinis-sygroup.icinga2_master : add our own host configuration] *********
failed: [icinga2srv01] (item=icinga2srv01) => {"ansible_loop_var": "item", "changed": false, "checksum": "20247d3d1fafa6dd4783b99d1687f904dfabba07", "item": "icinga2srv01", "msg": "Destination directory /etc/icinga2/zones.d/master does not exist"}
reasons:
This Issue is to discuss reverting #51
I think this introduces too much complexity. I've created a PR with a simpler approach: #55
What are your opinions @Nyno-Kun @aconitumnapellus @eyenx
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.