Commit Graph

330 Commits (d7916655598fd9ce7135264c97eab2832aa39bef)

Author SHA1 Message Date
Alexander Gubin d291dae582 Exit loop after detecting os-release 2015-02-16 13:18:11 +01:00
Brian Coca 1b4f1e1756 Merge pull request #9555 from bcoca/low_cost_facts
allow fact objects to be instantiated w/o triggering all fact collection
2015-02-11 20:57:40 -05:00
Toshio Kuratomi 6fe8865885 Return empty string if unable to read from some files during fact gathering so as not to change the values we return 2015-02-11 14:53:53 -08:00
pdelared 4c661e2b93 Update facts.py
Added support for HPUX network fact
2015-02-10 17:33:29 +01:00
Toshio Kuratomi 402a6d0533 Explicitly close files opened by facts
Fixes #10157
2015-02-09 14:30:06 -08:00
Toshio Kuratomi 425dee1afa Close some file handles explicitly in facts.py
Helps control open file descriptor count with pypy (which is used with
one coreos + ansible example).  Part of a fix for
https://github.com/ansible/ansible/issues/10157
2015-02-09 13:06:33 -08:00
Alexander Gubin 1968f99691 Wrong OS_FAMILY declaration for openSUSE 2015-02-04 09:16:32 +01:00
Toshio Kuratomi f355c11a3f Merge pull request #10129 from RadishTheHut/memfacts-fix
Fix for memory fact gathering
2015-01-30 07:44:58 -08:00
Patrick McConnell 04b2c698ba Updated memory facts fix using dict.get() to avoid KeyError 2015-01-30 05:59:34 +01:00
Toshio Kuratomi f20967078e Fixes to @RadishTheHut's memory facts as discussed in
https://github.com/ansible/ansible/pull/10129#issuecomment-72077500

* Switch default value from 0 to None.
* Prefill keys with default value so that determining calculated values
  is easier
2015-01-29 12:09:19 -08:00
Brian Coca e4a7b973fd Merge pull request #9128 from msabramo/expose_more_user_facts
Expose more facts about user on host system
2015-01-29 09:55:30 -05:00
Patrick McConnell 0c3a273805 Fix for memory fact gathering
I have a host which started to fail while gathering facts after the addition
of expanded memory facts in PR #9839:

Traceback (most recent call last):
  File "/home/ansible/.ansible/tmp/ansible-tmp-1422536976.05-133253824703289/setup", line 4278, in <module>
    main()
  File "/home/ansible/.ansible/tmp/ansible-tmp-1422536976.05-133253824703289/setup", line 137, in main
    data = run_setup(module)
  File "/home/ansible/.ansible/tmp/ansible-tmp-1422536976.05-133253824703289/setup", line 81, in run_setup
    facts = ansible_facts(module)
  File "/home/ansible/.ansible/tmp/ansible-tmp-1422536976.05-133253824703289/setup", line 4217, in ansible_facts
    facts.update(Hardware().populate())
  File "/home/ansible/.ansible/tmp/ansible-tmp-1422536976.05-133253824703289/setup", line 2339, in populate
    self.get_memory_facts()
  File "/home/ansible/.ansible/tmp/ansible-tmp-1422536976.05-133253824703289/setup", line 2375, in get_memory_facts
    'cached': memstats['swapcached']
KeyError: 'swapcached'

