forked from fboender/ansible-cmdb
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmarkdown_split_detail.tpl
More file actions
163 lines (143 loc) · 7.16 KB
/
Copy pathmarkdown_split_detail.tpl
File metadata and controls
163 lines (143 loc) · 7.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<%
import datetime
%>\
<%def name="r_list(l, depth=0)"><%
t = ""
for v in l:
if type(v) == list:
t += r_list(v, depth+1)
elif type(v) == dict:
t += r_dict(v, depth+1)
else:
t += "* {}\n".format(v)
return t
%></%def>\
<%def name="r_dict(d, depth=0)"><%
t = ""
for k, v in d.items():
t += (" " * depth) + "* **{0}**: ".format(k)
if type(v) == list:
t += "\n{0}".format(r_list(v, depth + 1))
elif type(v) == dict:
t += "\n{0}".format(r_dict(v, depth + 1))
else:
t += "{0}\n".format(v)
return t
%></%def>\
<%def name="col_main_ip(host)"><%
default_ipv4 = ''
if host['ansible_facts'].get('ansible_os_family', '') == 'Windows':
ipv4_addresses = [ip for ip in host['ansible_facts'].get('ansible_ip_addresses', []) if ':' not in ip]
if ipv4_addresses:
default_ipv4 = ipv4_addresses[0]
else:
default_ipv4 = host['ansible_facts'].get('ansible_default_ipv4', {}).get('address', '')
return default_ipv4
%></%def>\
<%def name="col_os(host)"><%
if host['ansible_facts'].get('ansible_distribution', '') in ["OpenBSD"]:
return host['ansible_facts'].get('ansible_distribution', '') + " " + host['ansible_facts'].get('ansible_distribution_release', '')
else:
return host['ansible_facts'].get('ansible_distribution', '') + " " + host['ansible_facts'].get('ansible_distribution_version', '')
endif
%></%def>\
<%def name="col_arch(host)"><%
return host['ansible_facts'].get('ansible_architecture', '') + " / " + host['ansible_facts'].get('ansible_userspace_architecture', '')
%></%def>\
<%def name="col_virt(host)"><%
return host['ansible_facts'].get('ansible_virtualization_type', '?') + " / " + host['ansible_facts'].get('ansible_virtualization_role', '?')
%></%def>\
<%def name="col_cpu_type(host)"><%
cpu_type = host['ansible_facts'].get('ansible_processor', 0)
if isinstance(cpu_type, list):
return cpu_type[-1]
endif
%></%def>\
<%def name="col_vcpus(host)"><%
return host['ansible_facts'].get('ansible_processor_vcpus', host['ansible_facts'].get('ansible_processor_cores', 0))
%></%def>\
<%def name="col_ram(host)"><%
return '%0.0f' % ((int(host['ansible_facts'].get('ansible_memtotal_mb', 0)) / 1024.0))
%></%def>\
<%def name="col_disk(host)"><%
return ', '.join(['{0:0.1f}g'.format(i['size_available']/1048576000) for i in host['ansible_facts'].get('ansible_mounts', []) if 'size_available' in i and i['size_available'] > 1])
%></%def>
[Top](#top) | [Bottom](#bottom) <br>
[General](#general) | [Groups](#groups) | [Custom Vars](#custom) | [Local Facts](#local_facts) |
[Hardware](#hardware) | [OS](#os) | [Network](#network) | [Storage](#storage)
${"#"} <a name="top"></a>Details
% if 'ansible_facts' not in host:
No information collected
% else:
${"###"} <a name="general"></a>General
* **Node name**: ${host['ansible_facts'].get('ansible_nodename', 'Unknown')}
* **Form factor**: ${host['ansible_facts'].get('ansible_form_factor', 'Unknown')}
* **Virtualization role**: ${host['ansible_facts'].get('ansible_virtualization_role', 'Unknown')}
* **Virtualization type**: ${host['ansible_facts'].get('ansible_virtualization_type', 'Unknown')}
${"###"} <a name="groups"></a>Groups
% for group in sorted(host.get('groups', '')):
* ${group}
% endfor
${"###"} <a name="custom"></a>Custom variables
% for var_name, var_value in host['hostvars'].items():
* **${var_name}**: ${var_value}
% endfor
${"###"} <a name="local_facts"></a>Host local facts
${r_dict(host['ansible_facts'].get('ansible_local', {}), 0)}
${"###"} <a name="hardware"></a>Hardware
* **Vendor**: ${host['ansible_facts'].get('ansible_system_vendor', '')}
* **Product name**: ${host['ansible_facts'].get('ansible_product_name', '')}
* **Product serial**: ${host['ansible_facts'].get('ansible_product_serial', '')}
* **Board name**: ${host['ansible_facts'].get('ansible_board_name', '')}
* **BIOS version**: ${host['ansible_facts'].get('ansible_bios_version', '')}
* **Architecture**: ${host['ansible_facts'].get('ansible_architecture', '')}
* **Form factor**: ${host['ansible_facts'].get('ansible_form_factor', '')}
* **Virtualization role**: ${host['ansible_facts'].get('ansible_virtualization_role', '')}
* **Virtualization type**: ${host['ansible_facts'].get('ansible_virtualization_type', '')}
* **Machine**: ${host['ansible_facts'].get('ansible_machine', '')}
* **Processor count**: ${host['ansible_facts'].get('ansible_processor_count', '')}
* **Processor cores**: ${host['ansible_facts'].get('ansible_processor_cores', '')}
* **Processor threads per core**: ${host['ansible_facts'].get('ansible_processor_threads_per_core', '')}
* **Processor virtual CPUs**: ${host['ansible_facts'].get('ansible_processor_vcpus', '')}
* **Mem total mb**: ${host['ansible_facts'].get('ansible_memtotal_mb', '')}
* **Mem free mb**: ${host['ansible_facts'].get('ansible_memfree_mb', '')}
* **Swap total mb**: ${host['ansible_facts'].get('ansible_swaptotal_mb', '')}
* **Swap free mb**: ${host['ansible_facts'].get('ansible_swapfree_mb', '')}
${"###"} <a name="os"></a>Operating System
* **System**: <td>${host['ansible_facts'].get('ansible_system', '')}
* **OS Family**: <td>${host['ansible_facts'].get('ansible_os_family', '')}
* **Distribution**: <td>${host['ansible_facts'].get('ansible_distribution', '')}
* **Distribution version**: <td>${host['ansible_facts'].get('ansible_distribution_version', '')}
* **Distribution release**: <td>${host['ansible_facts'].get('ansible_distribution_release', '')}
* **Kernel**: <td>${host['ansible_facts'].get('ansible_kernel', '')}
* **Userspace bits**: <td>${host['ansible_facts'].get('ansible_userspace_bits', '')}
* **Userspace_architecture**: <td>${host['ansible_facts'].get('ansible_userspace_architecture', '')}
* **Date time**: <td>${host['ansible_facts'].get('ansible_date_time', {}).get('iso8601', '')}
* **Locale / Encoding**: <td>${host['ansible_facts'].get('ansible_env', {}).get('LC_ALL', 'Unknown')}
* **SELinux?**: <td>${host['ansible_facts'].get('ansible_selinux', '')}
* **Package manager**: <td>${host['ansible_facts'].get('ansible_pkg_mgr', '')}
${"###"} <a name="network"></a>Network
* **Hostname**: ${host['ansible_facts'].get('ansible_hostname', '')}
* **Domain**: ${host['ansible_facts'].get('ansible_domain', '')}
* **FQDN**: ${host['ansible_facts'].get('ansible_fqdn', '')}
* **Main IP**: ${col_main_ip(host)}
* **All IPv4**:
% for ipv4 in host['ansible_facts'].get('ansible_all_ipv4_addresses', []):
- ${ipv4}
% endfor
% for iface in sorted(host['ansible_facts'].get('ansible_interfaces', [])):
* **${iface}**:
${r_dict(host['ansible_facts'].get('ansible_%s' % (iface), {}), 1)}
% endfor
${"###"} <a name="storage"></a>Storage
% if type(host['ansible_facts'].get('ansible_devices', [])) == list:
${r_list(host['ansible_facts'].get('ansible_devices', []))}
% else:
${r_dict(host['ansible_facts'].get('ansible_devices', {}))}
% endif
% endif
[Top](#top) | [Bottom](#bottom) <br>
[General](#general) | [Groups](#groups) | [Custom Vars](#custom) | [Local Facts](#local_facts) |
[Hardware](#hardware) | [OS](#os) | [Network](#network) | [Storage](#storage)
<a name="bottom"></a>
Generated by [ansible-cmdb](https://github.com/fboender/ansible-cmdb) v%%MASTER%% on ${datetime.datetime.now().strftime('%c')}. © Ferry Boender