Import SRE inventory code

This commit is contained in:
Daniel Parks 2017-09-11 18:02:43 -07:00
commit 7364ccbff8
No known key found for this signature in database
GPG key ID: 7335138B2B9829EB
18 changed files with 5348 additions and 0 deletions

10
templates/home.html Normal file
View file

@ -0,0 +1,10 @@
{% extends "layout.html" %}
{% block title %}Puppet SRE Infrastructure{% endblock %}
{% block body %}
<h1>Puppet SRE Infrastructure</h1>
<ul>
<li><a href="nodes/index.html">Node inventory</a></li>
<li><a href="roles/index.html">Role inventory</a></li>
<li><a href="services/index.html">Service inventory</a></li>
</ul>
{% endblock %}

28
templates/layout.html Normal file
View file

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>{% block title %}{% endblock %}</title>
<link rel="stylesheet" href="{{ path }}../static/general.css">
<link rel="stylesheet" href="{{ path }}pygments.css">
<script src="{{ path }}../static/moment.js" defer></script>
<script src="{{ path }}../static/general.js" defer></script>
</head>
<body id="{{ body_id }}">
<nav>
<ul>
<li><a href="{{ path }}index.html" class="backward">Home</a></li>
<li><a href="{{ path }}nodes/index.html">Nodes</a></li>
<li><a href="{{ path }}roles/index.html">Roles</a></li>
<li><a href="{{ path }}services/index.html">Services</a></li>
</ul>
</nav>
<main>
{% block body %}{% endblock %}
</main>
<footer>
{% block footer %}{% endblock %}
<div id="generated-at">{{ generation_time }}</div>
</footer>
</body>
</html>

15
templates/node.html Normal file
View file

@ -0,0 +1,15 @@
{% extends "layout.html" %}
{% block title %}Node {{ node["facts"]["fqdn"] }}{% endblock %}
{% block body %}
<h1>Node {{ node["facts"]["fqdn"] }}</h1>
<table>
<tbody>
{% for cell in columns %}
<tr>
{{ cell.head_html() }}
{{ cell.body_html(node) }}
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}

26
templates/nodes.html Normal file
View file

@ -0,0 +1,26 @@
{% extends "layout.html" %}
{% block title %}Node inventory{% endblock %}
{% block body %}
<h1>Node inventory</h1>
<table>
<thead>
<tr>
{% for cell in columns %}
{{ cell.head_html() }}
{% endfor %}
</tr>
</thead>
<tbody>
{% for node in nodes %}
<tr>
{% for cell in columns %}
{{ cell.body_html(node) }}
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}
{% block footer %}
<a href="../nodes.csv">Download CSV</a>
{% endblock %}

27
templates/roles.html Normal file
View file

@ -0,0 +1,27 @@
{% extends "layout.html" %}
{% block title %}Role inventory{% endblock %}
{% block body %}
<h1>Role inventory</h1>
<table>
<thead>
<tr>
<th>Role</th>
<th>Nodes</th>
</tr>
</thead>
<tbody>
{% for role, nodes in roles %}
<tr id="{{ role }}">
<th>{{ role }}</th>
<td>
<ul>
{% for node in nodes | sort(attribute="facts.fqdn") %}
<li><a href="../nodes/{{ node["certname"] }}.html">{{ node["facts"]["fqdn"] }}</a></li>
{% endfor %}
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}

79
templates/service.html Normal file
View file

@ -0,0 +1,79 @@
{% extends "layout.html" %}
{% block title %}Service {{ service["human_name"] }}{% endblock %}
{% block body %}
<h1>Service {{ service["human_name"] }}</h1>
<table>
<tbody>
<tr>
<th>Class</th>
<td>{{ service["class_name"] }}</td>
</tr>
<tr>
<th>Documentation</th>
<td>
<ul>
{% for url in service["doc_urls"] %}
<li><a href="{{ url }}">{{url}}</a></li>
{% endfor %}
</ul>
</td>
</tr>
<tr>
<th>Downtime impact</th>
<td>{{ service["downtime_impact"] | unundef }}</td>
</tr>
<tr>
<th>End users</th>
<td>
{% if service["end_users"] != ":undef" %}
<ul>
{% for email in service["end_users"] %}
<li><a href="mailto:{{ email }}">{{email}}</a></li>
{% endfor %}
</ul>
{% endif %}
</td>
</tr>
<tr>
<th>Escalation period</th>
<td>{{ service["escalation_period"] | unundef }}</td>
</tr>
<tr>
<th>Notes</th>
<td>
<div class="notes">
{{ service["notes"] | unundef | markdown }}
</div>
</td>
</tr>
<tr>
<th>Other FQDNs</th>
<td>
<ul>
{% for fqdn in service["other_fqdns"] %}
<li>{{ fqdn }}</li>
{% endfor %}
</ul>
</td>
</tr>
<tr>
<th>Owner</th>
<td>{{ service["owner_uid"] | unundef }}</td>
</tr>
<tr>
<th>Team</th>
<td>{{ service["team"] | unundef }}</td>
</tr>
<tr>
<th>Nodes</th>
<td>
<ul>
{% for node in service["nodes"] | sort(attribute='facts.fqdn') %}
<li><a href="../nodes/{{ node["certname"] }}.html">{{ node["facts"]["fqdn"] }}</a></li>
{% endfor %}
</ul>
</td>
</tr>
</tbody>
</table>
{% endblock %}

29
templates/services.html Normal file
View file

@ -0,0 +1,29 @@
{% extends "layout.html" %}
{% block title %}Service inventory{% endblock %}
{% block body %}
<h1>Service inventory</h1>
<table>
<thead>
<tr>
<th>Service</th>
<th>Nodes</th>
</tr>
</thead>
<tbody>
{% for service in services %}
<tr id="{{ service }}">
<th>
<a href="./{{ service["class_name"] }}.html">{{ service["human_name"] }}</a>
</th>
<td>
<ul>
{% for node in service["nodes"] | sort(attribute="facts.fqdn") %}
<li><a href="../nodes/{{ node["certname"] }}.html">{{ node["facts"]["fqdn"] }}</a></li>
{% endfor %}
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}