Commit Graph

80 Commits (35fdc5411f1d20952d5cf074d04b26b6d2c57719)

Author SHA1 Message Date
Jan-Piet Mens a72a6e42c5 Added attribution to all module DOCUMENTATION strings 12 years ago
Stephen Fromm ed07940386 Add LSB facts, as derived from lsb_release -a
This gathers LSB facts via lsb_release.  This complements the
platform facts collected via the platform module.  This reoprts
release, id, description, release, and codename.  It also adds
'major_release', which is the major version number of a distribution.
12 years ago
Jan-Piet Mens 60e0410298 Tweak DOCUMENTATION YAML as per latest 991 12 years ago
Michael DeHaan 4cd3262f50 Merge pull request #1054 from jpmens/geturl_doc1
First attempt at standardizing DOCUMENTATION string
12 years ago
Jan-Piet Mens e041c2e2cd First attempt at standardizing DOCUMENTATION string (new DICT) 12 years ago
Michael DeHaan d77be4eecf Merge pull request #1052 from romeotheriault/add-SunOSVirtual-facts
Adding SunOSVirtual facts
12 years ago
Romeo Theriault d72eaa3fc5 Adding SunOSVirtual facts 12 years ago
Stephen Fromm 65fe7b7003 Update package manager fact innards to a list of dicts 12 years ago
Stephen Fromm 94eb11a6d7 Add pkg_mgr fact to setup
This should help facilitate playbook decision making that are not
strictly distribution specific, but more package manager.
12 years ago
Matt Coddington c0638842d8 make this python24 compatible 12 years ago
Michael DeHaan 49bef3f6c2 Merge pull request #1005 from dagwieers/cmdline
Add /proc/cmdline information to the default facts
12 years ago
Jan-Piet Mens b36aa61237 Add support for RSA/DSA SSH host key detection in setup module for OS/X
s/<8spaces>/<4spaces>/g
12 years ago
Dag Wieers d158218c3f Add /proc/cmdline information to the default facts
The use-case here is that based on information in the /proc/cmdline certain actions can be taken.

A practical example in our case is that we have a play at the end of the provisioning phase that reboots the system. Since we don't want to accidentally reboot a system (or restart the network) on a production machine, having a way to separate an Anaconda post-install (sshd in chroot) with a normal system is a good way to make that distinction.

    ---
    - name: reboot
      hosts: all
      tasks:
      - action: command init 6
        only_if: "not '${ansible_cmdline.BOOT_IMAGE}'.startswith('$')"

A practical problem here is the fact that we cannot simply check whether it is set or empty:

    ---
    - name: reboot
      hosts: all
      tasks:
      - action: command init 6
        only_if: "'${ansible_cmdline.BOOT_IMAGE}'"

If ansible_cmdline was a string, a simple only_if: "'${ansible_cmdline}'.find(' BOOT_IMAGE=')" was an option, but still not very "beautiful" :-/

This implementation uses shlex.split() and uses split(sep, maxsplit=1).
12 years ago
Michael DeHaan eed031cd82 Check for ipv6 12 years ago
Michael DeHaan 8f220a4f77 Always pipe stderr in the setup module to avoid JSON interference. 12 years ago
Stephen Fromm e5a635672c Migrate remaining modules to use get_bin_path in module_common.py
* Migraed easy_install, pip, service, setup, and user.
* Updated fail_json message in apt_repository
* Fixed easy_install to not hardcode location of virtualenv in
  /usr/local/bin/.
* Made handling of virtualenv more consistent between easy_install and
  pip.
12 years ago
Michael DeHaan d0994cd169 Merge branch 'setup-no-dash-facts' of https://github.com/tima/ansible into devel
Conflicts:
	library/setup
12 years ago
Timothy Appnel 8c32aefc80 Replace - with _ in setup module key names to avoid variable access problems reported in #954 12 years ago
Maxim Burgerhout 3d44de284a Add working CPU model fact for some ARM devices
Works on Sheevaplug, probably works on Rasberry Pi as well
12 years ago
Tim Bielawa 3d3c8a004e Fix setup module explosion when a route is empty. Closes #909 12 years ago
Daniel Hokka Zakrisson 121341833a Work with tun and p2p interfaces 12 years ago
Sundar Raman 3aff9396e8 (Re #882) Handle errors in get_interfaces
If there is an error in how interfaces are configured (or only one set, like IPv6),
the setup command should not error out.
12 years ago
Michael DeHaan 731adc0eaf Merge pull request #866 from akhayyat/devel
setup: add type and default_ipv{4,6} to linux network facts
12 years ago
Daniel Hokka Zakrisson ae964b97c4 Fix spelling of architecture for non-x86 12 years ago
Ahmad Khayyat c96c51a534 setup: add type and default_ipv{4,6} to linux network facts 12 years ago
Stephen Fromm c4ce5f9497 Try to find ip command in either /sbin or /usr/sbin
If ip is not found in either /sbin or /usr/sbin, this will return
an empty result.  It seems extremely unlikely that a linux system will
not have iproute2 installed
12 years ago
Stephen Fromm 84028c2339 Tweak invocation of ip in LinuxNetwork
Specify full path to ip and add third argument 'show' to be explicit
about requested action.  This goes from 'ip addr' to
'/sbin/ip addr show'.
12 years ago
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