Commit graph

20397 commits

Author SHA1 Message Date
nitzmahone
4fbd17d949 py3 print fix 2016-08-18 14:37:52 -07:00
Josh Preston
2a2d866c0d add cloudforms inventory script (#17037)
* add cloudforms inventory script

based on the foreman inventory script, features:

* cached results (default 600 seconds)
* paginated host results (default 100 hosts)
* ssl verification (default True)
* arguments to flush cache and run in debug mode

* suggested rework

* removed second cache / dict with duplicate info
* added purge_actions configuration option to remove the actions from a host (defaults to False)
* added prefer_ip_address configuration option so give the option of using ip address instead of name (defaults to True)
* removed self variables — just use the arguments directly
* added --pretty command line option to pretty print results
* renamed _resolve_params to _resolve_host

* implement suggestions

* removed not used import
* added warnings to help debug connection issues
* renamed self.cache to self.hosts for clarity
* now will use the first ip address as ansible_ssh_host
* flipped default for prefer_ip_address config option to false - preserve name, and specify ansible_ssh_host as ip address
* added checks and warnings to configuration options, sane defaults for all except required:
** `url` - the first part of the cloudforms server url (https://cfme.example.com)
** `username`  - the cloudforms username to log in with
** `password` - the password for the cloudforms user specified
* removed redundant call to fetch host information (since we’re paging results, no need to split the calls)
* added warning for unexpected responses from CloudForms
* debug for returned sting now prints the string instead of forcing to JSON
* removed no longer needed methods to fetch host information
* using ‘key in list’ instead of ‘list.has_key(key)’
* correctly formatted groups and allowed nested groups
* now create groups for `location`, `type` and `vendor`, with appropriate sub-groups and children
* made to_safe honor config option to clean group names for ansible consumption

* remove prefer_ip_address configuration option

no longer needed since we will specify `ansible_ssh_host` as the returned ip address.

* removed dns_name

no longer needed, will preserve `host[name]` as name in Ansible.

* purge actions from hostvars

changed purge_actions to True

* flake8 suggestion for whitespace

* fix undefined r variable in warning output

use the correct ret variable

* Default purge_actions to True

We probably don’t need them, but it is configurable, so just default to remove them.

* Add configuration option to nest cloudforms tags

disabled by default, the nest_tags option will expand cloudforms tags into a nested group/subgroup structure.  Otherwise, it will use the whole tag name.

* added purging the actions

removed in previous clean up in error.

* fixed undefined variable

specified the correct variable for logging.
2016-08-18 14:37:31 -07:00
James Cammarata
890e096b2b Clean up PlaybookExecutor logic for batches and errors
The calculation for max_fail_percentage was moved into the linear
strategy a while back, and works better there in the stategy layer
rather than at the PBE layer. This patch removes it from the PBE layer
and tweaks the logic controlling whether or not the next batch is run.

Fixes #15954
2016-08-18 13:52:34 -05:00
John R Barker
677a34a191 Merge pull request #17140 from mattclay/roadmap
Updated progress on roadmap items.
2016-08-18 10:00:04 -07:00
Matt Clay
e1262fa49b Updated progress on roadmap items. 2016-08-18 09:55:59 -07:00
Toshio Kuratomi
cb3653295f Update submodule refs 2016-08-18 07:28:03 -07:00
Brian Coca
4fb09d5693 moved from extras repo where it incorrectly exists (#17124)
* moved from extras repo where it incorrectly exists

* added to sanity exclusion for 2.4

* changed license with author's consent
2016-08-18 09:47:21 -04:00
Toshio Kuratomi
bd31cc096a Fix facts.py for python3 (#17131)
* Fix facts.py for python3

* Update facts unittest to account for filepaths being byte strings
2016-08-18 09:36:03 -04:00
Peter Sprygada
9d29431661 Merge pull request #17114 from skg-net/Dell_Ansible_Roadmap
Added Dell Networking Modules to the Roadmap
2016-08-18 08:42:43 -04:00
Sandra Wills
63be666b53 Merge pull request #17119 from sam-at-github/patch-3
I think that is a better analogy.
2016-08-18 07:56:19 -04:00
Adrian Likins
7bd57acda4 Linux mount/fs (lsblk) facts fixes and tests. (#17036)
Fixes #10779

Refactor some of the block device, mount point, and
mtab/fstab facts collection for linux for better
performance on systems with lots of block devices.

Instead of invoking 'lsblk' for every entry in mtab,
invoke it once, then map the results to mtab entries.

Change the args used for invoking 'findmnt' since the
previous combination of args conflicts, so this would
always fail on some systems depending on version.

Add test cases for facts Hardware()/Network()/Virtual() classes
__new__ method and verify they create the proper subclass based
on the platform.system() results.

Split out all the 'invoke some command and grab it's output'
bits related to linux mount paths into their own methods so
it is easier to mock them in unit tests.

Fix the DragonFly* classes that did not defined a 'platform'
class attribute. This caused FreeBSD systems to potentially
get the DragonFly* subclasses incorrectly. In practice it
didnt matter much since the DragonFly* subclasses duplicated
the FreeBSD ones. Actual DragonFly systems would end up with
the generic Hardware() etc instead of the DragonFly* classes.

Fix Hardware.__new__() on PY3, passing args to __new__
would cause "object() takes no parameters" errors. So
check for PY3 and just call __new__ without the args

See
https://hg.python.org/cpython/file/44ed0cd3dc6d/Objects/typeobject.c#l2818
for some explaination.
2016-08-17 17:58:51 -07:00
nitzmahone
9fedcdfc47 bump extras submodule ref 2016-08-17 16:42:37 -07:00
nitzmahone
88c36bbc34 bump submodule refs 2016-08-17 15:52:26 -07:00
jctanner
14da357feb vmware inventory script enhancements (#17106)
* Allow the user to disable certificate verification
* Allow the user to find VMs only in specific clusters
2016-08-17 17:44:15 -04:00
James Cammarata
b617d62203 Don't use an unset playbook basedir when searching for hostgroup vars
The flag new_pb_basedir is not being utilized in Inventory._get_hostgroup_vars,
leading to the situation where an inventory with no playbook basedir set will
read host/group vars from the $CWD, regardless of the inventory and/or playbook
relative location. This patch corrects that by not using the playbook basedir
if it is unset (None).

This patch also corrects a bug in which the VariableManager would accumulate
host/group vars files, which could lead to incorrect vars files being used when
playbooks are run from different directories containing their own group/host vars
directories.

Fixes #16953
2016-08-17 16:28:48 -05:00
Brian Coca
dac5af63cb corrected typo, expanded server types 2016-08-17 15:49:40 -04:00
Brian Coca
b581780283 dont do it 2016-08-17 15:45:31 -04:00
sam-at-github
a2d0bbed8c Handlers are triggered at the play level, not playbook. (#17121) 2016-08-17 10:36:33 -04:00
James Cammarata
732d722a7f Catch a missing include_vars filename
Related to ansible/ansible-modules-core#4445
2016-08-17 09:35:37 -05:00
sam-at-github
16426ad795 I think that is a better analogy. 2016-08-17 19:20:13 +10:00
Matt Davis
e0bdb502e3 raw now returns changed: true (#17112)
for consistency w/ shell/command/script "non-idempotent" modules.

Updated tests, changelog.
2016-08-16 20:39:23 -07:00
Senthil Kumar Ganesan
48df950a75 Added Dell Networking Modules to the Roadmap 2016-08-16 18:27:54 -07:00
Josh Smift
81d7e132f9 force deletion of .pyc files (#17109) 2016-08-17 00:43:10 +02:00
James Cammarata
f4237b2151 Rework the way params are assigned to TaskIncludes when they're dynamic
Copying the TaskInclude task (which is the parent) before loading the blocks
makes the code much more simple and clean, and fixes a bug introduced during
the performance improvement changes (and specifically the change which moved
things to a single-parent model).

Fixes #17064
2016-08-16 15:45:24 -05:00
Nathaniel Case
cada4fb8d1 Relicense netcfg.py to BSD (#17110)
As with #17025. The caveat regarding machilde's (now obsoleted) commit has been addressed, so netcfg.py is able to be easily relicensed.
2016-08-16 16:32:02 -04:00
Olaf Alders
8681df4b58 s/shutdown/shut down/ (#17107)
shutdown is a noun.  In the task name you really want a verb.
2016-08-16 21:02:25 +02:00
Brian Coca
297e2d8266 added bits and bytes arg types (#17102)
* added bits and bytes arg types

* changed function alias method as per feedback

* use enumerate vs managing i myself
2016-08-16 13:45:41 -04:00
Brian Coca
b1410fa278 fixed tests to accoutn for new parameter 2016-08-16 13:11:58 -04:00
Brian Coca
5fe9d3c3d5 make parsed param private and explicit (#17104)
* make parsed param private and explicit

* fixed missed parsed
2016-08-16 11:59:30 -04:00
Ryan S. Brown
30268f6bd0 Pass keyword arguments from modules to _boto3_conn 2016-08-16 07:56:20 -04:00
Scott Butler
124c1e3d27 Added substitution definitions and references for version number, etc 2016-08-15 17:48:46 -07:00
James Tanner
f62df4e78d Update submodule refs 2016-08-15 20:01:24 -04:00
scottb
89ce1fc917 Merge pull request #17051 from ferrants/patch-2
Update playbooks_lookups.rst
2016-08-15 12:30:44 -07:00
James Cammarata
f722d41eab Allow notifies to be sent to the top level includes when they were static
Since we introduced static includes in 2.1, this broke the functionality
where a notify could be sent to a named include statement, triggering all
handlers contained within the include. This patch fixes that by adding a
search through the parents of a handler for any TaskIncludes which match.

Fixes #15915
2016-08-15 14:22:35 -05:00
Ryan Brown
c5cc6edb93 Merge pull request #16606 from ryansb/rds-cluster-inventory-aioue
Support RDS clusters in AWS dynamic inventory script
2016-08-15 15:08:55 -04:00
Ryan S. Brown
0783c172d7 Paginate DB cluster responses in AWS RDS dynamic inventory 2016-08-15 14:27:48 -04:00
David Shrewsbury
bf8c871801 Fix async logic when parsing fails (#17091)
We want to NOT consider the async task as failed if the result is
not parsed, which was the intent of:

  https://github.com/ansible/ansible/pull/16458

However, the logic doesn't actually do that because we default
the 'parsed' value to True. It should default to False so that
we continue waiting, as intended.
2016-08-15 13:29:06 -04:00
James Tanner
1f5552f586 Update submodule refs 2016-08-15 13:02:07 -04:00
James Cammarata
daf6eb97d3 Make sure includes for handlers in roles look in the correct subdir 2016-08-15 10:08:11 -05:00
Brian Coca
64a8d24b72 slightly better presentation docs
- description items are now separated
- choices/defaults start at their own line
2016-08-15 11:00:29 -04:00
Tim Whittington
b3c686f4c5 Note that to_nice_yaml(indent=X) was new in 2.2 (#17085)
The ability to pass indent parameter to to_nice_yaml was introduced in 2.2, but this is not noted in the docs.
2016-08-15 10:41:55 -04:00
Ted Timmons
f4bd38a153 document what glob style is used (#17080)
Took some digging to find that `with_fileglob` calls a method named `fileglob()`, which uses Python's `glob` library.
2016-08-15 09:38:27 -04:00
Brian Coca
4c034fd002 updated container detection to new lxc (#17063)
fixes #17030
2016-08-15 09:15:01 -04:00
Peter Sprygada
8620fda947 Merge pull request #17077 from agaffney/junos_doc_fix
Update junos docs fragment to note the default port for transport=netconf
2016-08-15 05:19:22 -04:00
John R Barker
a8a8ef4682 2.1 has been released
Also link to new feature documentation - We need to do more of this

Thanks to kustodian for suggesting this
2016-08-15 10:10:22 +01:00
James Cammarata
3c65c03a67 Changing license on module_utils/splitter.py to BSD 2016-08-13 09:56:12 -05:00
Andrew Gaffney
fdabfb6821 Update junos docs fragment to note the default port for transport=netconf 2016-08-13 14:52:06 +00:00
James Cammarata
c669a381d1 Don't immediately return failed for any_errors_fatal tasks
Instead of immediately returning a failed code (indicating a break in
the play execution), we internally 'or' that failure code with the result
(now an integer flag instead of a boolean) so that we can properly handle
the rescue/always portions of blocks and still remember that the break
condition was hit.

Fixes #16937
2016-08-12 14:18:50 -05:00
Matt Clay
b44eb402bd Update ansible-core-ci endpoint. (#17071) 2016-08-12 12:07:41 -07:00
scottb
7eed464db0 Merge pull request #17061 from nickmisasi13/patch-1
Update developing_inventory.rst
2016-08-12 11:25:24 -07:00