-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding inventory collection for Cisco IOS devices
- Loading branch information
Showing
5 changed files
with
212 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
- name: build IOS XE inventory | ||
hosts: ios | ||
connection: local | ||
gather_facts: False | ||
|
||
vars: | ||
desired_ios_version: "16.06.01" | ||
|
||
tasks: | ||
|
||
- name: gathering IOS XE facts | ||
ios_facts: | ||
register: all_facts | ||
|
||
- name: create HTML report | ||
template: | ||
src: report-ios.j2 | ||
dest: /var/www/html/inventory_report_ios.html | ||
delegate_to: localhost | ||
run_once: true | ||
# provider: "{{login_info}}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<link rel="stylesheet" href="css/main.css"> | ||
</head> | ||
<body> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Hostname</th> | ||
<th>Model Type</th> | ||
<th>Serial Number</th> | ||
<th>Mgmt interface IP</th> | ||
<th>Code Version</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>cat3k-160</td> | ||
<td></td> | ||
<td>FCW2023D16V</td> | ||
<td>172.26.249.160</td> | ||
<td >16.06.01</td> | ||
</tr> | ||
<tr> | ||
<td>cat3k-161</td> | ||
<td></td> | ||
<td>FCW2023C1K1</td> | ||
<td>172.26.249.161</td> | ||
<td >16.06.01</td> | ||
</tr> | ||
<tr> | ||
<td>cat3k-162</td> | ||
<td></td> | ||
<td>FOC2020U0X0</td> | ||
<td>172.26.249.162</td> | ||
<td >16.06.01</td> | ||
</tr> | ||
<tr> | ||
<td>cat3k-163</td> | ||
<td></td> | ||
<td>FCW2023D17F</td> | ||
<td>172.26.249.163</td> | ||
<td >16.06.01</td> | ||
</tr> | ||
<tr> | ||
<td>cat3k-164</td> | ||
<td></td> | ||
<td>FOC1949U1JA</td> | ||
<td>172.26.249.164</td> | ||
<td >16.06.01</td> | ||
</tr> | ||
<tr> | ||
<td>cat3k-166</td> | ||
<td></td> | ||
<td>FCW1949D16M</td> | ||
<td>172.26.249.166</td> | ||
<td >16.06.01</td> | ||
</tr> | ||
<tr> | ||
<td>cat3k-169</td> | ||
<td></td> | ||
<td>FOC1731V1QZ</td> | ||
<td>172.26.249.169</td> | ||
<td >16.06.01</td> | ||
</tr> | ||
<tr> | ||
<td>cat9k-1</td> | ||
<td></td> | ||
<td>FCW2125L0N7</td> | ||
<td>172.26.249.151</td> | ||
<td style="background:yellow;">BLD_POLARIS_DEV_LATEST_20171031_020522</td> | ||
</tr> | ||
<tr> | ||
<td>cat9k-2</td> | ||
<td></td> | ||
<td>FCW2125L0M9</td> | ||
<td>172.26.249.152</td> | ||
<td style="background:yellow;">BLD_POLARIS_DEV_LATEST_20171031_020522</td> | ||
</tr> | ||
<tr> | ||
<td>cat9k-3</td> | ||
<td></td> | ||
<td>FCW2125G06X</td> | ||
<td>172.26.249.153</td> | ||
<td style="background:yellow;">BLD_POLARIS_DEV_LATEST_20171031_020522</td> | ||
</tr> | ||
<tr> | ||
<td>cat9k-4</td> | ||
<td></td> | ||
<td>FCW2125L0J2</td> | ||
<td>172.26.249.154</td> | ||
<td style="background:yellow;">BLD_POLARIS_DEV_LATEST_20171031_020522</td> | ||
</tr> | ||
<tr> | ||
<td>cat9k-puppet</td> | ||
<td></td> | ||
<td>FCW2122A4H0</td> | ||
<td>172.26.249.159</td> | ||
<td style="background:yellow;">2017-10-04_23.58_petervh</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<link rel="stylesheet" href="css/main.css"> | ||
</head> | ||
<body> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Hostname</th> | ||
<th>Model Type</th> | ||
<th>Serial Number</th> | ||
<th>Mgmt interface IP</th> | ||
<th>Code Version</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for network_switch in groups['ios'] %} | ||
<tr> | ||
<td>{{hostvars[network_switch]['ansible_net_hostname']}}</td> | ||
<td>{{hostvars[network_switch]['ansible_net_model']}}</td> | ||
<td>{{hostvars[network_switch]['ansible_net_serialnum']}}</td> | ||
<td>{{hostvars[network_switch]['ansible_net_interfaces']['GigabitEthernet0/0']['ipv4'][0]['address']}}</td> | ||
<td {% if hostvars[network_switch]['ansible_net_version'] != desired_ios_version %}style="background:yellow;"{% endif %}>{{hostvars[network_switch]['ansible_net_version']}}</td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
|
||
</body> | ||
</html> |