My problem host doesn't have SwapCached in /proc/meminfo. It may be better to
set defaults for these keys, since the values provided by /proc/meminfo can
change from version to version.
2015-01-29 15:00:01 +01:00
Alexander Gubin 5dec45e24a Fix wrong distribution facts on SLES/openSUSE 2015-01-29 14:54:53 +01:00
Brian Coca 11005e7b28 Merge pull request #9839 from nousdefions/memfacts
Memfacts
2015-01-28 09:39:24 -05:00
cdigiovanni 99bcbe746f Add the uuid of the device in ansible_mounts variable 2015-01-20 10:58:14 -06:00
Brian Coca bd62530700 Merge pull request #9947 from maxamillion/issue-9759-fix-processor-facts
don't double the count of i for LinuxHardware cpuinfo keys on 'vendor_id' and 'model name' keys
2015-01-11 16:42:04 -05:00
Adam Miller 06b70e4f9c When checking for Xen for LinuxHardware processor facts, don't check sysfs if already found in /proc/ 2015-01-08 11:29:11 -06:00
Nate Coraor 60e815c844 Set ansible_distribution_version differently for Solaris variants. 2015-01-07 19:07:12 -05:00
Toshio Kuratomi 5354df8643 s/nexentaStor/Nexenta/ 2015-01-07 15:18:52 -08:00
Toshio Kuratomi 04635333d0 Update fact gathering for solaris-family distributions 2015-01-07 14:38:16 -08:00
Adam Miller f274234824 Only add the overhead for each iteration of cpuinfo parsing if Xen is detected 2015-01-07 08:45:14 -06:00
Adam Miller 3729259b68 don't double the count of i for LinuxHardware cpuinfo keys on
'vendor_id' and 'model name' keys

Check for Xen paravirt and handle processor facts accordingly
2015-01-06 17:14:38 -06:00
Jonathan Davila a93db1948e expanded facts 2014-12-22 08:24:22 -05:00
Jonathan Mainguy 8278626dd0 Added distribution facts for OpenSuse 2014-12-15 11:47:42 -05:00
Brian Coca 215359084b Merge pull request #9375 from mantiz/fix-osfamily-and-distribution-on-archlinux
Fix os_family and distribution on archlinux
2014-12-12 14:28:38 -05:00
Veres Lajos bf5d8ee678 typofixes - https://github.com/vlajos/misspell_fixer 2014-12-04 22:23:35 +00:00
Justin Wyer 8146d1fff3 /sys/block/sdX/queue/physical_block_size does not correlate with /sys/block/sdX/size for advanced drives larger than 2TB, /sys/block/sdX/queue/logical_block_size correlates with both see #9549 2014-12-01 17:17:54 +02:00
Brian Coca 504995bda2 allow fact objects to be instantiated w/o triggering all fact collection
this opens the ability to do specific facts at much lower cost.
2014-11-13 18:32:27 -05:00
Toshio Kuratomi b828b25784 Add a fips fact and use it for integration tests 2014-11-12 09:29:21 -08:00
Stuart Henderson 419872373e set CPU architecture correctly for OpenBSD (powerpc not macppc, etc.) 2014-10-30 13:25:50 +00:00
Landry Breuil 792d8d1808 Ignore swap or altroot entries 2014-10-28 10:04:59 +01:00
Landry Breuil d68eb7272e parse /etc/fstab on OpenBSD to get mount facts 2014-10-27 20:27:57 +01:00
James Cammarata 28fd4df787 Merge pull request #9382 from gquintard/WIP/newdockerdetection
Detect docker as virtualization_type
2014-10-20 11:20:34 -05:00
James Cammarata efb40969b3 Merge pull request #9381 from debfx/facts_virt_kvm
Detect kvm guests through sys_vendor.
2014-10-20 10:53:39 -05:00
Guillaume Quintard 895da79d87 Detect docker as virtualization_type
New docker versions use "docker" in /proc/1/cgroup, which disturbs the
virtualization_type detection. So, grep for docker, in addition of
"lxc".
2014-10-20 10:09:46 +02:00
Felix Geyer ee5f5ee00d Detect kvm guests through sys_vendor.
The two detection methods currently implemented do not cover all cases.

For example qemu guests invoked like this:
qemu -machine pc-i440fx-1.4,accel=kvm -cpu SandyBridge

return this information:
product_name: Standard PC (i440FX + PIIX, 1996)
cpuinfo: model name      : Intel Xeon E312xx (Sandy Bridge)
2014-10-19 23:02:22 +02:00
Christian Hammerl 5efc4efca7 Fix os_family and distribution on archlinux
Fixes #8732, ansible/ansible-modules-core#34
2014-10-18 15:02:04 +02:00
Marcin Praczko 1917906dd6 Fix detecting distribution release on OpenSuSE
Ansible raised exception during parsering /etc/SuSE-release file.
Regular expresion should use string instead of list.
Fix tested on OpenSuse 13.1
2014-10-13 22:57:03 +02:00
Toshio Kuratomi 2b9e235ffd Rework distribution fact checking to be a little less heinous and add
support for Mandriva.

