~canonical-ci-engineering/ubuntu-ci-services-itself/ansible

« back to all changes in this revision

Viewing changes to library/system/facter

  • Committer: Package Import Robot
  • Author(s): Michael Vogt, Harlan Lieberman-Berg, Michael Vogt
  • Date: 2013-11-01 09:40:59 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20131101094059-6w580ocxzqyqzuu3
Tags: 1.3.4+dfsg-1
[ Harlan Lieberman-Berg ]
* New upstream release (Closes: #717777).
  Fixes CVE-2013-2233 (Closes: #714822).
  Fixes CVE-2013-4259 (Closes: #721766).
* Drop fix-ansible-cfg patch.
* Change docsite generation to not expect docs as part of a wordpress install.
* Add trivial patch to fix lintian error with rpm-key script.
* Add patch header information to fix-html-makefile.

[ Michael Vogt ]
* add myself to uploader
* build/ship the module manpages for ansible in the ansible package

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
# -*- coding: utf-8 -*-
 
3
 
 
4
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
 
5
#
 
6
# This file is part of Ansible
 
7
#
 
8
# Ansible is free software: you can redistribute it and/or modify
 
9
# it under the terms of the GNU General Public License as published by
 
10
# the Free Software Foundation, either version 3 of the License, or
 
11
# (at your option) any later version.
 
12
#
 
13
# Ansible is distributed in the hope that it will be useful,
 
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
# GNU General Public License for more details.
 
17
#
 
18
# You should have received a copy of the GNU General Public License
 
19
# along with Ansible.  If not, see <http://www.gnu.org/licenses/>.
 
20
#
 
21
 
 
22
 
 
23
DOCUMENTATION = '''
 
24
---
 
25
module: facter
 
26
short_description: Runs the discovery program I(facter) on the remote system
 
27
description:
 
28
     - Runs the I(facter) discovery program
 
29
       (U(https://github.com/puppetlabs/facter)) on the remote system, returning
 
30
       JSON data that can be useful for inventory purposes.
 
31
version_added: "0.2"
 
32
options: {}
 
33
notes: []
 
34
requirements: [ "facter", "ruby-json" ]
 
35
author: Michael DeHaan
 
36
'''
 
37
 
 
38
EXAMPLES = '''
 
39
# Example command-line invocation
 
40
ansible www.example.net -m facter
 
41
'''
 
42
 
 
43
def main():
 
44
    module = AnsibleModule(
 
45
        argument_spec = dict()
 
46
    )
 
47
 
 
48
    cmd = ["/usr/bin/env", "facter", "--json"]
 
49
    rc, out, err = module.run_command(cmd, check_rc=True)
 
50
    module.exit_json(**json.loads(out))
 
51
 
 
52
# this is magic, see lib/ansible/module_common.py
 
53
#<<INCLUDE_ANSIBLE_MODULE_COMMON>>
 
54
 
 
55
main()
 
56