Commit Graph

53 Commits (75bbd73173211972dbcd29574a4705a6cad20220)

Author SHA1 Message Date
Michael DeHaan e9c9d8f523 tweak config mode check to just have a default 12 years ago
Michael DeHaan 477ca2ed1a Make pep8 tests run against the library directory as well, and associated tweaks (mostly to indentation) in the library
directory.
12 years ago
Michael DeHaan e0765be1ea Merge pull request #850 from akhayyat/virt-facts
Add openvz detection to virtualization facts, and some cleanup
12 years ago
Michael DeHaan 32922e404b Don't include local addresses in the all_ipv4/6 list 12 years ago
Ahmad Khayyat 916fcdb93b Add openvz detection to virtualization facts, and some cleanup 12 years ago
Ahmad Khayyat f0a8e13628 Update doc string and minor cleanup 12 years ago
Ahmad Khayyat 7950dd01e5 Recognize interface aliases in network facts, and add IP facts 12 years ago
Stephen Fromm 0cc73c930b Make exception more specific (OSError) in setup module for selinux call 12 years ago
Stephen Fromm 3fb3eae7b6 Protect all selinux calls with try/except 12 years ago
Michael DeHaan faed4b5a33 whitespace + remove deprecated YAML parser (migration script lives in examples/scripts and warning was added
in 0.6 release)
12 years ago
Michael DeHaan 7e9e29011e Add encoding lines to python modules such that they can take unicode options if they are fed them, since the
AnsibleModule stuff no longer base64 encodes for simplicity and speed reasons.
12 years ago
Stephen Fromm 85c838c835 Add Blade to FORM_FACTOR list and document SMBIOS spec URL 12 years ago
Stephen Fromm 9a3ad060dc Catch exception if form factor id is unknown 12 years ago
Michael DeHaan ce5f3dd148 Port the file module over to the new common code infrastructure + cleanup some redundant imports since the module code already imports those things. 12 years ago
Michael DeHaan 6b72804cb4 remove unneeded imports 12 years ago
Michael DeHaan d0a5dec686 Port setup module to use the common module base 12 years ago
Christoph Seitz ab8a36686e Fixes locale problem with ifconfig in setup module 12 years ago
Stephen Fromm 2a0dfba838 Skip get_ipv6_facts if socket.has_ipv6 is false 12 years ago
Stephen Fromm 0efc0bec89 Update LinuxNetwork to not use fcntl and ioctls
get_interfaces() updated to read /proc/net/dev.  This means it no
longer provides only interfaces that are up.

get_iface_hwaddr() updated to read from /sys/class/net/<iface>/address.

Added get_interface_facts() to pull in mac address and interface mtu.
Can be used later for additional interface-facts.

Added get_ipv6_facts(), which reads from /proc/net/if_inet6.

get_network_facts() renamed to get_ipv4_facts().  It still calls
ifconfig to determine ipv4 facts.
12 years ago
Stephen Fromm 162b78ea5c Check if CPU is QEMU via different mechanism
The processor fact doesn't exist in LinuxVirtual.  Read /proc/cpuinfo
and check if it is QEMU.
12 years ago
Stephen Fromm e3dd25b1b2 Add back erroneously deleted get_file_content() 12 years ago
Stephen Fromm 97c64f3632 Adjustments to behavior of Facts and subclass behavior
The Facts class and subclasses no longer take a dict argument for
instantiation.  populate() now returns self.facts.
Other changes:
- Facts.__init__() takes over most of the work from populate() so that
  subclasses can benefit from its knowledge.
- Drop setting unknown facts to 'NA' in __init__() in various
  subclasses.
- Check for presence of facts in get_virtual_facts()
- Update ansible_facts() to use facts.update(<classname>().populate())
12 years ago
Stephen Fromm ae1b2394ac Update setup module for facts derived from classes
This changes and organizes facts into a base class Facts and several
sub classes that implement the necessary functionality.  The classes
are:
- Facts: base class.  Implements basic facts that should be common to a
  number of platforms.  It is also where SSH keys and SELinux facts are
  set.
- Hardware: A subclass of Facts that should be further
  subclassed per platform for CPU, memory, and related facts.
  - LinuxHardware: subclass of Hardware for Linux platforms
  - SunOSHardware: subclass of Hardware for SunOS platforms
  - FreeBSDHardware: subclass of Hardware for FreeBSD
- Network: A subclass of Facts that that should be further
  subclassed per platform for IP, both IPv4 and IPv6, information.
  - LinuxNetwork: Currently only implementation for determining network
    facts.
- Virtual: A subclass of Facts that that should be further
  subclassed per platform to determine virtual environment facts.
  - LinuxVirtual: Currently only implementation for determining virtual
    facts.

If facts are needed for additional platforms, one of the above classes
(eg Network) can be further subclassed and implement the necessary
functionality.