Fixes #9282
2014-10-10 10:28:07 -04:00
Marc Abramowitz e0015395de Expose more facts about user on host system
Adds:
  - `user_uid`
  - `user_gid`
  - `user_gecos`
  - `user_dir`
  - `user_shell`
2014-09-24 14:05:31 -07:00
Michael DeHaan e01d5f9d84 Revert "Added cross-platform uptime fact" since causing failures on Ubuntu.
This reverts commit 14a9966984.

Conflicts:

	lib/ansible/module_utils/facts.py
2014-08-08 14:58:09 -04:00
Michael DeHaan ea53576759 Merge pull request #6777 from GuiGui2/devel
Setup module: Additional facts when using ansible with Linux on System z
2014-08-08 14:30:49 -04:00
Michael DeHaan 5d05049ee1 Merge pull request #7670 from dagwieers/patch-3
Added cross-platform uptime fact
2014-08-08 14:23:53 -04:00
Michael DeHaan a48328fa12 Merge pull request #7725 from slapers/network-secondaries-issue
fix incorrect secondary ip handling, fixes #7724
2014-08-08 13:50:52 -04:00
Michael DeHaan 8c4161d4a1 Merge branch 'retf_py' of git://github.com/berendt/ansible into devel
Conflicts:
	lib/ansible/inventory/vars_plugins/group_vars.py
	plugins/callbacks/mail.py
2014-08-08 12:17:37 -04:00
James Cammarata 74cbeb1292 Default interface type to ipv4 when checking flags for Solaris
Fixes #8330
2014-08-04 13:36:37 -05:00
James Cammarata 7a5076c8b8 Catching shlex splitting error in fact gathering get_cmdline call
Fixes #8352
2014-07-30 14:47:50 -05:00
Michael DeHaan 30e6a659ae Merge pull request #8171 from jbenden/osx-10.10
Support for OS X 10.10 DP3.
2014-07-28 11:08:53 -04:00
Michael DeHaan e143d7dab7 Merge pull request #7543 from yangliping/fix_local_facts_file_checking_portability
Fix portability issue when checking local facts file permission.
2014-07-24 09:37:22 -04:00
Joseph Benden da5e32b316 Needs additional divisor. 2014-07-18 07:55:24 -07:00
Joseph Benden b55791ef43 Support for OS X 10.10 DP3. 2014-07-16 12:37:11 -07:00
dewey hylton 379e1a49cb fix swap translation on 4.x openbsd with 2.5.4 python 2014-06-30 17:23:55 -04:00
Ivo Senner f4fd9d366b Check for empty os-release file, fixes #7885 2014-06-22 04:08:59 +02:00
James Cammarata d8bb116c1a Merge branch 'devel' of https://github.com/tgolly/ansible into tgolly-devel 2014-06-19 22:41:58 -05:00
Jakub Kramarz df3188cef0 Added missing fallback from physical_block_size to hw_sector_size in sectorsize fact discovery for kernels older than May 2009.
References #5761
2014-06-14 19:42:41 +02:00
Jakub Kramarz 4e4c9235e8 changed sector size fact source from hw_sector_size to physical_block_size, fixes issue 5761 2014-06-12 12:14:40 +02:00
Stefan Lapers 78f4842982 fix incorrect secondary ip handling, fixes #7724 2014-06-11 09:32:35 +02:00
Dag Wieers fd6f0cb4b4 Update facts.py 2014-06-05 15:09:43 +02:00
Dag Wieers 14a9966984 Added cross-platform uptime fact
Having an uptime fact allows you to check after a reboot whether the system was effectively rebooted.

```yaml
  - name: Safeguard - Was system properly rebooted ?
    action: fail msg="System was not properly rebooted"
    when: ansible_uptime > 900
```

