Commit graph

103 commits

Author SHA1 Message Date
Daniel Hokka Zakrisson
85fb8494c5 Clean up device fact gathering
Remove lots of re use that really shouldn't have been re in the first
place. Initialize pcidata even if lspci is unavailable, and check for
its usability before trying to use it.

Fixes #2060.
2013-02-12 18:48:14 +01:00
Kavin Kankeshwar
3042366199 Fixing logical error in detecting virtual device.
So In my Centos 5.9 machine, if there is RAID mount ansible will crash, as it cannot find scheduler file. The reason being, this should be a virtual device as there is no "device" folder under e.g. /sys/block/md0/

Here is the crash:

[kk@u1 ansible]$ ansible q3 -m setup -k -u root --tree=/tmp/facts
SSH password:
q3 | FAILED => failed to parse: /sys/block/md0
Traceback (most recent call last):
  File "/root/.ansible/tmp/ansible-1360629441.14-171498703486275/setup", line 1797, in ?
    main()
  File "/root/.ansible/tmp/ansible-1360629441.14-171498703486275/setup", line 1050, in main
    data = run_setup(module)
  File "/root/.ansible/tmp/ansible-1360629441.14-171498703486275/setup", line 1000, in run_setup
    facts = ansible_facts()
  File "/root/.ansible/tmp/ansible-1360629441.14-171498703486275/setup", line 990, in ansible_facts
    facts.update(Hardware().populate())
  File "/root/.ansible/tmp/ansible-1360629441.14-171498703486275/setup", line 312, in populate
    self.get_device_facts()
  File "/root/.ansible/tmp/ansible-1360629441.14-171498703486275/setup", line 439, in get_device_facts
    m = re.match(".*?(\[(.*)\])", scheduler)
  File "/usr/lib64/python2.4/sre.py", line 129, in match
    return _compile(pattern, flags).match(string)