In addition, it fixes get_network_facts() to work on Fedora17.  That
broke due to changes to ifconfig output.
12 years ago
Michael DeHaan 931f9f1a61 Setup module no longer saves to disk, as templates are mostly useful in playbooks and this allows lots of simplifications
around file pathing and removes occasional permissions conflicts depending on how things are used.
12 years ago
John Kleint 375a1eaf43 Use iterative MD5 hashing. 12 years ago
Dave Hatton 55694db7c3 switch to hashlib.md5 or md5 instead of OS md5 commands 12 years ago
Dave Hatton d47de18b6c improve error trapping for md5 12 years ago
Michael DeHaan efac68b636 Remove the -D module debug flag, which no longer is functional due to sudo pty requirements, and replace with -v/--verbose.
This flag will show playbook output from non-failing commands.  -v is also added to /usr/bin/ansible, but not  yet used.

I also gutted some internals code dealing with 'invocations' which allowed the callback to know what module invoked
it.  This is not something 0.5 does or needed, so callbacks have been simplified.
12 years ago
Ludovic Claude daf858648b Add basic support for Solaris 12 years ago
Fred Alger 834f6a216d Make shell outs to md5sum work on FreeBSD and OS X
Tested with OS X local connection and Linux remote. The paths to the
md5sum and md5 commands are hardcoded to the most common location. This
will definitely fail if the commands are elsewhere, or if the md5
command doesn't support the -q 'quiet' option.
12 years ago
Michael DeHaan 4886b26ea9 Merge pull request #426 from dagwieers/facts
Add BIOS information and fix VMware detection (supports both IDE and SCSI)
12 years ago
Stephen Fromm 3eef7a629b Update get_selinux_facts in setup module
This switches to using selinux library calls instead of parsing the
output of sestatus.  This fixes issue #428 where the output was slightly
different than expected on F17.  Tested against debian (non-selinux),
centos5, centos6, and fedora17.
12 years ago
Dag Wieers 50ef1bb93f Add BIOS information and fix VMware detection (supports both IDE and SCSI disks) 12 years ago
Wes Johnson 5da7f2aff4 starting fresh, doing it 'right'
Lost commit history, but this way I'm not introducing crappy commit
history in RP
12 years ago
Cosmin Luță c37014083a Added a new fact: network address for an interface 12 years ago
Stephen Fromm aea022b002 Apply logging of arguments to modules (issue #122)
The ohai and facter modules use /usr/bin/logger to log the fact that
they have been invoked.  I added 'import os' to the ping module
so that it could have the same syslog statements as the other modules.
I separated the condensed:
    shlex.split(open(argfile, 'r').read())
into two separate statements similar to the other modules.
12 years ago
Stephen Fromm 7b41e22e56 Change to socket.getfqdn() for fqdn fact 12 years ago
cocoy 7a19a46e24 Bugfix for issue no. 229 12 years ago
Jeroen Hoekx 2dc9a563ef Allow modules to return facts.
If the module result contains "ansible_facts", that will be added to the setup
cache.
12 years ago
Stephen Fromm 0c38bb2fd0 Add native facts to library/setup
This collects various facts from the host so that it isn't necessary to
have facter or ohai installed.  It gets various platform/distribution
facts, information about the type of hardware, whether a virtual
environment and what type, assorted interface facts, and ssh host public
keys.  Most facts are flat.  The two exceptions are 'processor' and all
interface facts.  Interface facts are presented as:
    ansible_lo : {
        "macaddress": "00:00:00:00:00:00",
        "ipv4": { "address": "127.0.0.1", "netmask": "255.0.0.0" },
        "ipv6": [
                    { "address": "::1", "prefix": "128", "scope": "host" }
                ]
    }
12 years ago
Michael DeHaan 1d75a29ec9 Allow variables coming in from the playbook and the API to be expressed as dictionaries throughout their full life cycle
such that nested data can be made available in templates and playbooks.
12 years ago
Michael DeHaan e6406fa5a7 Allow variable expressions to be stored as variables themselves, do some things to allow setup strings
to more easily contain spaces without being mangled, which is neccessary because of the above.
12 years ago
Michael DeHaan 6b152c94b9 Correct the setup module 13 years ago
Michael DeHaan 3ea9174ed7 Split argsfile handling into subfunction, attempt to apply argsfile logic to setup 13 years ago
Michael DeHaan 8d57ceecf1 Factoids and push variables via setup are now available to be templated in command args
as well as template files.  PLUS, variables are now expressed in playbooks without having
to know about the setup task, which means playbooks are simpler to read now.
13 years ago
Michael DeHaan cb5929dad7 Setup module tests 12 years ago
Michael DeHaan be4cb64c92 Relicensing to GPLv3, all previous committers ok'd on mailing list. 13 years ago
Michael DeHaan 320ce8f5f1 If ohai is present, do the same with facter and make it available for the templating engine 13 years ago
Michael DeHaan 186dab4dff Include facter variables for free in setup JSON (prefix with 'facter'.
Also sort keys in JSON file and pretty print
13 years ago
Michael DeHaan 61d064d011 Fixed up KV munging in runner, misc fixes to copy, setup, and template modules 13 years ago