Skip to content

Commit cc8a305

Browse files
[READY] add mrtg inventory (socallinuxexpo#919)
2 parents 5db118d + 275fce3 commit cc8a305

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

facts/inventory.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,17 @@ def generatewasgehtconfig(switches, routers, pis, aps, servers, outputdir):
703703
json.dump(wasgehtconfig, f)
704704

705705

706+
def generateallnetwork(switches, routers, outputdir):
707+
hostlist = []
708+
for switch in switches:
709+
hostlist.append(switch["fqdn"])
710+
for router in routers:
711+
hostlist.append(router["fqdn"])
712+
for h in hostlist:
713+
with open(f"{outputdir}/all-network-devices", "a") as f:
714+
f.write(f"{h}\n")
715+
716+
706717
def main():
707718
"""command entry point"""
708719

@@ -737,11 +748,14 @@ def main():
737748
generatepromconfig(servers, aps, vlans, outputdir)
738749
elif subcomm == "wasgeht":
739750
generatewasgehtconfig(switches, routers, pis, aps, servers, outputdir)
751+
elif subcomm == "allnet":
752+
generateallnetwork(switches, routers, outputdir)
740753
elif subcomm == "all":
741754
generatekeaconfig(servers, aps, vlans, outputdir)
742755
generatezones(switches, routers, pis, aps, servers, outputdir)
743756
generatepromconfig(servers, aps, vlans, outputdir)
744757
generatewasgehtconfig(switches, routers, pis, aps, servers, outputdir)
758+
generateallnetwork(switches, routers, outputdir)
745759
elif subcomm == "debug":
746760
# overload outputdir as 2nd debug parameter
747761
debug_variable = outputdir

0 commit comments

Comments
 (0)