Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
8bbcef6f
Commit
8bbcef6f
authored
Jul 24, 2012
by
Nikhil Singh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Standardizing the module
parent
483f7fd6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
3 deletions
+26
-3
library/facter
+26
-3
No files found.
library/facter
View file @
8bbcef6f
#!/
bin/bash
#!/
usr/bin/python
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
#
...
...
@@ -22,5 +22,28 @@
# facter
# ruby-json
/usr/bin/logger
-t
ansible-facter Invoked as-is
/usr/bin/facter
--json
2>/dev/null
import
subprocess
def
get_facter_data
():
p
=
subprocess
.
Popen
([
"/usr/bin/env"
,
"facter"
,
"--json"
],
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
(
out
,
err
)
=
p
.
communicate
()
rc
=
p
.
returncode
return
rc
,
out
,
err
def
main
():
module
=
AnsibleModule
(
argument_spec
=
dict
()
)
rc
,
out
,
err
=
get_facter_data
()
if
rc
!=
0
:
module
.
fail_json
(
msg
=
err
)
else
:
module
.
exit_json
(
**
json
.
loads
(
out
))
# this is magic, see lib/ansible/module_common.py
#<<INCLUDE_ANSIBLE_MODULE_COMMON>>
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment