Add hostgroup for device types

This commit is contained in:
Salt 2022-01-10 23:46:26 -06:00
parent 8517e842b2
commit 0140784111
2 changed files with 10 additions and 1 deletions

View File

@ -227,8 +227,10 @@
# R720
- name: CPU0 Temperature
command: check_by_ssh!/usr/bin/sudo /usr/local/bin/monitoring-scripts/check_temp -w 65 -c 75 --sensor coretemp-isa-0000
hostgroup: device-type-r720
- name: CPU1 Temperature
command: check_by_ssh!/usr/bin/sudo /usr/local/bin/monitoring-scripts/check_temp -w 65 -c 75 --sensor coretemp-isa-0001
hostgroup: device-type-r720
# Device role checks
# hypervisor (which is assumed to be Proxmox)
- name: PVE Unit pve-firewall.service

View File

@ -128,6 +128,13 @@ define hostgroup {
alias {{ tag.value.display }}
}
{% endfor %}
{% for type in query('netbox.netbox.nb_lookup', 'device-types', api_endpoint='https://netbox.desu.ltd', token=netbox_token) %}
# Type: {{ type.value.display }}
define hostgroup {
hostgroup_name device-type-{{ type.value.slug }}
alias {{ type.value.display }}
}
{% endfor %}
# 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)%}
@ -140,7 +147,7 @@ define host {
host_name {{ host.value.name }}
alias {{ host.value.display }}
address {{ host.value.primary_ip.address.split('/',1)[0] }}
hostgroups ansible{% for tag in host.value.tags %},tag-{{ tag.slug }}{% endfor %}{% if host.value.device_role is defined -%},role-{{ host.value.device_role.slug }}{% endif %}{% if host.value.role is defined %},role-{{ host.value.role.slug }}{% endif %}
hostgroups ansible{% for tag in host.value.tags %},tag-{{ tag.slug }}{% endfor %}{% if host.value.device_role is defined -%},role-{{ host.value.device_role.slug }}{% endif %}{% if host.value.role is defined %},role-{{ host.value.role.slug }}{% endif %}{% if host.value.device_type is defined %},device-type-{{ host.value.device_type.slug }}{% endif %}
contact_groups ansible
}