Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/more templates #125

Merged
merged 2 commits into from
Apr 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions templates/server.md.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# <%= @node_data.name %>

## Sections

<% if imported? %>
1. [System](#system)
1. [Network Devices](#network-devices)
1. [Disks](#disks)
<% end %>
<% if @node_data.mutable.notes -%>1. [Notes](#notes)<% end -%>
<% if select_bios %>1. [BIOS Information](#bios-information)<% end %>

<% if imported? %>
## System <a name="system"></a>

### Model

<%= @node_data.lshw.list.node.product %>

### BIOS Version

<%= find_hashes_with_key_value(@node_hash, 'id', 'firmware')&.first['version'] %>

### System Serial Number

<%= @node_data.lshw.list.node.serial %>

### CPU(s)

<% cpus.each do |cpu| %>
#### <%= cpu.id.upcase %>

Model: <%= cpu.model %>
Slot: <%= cpu.slot %>

<% end %>
### RAM

- Total: <%= format_bytes_value(find_total_memory) %>


## Network Devices <a name="network-devices"></a>

| Interface | Speed | MAC |
|-----------|-------|-----|
<% network_devices.each do |net| %>
| <%= net.logicalname %> | <%= net.speed %> | <%= net.serial %> |
<% end %>


## Disks <a name="disk"></a>

| Device | Size |
|--------|------|
<% @node_data.lsblk.disk&.each_pair do |disk, values| %>
| <%= disk %> | <%= values['SIZE'] %> |
<% end %>

<% end %>
<% if @node_data.mutable.notes -%>
## Notes <a name="notes"></a>

<%= @node_data.mutable.notes.split("\n").join("\n ") %>
<% end -%>

<% if select_bios %>
## BIOS Information <a name="bios-information"></a>

<%= select_bios.split("\n").join("\n ") %>
<% end %>

7 changes: 7 additions & 0 deletions templates/switch.md.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# <%= @node_data.name %>

## Port Layout

<% @node_hash['mutable']['map'].each do |port, asset| %>
<%= port %>: <%= asset %>
<% end %>
10 changes: 10 additions & 0 deletions templates/switchFC.md.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<%= @node_data.name %>:
name: <%= @node_data.name %>
primary_group: <%= @node_data.mutable.primary_group %>
secondary_group: <%= @node_data.mutable.secondary_groups %>
info: |
## Port Layout

<% @node_hash['mutable']['map'].each do |port, asset| %>
<%= port %>: <%= asset %>
<% end %>