mirror of
https://github.com/ansible/ansible-documentation.git
synced 2026-03-27 13:28:51 +07:00
Added an 'ohai' module. Some weird JSON hackage to get it to work.
This commit is contained in:
@@ -146,6 +146,7 @@ Modules include:
|
||||
* command -- runs commands, giving output, return codes, and run time info
|
||||
* ping - just returns if the system is up or not
|
||||
* facter - retrieves facts about the host OS
|
||||
* ohai - similar to facter, but returns structured data
|
||||
* copy - add files to remote systems
|
||||
|
||||
Playbooks
|
||||
|
||||
12
library/ohai
Normal file
12
library/ohai
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
# requires 'ohai' to be installed
|
||||
|
||||
import 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))
|
||||
Reference in New Issue
Block a user