Created
November 14, 2018 14:19
-
-
Save nomaster/e4f3b231a1fe2ce5d1966e9362991d3a to your computer and use it in GitHub Desktop.
Python3 version of the ethtool fact script for Ansible
This file contains hidden or 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
#!/usr/bin/env python3 | |
import subprocess | |
import json | |
stats = subprocess.getoutput("/sbin/ethtool -i enp0s3").split("\n") | |
result = {} | |
for line in stats: | |
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