mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
16 lines
375 B
Python
16 lines
375 B
Python
#!/usr/bin/python
|
|
|
|
# requires 'ohai' to be installed
|
|
|
|
try:
|
|
import json
|
|
except ImportError:
|
|
import simplejson as json
|
|
|
|
import subprocess
|
|
|
|
cmd = subprocess.Popen("/usr/bin/ohai", stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
out, err = cmd.communicate()
|
|
|
|
# try to cleanup the JSON, for some reason facter --json doesn't need this hack
|
|
print json.dumps(json.loads(out))
|