This patch has been tested on Linux, Solaris and HP-UX.
2014-06-05 11:58:00 +02:00
James Cammarata 061911c9c2 Merge pull request #7558 from dermute/pkg_mgr
added solaris fact detection for ansible_pkg_mgr
2014-05-27 16:23:31 -05:00
Alexander Winkler 4980e76a3a added solaris fact detection for ansible_pkg_mgr 2014-05-27 06:40:47 +00:00
rik2803 cfcbc954f5 Differentiate machinfo output key/val separator
get_hw_facts for HP-UX: machinfo in HP-UX B.11.23 uses '=' as separator between key and value, while B.11.31 uses ':'.
2014-05-26 07:56:46 +02:00
Yang Liping aedf134fc4 Fix portability issue when checking local facts file permission. 2014-05-26 10:55:32 +08:00
Christian Berendt 6676720ce5 fixed typos found by RETF rules in PY files
rules are avaialble at https://en.wikipedia.org/wiki/Wikipedia:AutoWikiBrowser/Typos
2014-05-03 18:40:05 +02:00
Logos01 424ee36e05 Enable facts module on older SuSE systems
Modified logic of distribution_release for SuSE to retain the last discovered key/value pair's value in /etc/SuSE-release that contains a '=' character.
2014-04-28 14:37:23 -07:00
Brian Coca c3e559b914 should now work with versions older than 8.4 2014-04-21 21:00:58 -04:00
faust64 78b9a11ccf Update facts.py
Fixes #7093 --devel
2014-04-21 19:44:47 +02:00
James Cammarata 39c6141b4a Merge pull request #7082 from bcoca/freebsd_mtu_fix
fixed issue with FreeBSD network facts
2014-04-21 10:53:22 -05:00
Brian Coca e5f297697a ifconfig changed on FreeBSD, tested this on 8,9 and 10 latest stable
versions and it now works
2014-04-19 22:03:30 -04:00
Brian Coca bc23926f42 fixed ETIME issue on FreeBSD 8 through 10, which broke all fact
gathering
2014-04-19 21:42:56 -04:00
James Cammarata eebc72ab9b Add a timeout decorator for timing out functions that may hang
Fixes #6891
2014-04-08 13:21:42 -05:00
Eric Lake 7f9736198a add distribution_major_version to fact gathering 2014-04-04 11:41:20 -05:00
Tim G c307a73e28 Check for errors from adb, may not work on all systems. 2014-04-01 22:36:19 +10:00
Tim G 285d4f3fa6 If memory not available in syslog.log, catch error, attempt to find it with adb 2014-04-01 21:55:29 +10:00
GuiGui2 b9613665dd Setup module: Additional facts when using ansible with Linux on System z
- Improved parsing of /proc/cpuinfo to take the specifics of Linux on
System z. ansible_processor and ansible_processor_cores are now
completed.
- Also improved virtualization facts in the same environment, parsing
the output of /usr/bin/lscpu to populate virtualization_type and
virtualization_role more precisely. If lscpu is not available, then
stick to the previous behavior.
2014-03-31 15:30:12 +02:00
Michael DeHaan 9921f804f9 Merge pull request #6643 from herbygillot/fact-full-hostname
Add a fact providing the full hostname, without the domain portion
2014-03-27 17:09:34 -04:00
Herby Gillot 94297950a0 Name platform.node() fact as "nodename" 2014-03-25 11:20:19 -04:00
Jonathan Mainguy b17b5ad85b Added ansible_date_time.weekday as a fact. This returns Monday,Tuesday,Wednesday,Thursday,Friday,Saturday, or Sunday depending on the remote servers time. Useful for backups the way I use it 2014-03-24 13:43:00 -04:00
Herby Gillot c0886a5f3a Add a fact providing the full hostname, without the domain portion
truncated.
2014-03-23 21:59:47 -04:00
Michael DeHaan b0dbc61d63 Move facts to 'module_utils' so they can be referenced by other modules. Note unlike other module_utils/ dirs this keeps the original
license -- so usage of facts code in modules will be limited to GPLv3 modules.
2014-03-16 16:12:02 -04:00