TypeError: expected string or buffer
2013-02-11 18:23:58 -08:00
Daniel Hokka Zakrisson
57cac788fb Fix setup when /sys/block is inaccessible 2013-02-11 23:24:47 +01:00
Daniel Hokka Zakrisson
5ba090c366 Fixes for Python 2.4 2013-02-11 23:23:14 +01:00
Brian Coca
0e8627b7e8 added block device info gathering, full for linux, partial for freebsd added prettyfing byte function Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
moved moutns out of devices Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
2013-02-09 11:15:22 -05:00
Michael DeHaan
fed82c2188 This implements a basic --check mode which for now is only implemented on template & copy operations. More detail will be shared with the list
shortly.
2013-02-03 20:34:13 -05:00
Shaun Zinck
4a9201ad65 add pkgin to list of package managers in setup 2013-01-23 22:12:13 -06:00
John Gosset
54ef6015f6 add pacman to list of package managers in setup module 2013-01-23 11:03:05 -05:00
Stephen Fromm
3fb21a5281 Update modules to use run_command in module_common.py
This updates apt, apt_repository, command, cron, easy_install, facter,
fireball, git, group, mount, ohai, pip, service, setup, subversion,
supervisorctl, svr4pkg, user, and yum to take advantage of run_command
in module_common.py.
2013-01-13 08:37:19 -08:00
Daniel Hokka Zakrisson
3bc6228b97 Handle unreadable /proc/xen/capabilities
Fixes #1854.
2013-01-10 18:22:01 +01:00
Michael DeHaan
3981c72957 Streamline code 2012-11-23 10:58:17 -05:00
Michael DeHaan
17020d6a75 Merge pull request #1656 from dagwieers/setup-virtualization
Implemented more virtualization types
2012-11-23 07:55:42 -08:00
Dag Wieers
e528826dba Implemented more virtualization types
I added all known virtualization types from the virt-what project. However, the few virt types that rely on cpuid information have not been implemented lacking native python cpuid access. (hyperv)
2012-11-22 02:48:13 +01:00
Jan-Piet Mens
caf003c813 DOCUMENTATION strings 2012-11-21 18:49:30 +01:00
Michael DeHaan
663a8fef3f chmod -x for all module files in source checkout 2012-11-19 13:47:40 -05:00
Fabian Arrotin
29882f97e6 Fixed the way dom0/domU xen role is defined in the setup module 2012-11-06 22:49:33 +01:00
Michael DeHaan
626203a7c9 Module documentation should have options sorted 2012-11-03 18:52:59 -04:00
Michael DeHaan
c0747b7baa pep8 fixes 2012-10-30 20:42:07 -04:00
Michael DeHaan
27e518a0b1 Rename 'domainname' to 'domain' 2012-10-30 20:07:36 -04:00
Serge van Ginderachter
1db563e064 Add domainname to ansible facts 2012-10-30 19:47:31 -04:00
Brian Coca
620aeeb572 fixed but in pulling data from dmesg command, wrong function to use as file for for loop
Signed-off-by: Brian Coca <briancoca+ansible@gmail.com>
2012-10-16 18:44:09 -04:00
Brian Coca
6886683e16 small patch to fact gathering for when no dmesg.boot exists on freebsd, mainly happens in jails
Signed-off-by: Brian Coca <briancoca+ansible@gmail.com>
2012-10-12 17:37:30 -04:00
Michael DeHaan
f1dfddc5e5 Fix typo in autogenerated docs 2012-10-10 08:32:41 -04:00
Jan-Piet Mens
a72a6e42c5 Added attribution to all module DOCUMENTATION strings 2012-10-01 12:37:51 +02:00
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.
2012-09-29 23:58:04 -07:00
Jan-Piet Mens
60e0410298 Tweak DOCUMENTATION YAML as per latest 991 2012-09-19 16:09:26 +02:00
Michael DeHaan
4cd3262f50 Merge pull request #1054 from jpmens/geturl_doc1
First attempt at standardizing DOCUMENTATION string
2012-09-19 06:09:39 -07:00
Jan-Piet Mens
e041c2e2cd First attempt at standardizing DOCUMENTATION string (new DICT) 2012-09-18 14:04:43 +02:00
Michael DeHaan
d77be4eecf Merge pull request #1052 from romeotheriault/add-SunOSVirtual-facts
Adding SunOSVirtual facts
2012-09-17 17:27:43 -07:00
Romeo Theriault
d72eaa3fc5 Adding SunOSVirtual facts 2012-09-16 23:14:06 -10:00
Stephen Fromm
65fe7b7003 Update package manager fact innards to a list of dicts 2012-09-16 21:42:55 -07:00
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.
2012-09-16 21:42:54 -07:00
Matt Coddington
c0638842d8 make this python24 compatible 2012-09-07 22:47:03 -04:00
Michael DeHaan
49bef3f6c2 Merge pull request #1005 from dagwieers/cmdline
Add /proc/cmdline information to the default facts
2012-09-06 17:51:19 -07:00
Jan-Piet Mens
b36aa61237 Add support for RSA/DSA SSH host key detection in setup module for OS/X
s/<8spaces>/<4spaces>/g
2012-09-06 20:40:21 +02:00
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).
2012-09-06 09:35:33 +02:00
Michael DeHaan
eed031cd82 Check for ipv6 2012-09-04 21:22:47 -04:00
Michael DeHaan
8f220a4f77 Always pipe stderr in the setup module to avoid JSON interference. 2012-09-02 12:34:28 -04:00
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.
2012-08-29 20:26:22 -07:00
Michael DeHaan
d0994cd169 Merge branch 'setup-no-dash-facts' of https://github.com/tima/ansible into devel
Conflicts:
	library/setup
2012-08-28 20:29:40 -04:00
Timothy Appnel
8c32aefc80 Replace - with _ in setup module key names to avoid variable access problems reported in #954 2012-08-28 19:02:19 -04:00
Maxim Burgerhout
3d44de284a Add working CPU model fact for some ARM devices
Works on Sheevaplug, probably works on Rasberry Pi as well
2012-08-24 23:11:06 +02:00
Tim Bielawa
3d3c8a004e Fix setup module explosion when a route is empty. Closes #909 2012-08-19 21:19:07 -04:00
Daniel Hokka Zakrisson
121341833a Work with tun and p2p interfaces 2012-08-17 22:08:04 +02:00
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.
2012-08-15 19:22:05 -04:00
Michael DeHaan
731adc0eaf Merge pull request #866 from akhayyat/devel
setup: add type and default_ipv{4,6} to linux network facts
2012-08-14 16:19:14 -07:00
Daniel Hokka Zakrisson
ae964b97c4 Fix spelling of architecture for non-x86 2012-08-14 15:57:54 +02:00
Ahmad Khayyat
c96c51a534 setup: add type and default_ipv{4,6} to linux network facts 2012-08-14 01:37:14 -04:00
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
2012-08-11 23:54:22 -07:00
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'.
2012-08-11 23:54:22 -07:00