Skip to content

Instantly share code, notes, and snippets.

@nomaster
Last active June 26, 2023 10:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nomaster/3f2e13c4bbbe412e7e30 to your computer and use it in GitHub Desktop.
Save nomaster/3f2e13c4bbbe412e7e30 to your computer and use it in GitHub Desktop.
Ansible facts script for ethtool
#!/usr/bin/env python
import json
import subprocess
result = {}
interface_stats = subprocess.check_output("/usr/sbin/ethtool -i eth0", shell=True)
for line in interface_stats.strip().split("\n"):
key, value = line.split(": ")
result[key] = value
print json.dumps(result, indent=2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment