{% extends "base.html" %} {% block title %}Ansible Inventory — Server Monitoring{% endblock %} {% block page_title %}Ansible Inventory{% endblock %} {% block content %}
Inventory Hosts {% set ns = namespace(total=0) %} {% for g in inventory.groups.values() %}{% set ns.total = ns.total + g.hosts|length %}{% endfor %} {{ ns.total }}
{{ inventory.raw_yaml | e }}
{% if inventory.groups %}
{% for group_name, group in inventory.groups.items() %}
{{ group_name }} {{ group.hosts|length }} {% if group_name == 'monitoring_devices' %} default {% endif %}
{% for host in group.hosts %}
{{ host.hostname }} {{ host.get('ansible_host','') }}
{% if host.get('ansible_connection') == 'local' %} local {% elif host.get('ansible_ssh_private_key_file') %} SSH key {% elif host.get('ansible_password') %} password {% else %} {% endif %}
{% else %}
No hosts in this group. Add one
{% endfor %} {% endfor %}
{% else %}

Inventory is empty. Click Sync IPs from DB to import all active devices.

{% endif %}
Groups {{ inventory.groups | length }}
{% if inventory.groups %}
{% for group_name, group in inventory.groups.items() %}

{% if group.hosts %}
{% for host in group.hosts %} {% endfor %}
Hostname IP Auth Remove
{{ host.hostname }} {{ host.get('ansible_host','—') }} {% if host.get('ansible_connection') == 'local' %} local {% elif host.get('ansible_ssh_private_key_file') %} key {% elif host.get('ansible_password') %} pw {% else %} {% endif %}
{% else %}

No hosts in this group.

{% endif %}
{% if group_name != 'monitoring_devices' %} {% endif %}
{% endfor %}
{% else %}

No groups yet. Click New Group to create one.

{% endif %}
Discovered Devices from monitoring database — not yet in inventory {% set avail = db_devices | selectattr('in_inventory','equalto',false) | list %} {{ avail | length }}
{% set avail = db_devices | selectattr('in_inventory','equalto',false) | list %} {% if avail %}
{% for d in avail %} {% endfor %}
Hostname IP Type Status Action
{{ d.hostname }} {{ d.device_ip }} {{ d.device_type or '—' }} {% if d.status == 'active' %} Active {% elif d.status == 'inactive' %} Inactive {% else %} {{ d.status }} {% endif %}
{% elif db_devices %}

All discovered devices are already in the inventory.

{% else %}

No devices discovered yet.

{% endif %}
{% endblock %}