Compare commits

...

2 Commits

2 changed files with 27 additions and 4 deletions

View File

@ -30,7 +30,7 @@
ingress_servers: ingress_servers:
- name: matrix.desu.ltd - name: matrix.desu.ltd
proxies: proxies:
- location: "~* ^(\/_matrix|\/_synapse|\/client)" - location: "~* ^(\/_matrix|\/_synapse|\/client|\/health)"
pass: http://synapse:8008 pass: http://synapse:8008
- location: / - location: /
pass: http://element:80 pass: http://element:80

View File

@ -77,15 +77,26 @@ define service {
{% endif %} {% endif %}
# Hostgroups # Hostgroups
# Everything here is dynamically-generated based on tags from Netbox {% for role in query('netbox.netbox.nb_lookup', 'device-roles', api_endpoint='https://netbox.desu.ltd', token=netbox_token) %}
# Device Role: {{ role.value.name }}
# Description: {{ role.value.description }}
# Created: {{ role.value.created }}
# Updated: {{ role.value.last_updated }}
define hostgroup {
hostgroup_name role-{{ role.value.slug }}
alias {{ role.value.display }}
}
{% endfor %}
{% for tag in query('netbox.netbox.nb_lookup', 'tags', api_endpoint='https://netbox.desu.ltd', token=netbox_token) %} {% for tag in query('netbox.netbox.nb_lookup', 'tags', api_endpoint='https://netbox.desu.ltd', token=netbox_token) %}
# Tag: {{ tag.value.name }}
# Description: {{ tag.value.description }}
define hostgroup { define hostgroup {
hostgroup_name tag-{{ tag.value.slug }} hostgroup_name tag-{{ tag.value.slug }}
alias {{ tag.value.display }} alias {{ tag.value.display }}
} }
{% endfor %} {% endfor %}
# This list of hosts is dynamically generated based on devices and VMs tagged with "nagios" in Netbox # Hosts
{% for host in query('netbox.netbox.nb_lookup', 'devices', api_endpoint='https://netbox.desu.ltd', token=netbox_token) + query('netbox.netbox.nb_lookup', 'virtual-machines', api_endpoint='https://netbox.desu.ltd', token=netbox_token)%} {% for host in query('netbox.netbox.nb_lookup', 'devices', api_endpoint='https://netbox.desu.ltd', token=netbox_token) + query('netbox.netbox.nb_lookup', 'virtual-machines', api_endpoint='https://netbox.desu.ltd', token=netbox_token)%}
{% if host.value.primary_ip %} {% if host.value.primary_ip %}
{% for tag in host.value.tags %} {% for tag in host.value.tags %}
@ -98,12 +109,24 @@ define host {
hostgroups ansible{% for tag in host.value.tags %},tag-{{ tag.slug }}{% endfor %} hostgroups ansible{% for tag in host.value.tags %},tag-{{ tag.slug }}{% endfor %}
} }
{% if host.value.config_context.extra_checks is defined %}
{% for check in host.value.config_context.extra_checks %}
define service {
# Config Context check
use ansible-generic-service
service_description {{ check.description }}
check_command {{ check.command }}
host_name {{ host.value.name }}
}
{% endfor %}
{% endif %}
{# #}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
# This list of services is dynamically generated based on services in Netbox and how they're tagged # Services unique to hosts
{% for service in query('netbox.netbox.nb_lookup', 'services', api_endpoint='https://netbox.desu.ltd', token=netbox_token) %} {% for service in query('netbox.netbox.nb_lookup', 'services', api_endpoint='https://netbox.desu.ltd', token=netbox_token) %}
{% if service.value.device %} {% if service.value.device %}
{% set host_name = service.value.device.name %} {% set host_name = service.value.device.name %}