Commit graph

7818 commits

Author SHA1 Message Date
Peter Sprygada
388f98437e Merge pull request #17165 from privateip/network
fix broken import statement from netcli rename
2016-08-20 09:29:55 -04:00
Peter Sprygada
53abcb23fa rename netcmd module to netcli
This is part of the 2.2 refactor to extract the Cli class into a
separate module.  This renames netcmd to netcli which is consistent
with the network shared modules implementations
2016-08-20 08:45:53 -04:00
Peter Sprygada
7cb2c31b1a fix import statement in ios shared module
This fixes the import statement when netcmd was renamed to netcli
2016-08-20 08:22:13 -04:00
Peter Sprygada
ac8b8f0b8b fix broken import statement from netcli rename
The network module needed to be updated with the correct module name
when netcmd was renamed to netcli
2016-08-20 08:19:08 -04:00
Peter Sprygada
f53dbec55a removes Cli and Config objects from network into separate modules
This completes the refactor of Cli and Config moving them into separate
modules netcmd and netcfg respectively.
2016-08-20 07:57:39 -04:00
Peter Sprygada
24c6443557 removes functions from ios module
This removes top level functions from the ios module and moves them
into the specific modules.  This update also includes some clean up
of the Cli transport
2016-08-20 07:27:47 -04:00
Peter Sprygada
90747e6d2f Merge pull request #17161 from privateip/netcmd
moves Cli and Command class from network to netcmd module
2016-08-20 07:25:08 -04:00
Peter Sprygada
7c928e878b moves Cli and Command class from network to netcmd module
This restructure moves the Cli object to netcmd and includes a roll up
of inor bugfix updates to CommandRunner

* CommandRunner now only allows one instance of a command in the stack and
  raise an exception if a duplidate command is detected
* CommandRunner now caches returns based on command and output
* CommandRunner is not responsible for creating Command instances
2016-08-20 06:57:13 -04:00
Adrian Likins
7d41f623dd Move py34 mock_open compat to compat/test/mock (#17157)
test/units/plugins/action/test_action.py had code
for handling a bug in python 3.4's mock_open that
causes errors when reading binary data.

Moved to compat/tests/mock.py so other tests can
use it by default.
2016-08-19 18:11:24 -04:00
Peter Sprygada
fa395bee7b Merge pull request #17149 from privateip/plugin-net-config
action plugin net_config will now remove any private result key
2016-08-19 11:48:00 -04:00
Peter Sprygada
d50ef4446f action plugin net_config will now remove any private result key
This update will now remove any keys from results that are created using
the private names.  Private names are identified as double underscore (__)
on either side of the key name
2016-08-19 11:15:36 -04:00
Peter Sprygada
112f14866a pull Config object out of network and into netcfg
This moves the Config class from network and into netcfg module with
no added features.  This is simply a reorganization of code.
2016-08-19 11:15:01 -04:00
Dusty Mabe
b817f1f3ea actions/unarchive: fix unarchive from remote url (#17126)
* actions/unarchive: fix unarchive from remote url

Currently unarchive from remote url does not work because the core
unarchive module was updated to support 'remote_src' [1], but the
unarchive action plugin was not updated for this. This causes failures
because the action plugin assumes it needs to copy a file to the
remote server, but in the case of downloading a file from a remote
url a local file does not exist, so an error occurs when the file is
not found.

[1] https://github.com/ansible/ansible-modules-core/commit/467516e

* test_unarchive: fix test with wrong remote_src use

The non-ascii filenames test had improperly set remote_src=yes even
though it was actually copying the file from the local machine (i.e.
the file did not already exist remotely). This test was passing
until the remote_src behavior of unarchive was fixed in 276550f.
2016-08-19 08:16:21 -05: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
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
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
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
James Cammarata
732d722a7f Catch a missing include_vars filename
Related to ansible/ansible-modules-core#4445
2016-08-17 09:35:37 -05: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
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
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
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
James Tanner
f62df4e78d Update submodule refs 2016-08-15 20:01:24 -04: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
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
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
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
Dag Wieers
cb5675a29f Remove a useless section, only act on 'shell' (#16205) 2016-08-12 10:13:02 -07:00
Matt Clay
4cee67452b Update submodule refs. 2016-08-12 07:20:01 -07:00
jctanner
da23700b15 Update submodule refs (#17062) 2016-08-12 10:05:06 -04:00
Dag Wieers
56148291e9 Emit warnings when safe_eval() raises a SyntaxError or other Exception (#14304)
This change is related to reported issue #14291 and pull request #14293.

Without the fix from #14293, this change will emit a warning as shown below, on the following playbook:

``yaml
---
- hosts: localhost
  gather_facts: no
  vars:
    works:
      key1: 'string'
      key2: 1234
    fails:
      key1: 'string'
      key2: 1234
      key3: false
  tasks:
  - debug: msg={{ works | to_json }}
  - debug: msg={{ fails | to_json }}
```

On error, this results in a proper warning:

```
[dag@moria ansible.dag]$ ansible-playbook test49.yml

PLAY ***************************************************************************

TASK [debug] *******************************************************************
ok: [localhost] => {
    "msg": {
        "key1": "string",
        "key2": 1234
    }
}

TASK [debug] *******************************************************************
 [WARNING]: Error in expression "{"key3": false, "key2": 1234, "key1": "string"}". (name 'false' is not defined)

ok: [localhost] => {
    "msg": "{\"key3\": false, \"key2\": 1234, \"key1\": \"string\"}"
}

PLAY RECAP *********************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=0
```
2016-08-12 09:29:54 -04:00
Dag Wieers
1268f4778d Introduce new 'filetree' lookup plugin (#14332)
* Introduce new 'filetree' lookup plugin

The new "filetree" lookup plugin makes it possible to recurse over a tree of files within the task loop. This makes it possible to e.g. template a complete tree of files to a target system with little effort while retaining permissions and ownership.

The module supports directories, files and symlinks.

The item dictionary consists of:
 - src
 - root
 - path
 - mode
 - state
 - owner
 - group
 - seuser
 - serole
 - setype
 - selevel
 - uid
 - gid
 - size
 - mtime
 - ctime

EXAMPLES:
Here is an example of how we use with_filetree within a role:

```yaml
 - name: Create directories
   file:
     path: /web/{{ item.path }}
     state: directory
     mode: '{{ item.mode }}'
     owner: '{{ item.owner }}'
     group: '{{ item.group }}'
     force: yes
   with_filetree: web/
   when: item.state == 'directory'

 - name: Template complete tree
   file:
     src: '{{ item.src }}'
     dest: /web/{{ item.path }}
     state: 'link'
     mode: '{{ item.mode }}'
     owner: '{{ item.owner }}'
     group: '{{ item.group }}'
   with_filetree: web/
   when: item.state == 'link'

 - name: Template complete tree
   template:
     src: '{{ item.src }}'
     dest: /web/{{ item.path }}
     mode: '{{ item.mode }}'
     owner: '{{ item.owner }}'
     group: '{{ item.group }}'
     force: yes
   with_filetree: web/
   when: item.state == 'file'
```

SPECIAL USE:
The following properties also have its special use:

 - root: Makes it possible to filter by original location
 - path: Is the relative path to root
 - uid, gid: Makes it possible to force-create by exact id, rather than by name
 - size, mtime, ctime: Makes it possible to filter out files by size, mtime or ctime

TODO:
 - Add snippets to documentation

* Small fixes for Python 3

* Return the portion of the file’s mode that can be set by os.chmod()

And remove the exists=True, which is redundant.

* Use lstat() instead of stat() since we support symlinks

* Avoid a few possible stat() calls

* Bring in line with v1.9 and hybrid plugin

* Remove glob module since we no longer use it

* Included suggestions from @RussellLuo

- Two blank lines will be better. See PEP 8
- I think if props is not None is more conventional 😄

* Support failed pwd/grp lookups

* Implement first-found functionality in the path-order
2016-08-11 23:33:54 -04:00
jctanner
39d764c7ad Restore previous behavior of ignoring missing files via with_fileglob (#17053)
Fixes #16801
2016-08-11 19:55:21 -04:00
James Cammarata
925b0ff9e9 cleaning up some debug statements in _queue_task() 2016-08-11 14:26:28 -05:00
James Cammarata
1c7e0c73c9 Several fixes for includes
* when including statically, make sure that all parents were also included
  statically (issue #16990)
* properly resolve nested static include paths
* print a message when a file is statically included

Fixes #16990
2016-08-11 14:07:49 -05:00
Toshio Kuratomi
854d47826c Fix classes that select a subclass based on platform (#17034)
When unittesting this we found that the platform selecting class
hierarchies weren't working in all cases.  If the subclass was directly
created (ie: LinuxHardware()), then it would use its inherited __new__()
to try to create itself.  The inherited __new__ would look for
subclasses and end up calling its own __new__() again.  This would
recurse endlessly.  The new code detects when we want to find a subclass
to create (when the base class is used, ie: Hardware()) vs when to
create the class itself (when the subclass is used, ie:
LinuxHardware()).
2016-08-11 13:26:17 -04:00
John R Barker
b82d150c42 Add missing version_added (#17050)
A number of new arguments were added in
637bbdadfa (diff-60710cdc60751ecd19968b01b98283a0)
but not documented
2016-08-11 12:58:11 -04:00
James Cammarata
68d44e48ba Remove sleeps and rely on regular queue options to process results 2016-08-11 09:11:32 -05:00
Peter Sprygada
7579df33ce Merge pull request #17032 from Qalthos/net_mod_nxos
Update NXOS to NetworkModule
2016-08-10 15:39:06 -04:00
Nathaniel Case
1ced3bfc25 NXOS changes
This refactors the nxos module to implement the classes from the
network common module.
2016-08-10 15:16:16 -04:00
James Cammarata
47acf55fa9 Cache tasks by uuid in PlayIterator for O(1) lookups
Rather than repeatedly searching for tasks by uuid via iterating over
all known blocks, cache the tasks when they are added to the PlayIterator
so the lookup becomes a simple key check in a dict.
2016-08-10 12:49:19 -05:00
Nathaniel Case
125c53e691 Relicense low-hanging fruit to BSD (#17025) 2016-08-10 10:45:54 -07:00
Victor Volle
c9d2a67ec7 16888: comment module_utils/urls.py (#16987)
* 16888: comment module_utils/urls.py

* improved documentation of module (mentioning ‘requests’)

* remove mentioning of implementation details (urllib)

* improved parameter and return value documentation
2016-08-10 08:39:48 -07:00
James Cammarata
57fca2dde2 Validate new blocks during copy
It is possible that a block is copied prior to validation, in which case
some fields (like when) which should be something other than a string might
not be. Using validate() in copy() is relatively harmless and ensures the
blocks are in the proper structure.

This also cleans up some of the finalized logic from an earlier commit and
adds similar logic for validated.

Fixes #17018
2016-08-10 08:27:59 -05:00
Rene Moser
543f266801 update submodule refs, fixes build in ansible-modules-extras 2016-08-10 13:37:10 +02:00
Brian Coca
47e3366744 fixed indent 2016-08-09 13:16:42 -04:00
Brian Coca
ea033ae2cc removed extraneous test code 2016-08-09 13:00:44 -04:00
Brian Coca
eb0c90ab80 added unsafe_writes as common file feature (#17016) 2016-08-09 12:39:17 -04:00
James Cammarata
7503875ed7 Mark playbook objects as finalized after post_validate
After post_validate() is called on an object, there should be no
need to continue looking up at parent attributes. This patch adds a
new flag (_finalized) which is set to True at the end of post_validate,
and getattr will not look beyond its own attributes from that point on.
2016-08-09 08:57:21 -05:00
Peter Sprygada
375f7c515a Merge pull request #16978 from caphrim007/feature.add-module-doc-fragments-for-f5-modules
Adds module doc fragment for F5 modules
2016-08-09 07:31:59 -04:00
Peter Sprygada
29c76be768 Merge pull request #16999 from Qalthos/net_mod_ops
OpenSwitch to NetworkModule
2016-08-09 07:30:50 -04:00
Peter Sprygada
7720caadde Merge pull request #17006 from Qalthos/net_mod_ios
Clean up module_utils.ios
2016-08-09 07:29:44 -04:00
Dag Wieers
718f431466 Allow to make the jsonfile cache files pretty (indented and sorted) (#17000)
* Allow to make the jsonfile cache files pretty (indented and sorted)

Since the json cache files are condensed, it is not very practical to look for something in them. Having indented/sorted cache files makes debugging and playbook/inventory development a lot easier to do.

I made it configurable in case people would object to the performance hit this would have, but to be honest, then they probably should be looking at other cache plugins instead IMO.

* Removed the config option and documentation changes
2016-08-08 17:15:19 -04:00
James Cammarata
e244895174 Avoid copying task parents in TaskExecutor
As Block.copy() is potentially expensive, avoid copying the parent
structure of tasks in TaskExecutor.
2016-08-08 15:58:46 -05:00
James Cammarata
06d4f4ad0e Move tasks/blocks to a single parent model 2016-08-08 15:58:46 -05:00
James Cammarata
d2b3b2c03e Performance improvements 2016-08-08 15:58:46 -05:00
Brian Coca
ce282e9373 correctly detect action
named matched only cause i set it to the same in my tests
fixes #14857
2016-08-08 14:28:14 -04:00
Toshio Kuratomi
152a2b9b8f Update submodule refs 2016-08-08 11:17:41 -07:00
Nathaniel Case
85706a704c Update IOS with new NetworkModule 2016-08-08 14:15:51 -04:00
Toshio Kuratomi
38ccd11cce Fix from @jimi-c to use task_vars when polling async tasks. (#17003)
This is needed so that async_status can use ansible_python_interpreter
for the host being contacted.

Fixes #14101
2016-08-08 10:53:36 -07:00
Erik Berg
ab678738d6 Add partition uuid to facts for Linux. (#16986)
Works by looking for partition name in /dev/disk/by-uuid
2016-08-08 12:23:19 -04:00
Filipe Niero Felisbino
e54a9d3a51 Add generic data structures querying (#13684)
* Query lookup plugin

* Add license and docstrings

* Add python3-ish imports

* Change query plugin type from lookup to filter

* Switch from dq to jsonpath_rw

* Add integration test for query filter

* Rename query filter to json_query

* Add jsonpath-rw

* Rename query filter to json_query

* Switch query implementation from jsonpath-rw to jmespath
2016-08-08 11:55:59 -04:00
Nathaniel Case
9b4455e33a OpenSwitch Cli & most of Rest 2016-08-08 11:48:47 -04:00
Adrian Likins
f21df311bc Fix hipchat callback "has no attribute display'" (#16998)
Use self._display for access to display object for
the hipchat callback plugin.

Fixes #16946
2016-08-08 11:04:06 -04:00
Matt Clay
72cca01cd4 Use file list, not recursion, in _fixup_perms. (#16924)
Run setfacl/chown/chmod on each temp dir and file.

This fixes temp file permissions handling on platforms such as FreeBSD
which always return success when using find -exec. This is done by
eliminating the use of find when setting up temp files and directories.

Additionally, tests that now pass on FreeBSD have been enabled for CI.
2016-08-05 18:40:28 -07:00
Matt Clay
e07fbba0a5 Add missing boilerplate code. (#16980) 2016-08-05 12:22:52 -07:00
Tim Rupp
5f34206b0a Adds module doc fragment for F5 modules
To reduce documentation duplication, this module fragment is
being created for use in all F5 modules.
2016-08-05 12:21:46 -07:00
Matt Clay
2dc8d80dc5 Update submodule refs. 2016-08-05 11:32:48 -07:00
James Pic
d2438b6b6b Debug output callback (#16839)
* Added debug output callback

* Better import

* Comment on line
2016-08-05 13:57:13 -04:00
Toshio Kuratomi
408664b532 Update submodule refs 2016-08-05 10:26:27 -07:00
James Cammarata
1714279b5e Tweak the way the debug strategy imports the linear strategy parent
Due to the way we load plugins, internally to Python there can be issues when
the debug strategy is loaded after the linear strategy. To work around this,
we're changing the import line for the linear strategy to avoid the problem.

Related to #16825
2016-08-05 10:06:50 -05:00
Toshio Kuratomi
6db6edfc4f YAML treats some unquoted strings as booleans. For instance, (#16961)
uri:
    follow_redirects: no

Will lead yaml to set follow_redirects=False.  This is problematic when
the module parameter is not a boolean value but a string.  For instance:

  follow_redirects = dict(required=False, default='safe', choices=['all', 'safe', 'none', 'yes', 'no']),

Our parameter validation code ends up getting follow_redirects="False"
instead of "no".  The 100% fix is for the user to quote their strings in
playbooks like:
  uri:
    follow_redirects: "no"

But we can fix quite a few common cases by trying to switch "False" back
into the string that it was specified as.  We only do this if there is
only one correct choices value that could have been specified.  In the
follow_redirects example, a value of "True" only maps back to "yes" and
a value of "False" only maps back to "no" so we can do this.  If choices
also contained "on" and "off" then we couldn't map back safely and would
need to force the module author to change the module to handle this
case.

Fixes parts of the following PRs:

* https://github.com/ansible/ansible-modules-core/pull/4220
* https://github.com/ansible/ansible-modules-extras/pull/2593
2016-08-05 06:49:34 -07:00
Toshio Kuratomi
1ecf51d87e * Fix race in creating temp directories pre-fork (#16965)
* These can still race when multiple ansible processes are created at
    the same time.
* Reverse order of expanduser and expandvars in unfrakpath(). So that
  tildes in environment variables will be handled.
2016-08-04 19:35:36 -04:00
Matt Davis
746ea64d30 fix for unspecified retries on until + test (#16963)
fixes #16907
2016-08-04 19:20:45 -04:00
Brian Coca
bced8715cd add transparent vault use to other plugins (#16957)
assemble, script and unarchive (copy already had it).
2016-08-04 18:35:30 -04:00
Will Thames
eb2a3a91a8 task_result _check_key should handle empty results (#16766)
When a task result has an empty results list, the
list should be ignored when determining the results
of `_check_key`. Here the empty list is treated the
same as a non-existent list.

This fixes a bug that manifests itself with squashed
items - namely the task result contains the correct
value for the key, but an empty results list. The
empty results list was treated as zero failures
when deciding which handler to call - so the task
show as a success in the output, but is deemed to
have failed when deciding whether to continue.

This also demonstrates a mismatch between task
result processing and play iteration.

A test is also added for this case, but it would not
have caught the bug - because the bug is really in
the display, and not the success/failure of the
task (visually the test is more accurate).

Fixes ansible/ansible-modules-core#4214
2016-08-04 17:13:33 -05:00
Ryan Brown
4f7996fbc1 Merge pull request #16879 from alikins/gce_module_utils
Fix import of gce/gcdns without a libcloud module
2016-08-04 16:16:01 -04:00
James Cammarata
159aa26b36 FEATURE: adding variable serial batches
This feature changes the scalar value of `serial:` to a list, which
allows users to specify a list of values, so batches can be ramped
up (commonly called "canary" setups):

- hosts: all
  serial: [1, 5, 10, "100%"]
  tasks:
  ...
2016-08-04 15:04:10 -05:00
ovcharenko
f326e49d75 Fix for issue @synchronize doesn't substitute variables properly #16347 (#16349)
* Fix for issue @synchronize doesn't substitute variables properly #16347
2016-08-04 11:27:44 -07:00
Hidetoshi Hirokawa
595946b80e Fix the security rules name duplication of azure_rm_common. (#16897) 2016-08-04 10:43:30 -07:00
victoru
14901b65d9 raise AnsibleError in hashi_vault lookup plugin when hvac module is not installed (#16859) 2016-08-04 10:06:12 -07:00
Brian Coca
7ea56e1c79 optimize booleanifycation 2016-08-04 11:32:26 -04:00
Brian Coca
b0786a1845 actually skip bad/broken module files found 2016-08-04 11:32:08 -04:00
Brian Coca
98c149859a added y/n to list of module booleans 2016-08-04 10:47:05 -04:00
Brian Coca
27691991c3 refactored ethtool data to allow for other callers 2016-08-04 10:41:50 -04:00
Brian Coca
f7570f1dc4 Implicit localhost ondemand (#16900)
* Revert "There can be only one localhost"

This reverts commit 5f1bbb4fcd.
this broke several usages of localhost, see #16882, #16898 and #16886

* ensure there is only 1 localhost

fixes #16886, #16882 and #16898

- make sure localhost exists before returning it
- optimzed host caching
- ensure we always return a host object
2016-08-02 10:39:00 -04:00
Brian Coca
123d54e736 added pid to backup file name to avoid collisions 2016-07-29 23:04:57 -04:00
Adrian Likins
36bf1e6b7e Fix funcd to at least import without errors. (#16288)
This plugin was using very old api, so was
updated to newer api.

Also misc style/pep8 cleanups.
2016-07-29 16:19:38 -04:00
Adrian Likins
fa1d55f683 Fix import of gce/gcdns without a libcloud module
The module level function defs for gcdns_connect() and
gce_connect() provide a default arg for 'provider' that
references into the libcloud module. If the libcloud
modules were not installed, the gce/gcdns python modules
would throw ImportError.

Let the provider arg default to None and if not provided,
set it to the default libcloud.compute.types.Provider.*
value if the modules are installed.
2016-07-29 13:34:09 -04:00
Ryan S. Brown
bed24689ec Fix syntax error in json/jsonarg type parser
The lack of a comma caused the statement to always evaluate as a
`TypeError` when python interpreted `value (list, tuple, dict)` to call
value with the arguments list, tuple, and dict.
2016-07-28 15:54:09 -04:00
William Albert
409d95d67e Refactored gce util module to support other GCP services (#15924)
This is a refactoring of the existing GCE utility module to support other projects on Google Cloud Platform.

The previous gce.py module was hard-coded specifically for GCE, and attempting to use it with other projects in GCP failed.

See https://github.com/ansible/ansible/pull/15918#issuecomment-220165913  for more detail.

This has also been an issue for others in the past, although they've handled it by simply
duplicating some of the logic of gce.py in their own modules.

-   The existing gce.py module was renamed to gcp.py, and modified to remove any 
     imports or other code that refers to libcloud.compute or GCE (the GCE_* params were
     retained for compatibility). I also renamed the gce_connect function to gcp_connect, 
     and modified the function signature to make supplying a provider, driver, and agent 
     information mandatory.

-  A new gce.py module was created to handle connectivity to GCE. It imports the
   appropriate libcloud.compute providers and drivers, and then passes them on
   to gcp_connect in gcp.py. The constants and function signatures are the same
   as the old gce.py, so compatibility with existing modules is retained.

- A new gcdns.py module was created to support PR ansible/ansible-modules-extras#2252
  for two new Google Cloud DNS modules, and to demonstrate support for a non-GCE 
  Google Cloud service. It follows the same basic structure as the new gce.py module,
  but imports from libcloud.dns instead.
2016-07-28 12:54:39 -04:00
Lukas Pirl
a9aea3c6d4 (re)allow ansible_python_interpreter to contain more than 1 arg (#16247) 2016-07-26 07:46:16 -07:00
Brian Coca
92870ee996 jsonarg bikeshed to json, arg type implies 'arg' 2016-07-26 09:50:21 -04:00
Brian Coca
4e14b7b783 warn when searching for an empty string or null 2016-07-26 08:26:07 -04:00
Toshio Kuratomi
04a60a1db4 Update submodule refs 2016-07-26 05:22:59 -07:00
Toshio Kuratomi
7e54c9a468 No longer try to import __version__ from release.py. (#16817)
I'm not sure why that would be desirable -- we really want __version__
to come from the controller whereas importing will come from the client
node.  If it turns out there was a reason to do that, please be sure to
use an exception handler that catches all exceptions instead of only
catching ImportError:

```
try:
    from ansible.release import __version__, __author__
except:
    __version__ = [...]
```

Fixes #16523
2016-07-25 11:16:27 -07:00
Toshio Kuratomi
eb3bdcb9e3 Update submodule refs 2016-07-25 06:32:25 -07:00
Brian Coca
e2f17f8d9b set cwd to task's basedir (#16805)
* switch cwd to basedir of task

This restores previous behaviour in pre 2.0 and allows for 'local type' plugins
and actions to have a more predictable relative path.

fixes #14489

* removed FIXME since prev commit 'fixes' this

* fix tests, now they need a loader (thanks jimi!)
2016-07-25 08:11:45 -04:00
Brian Coca
363596c67f added check and diff mode control to console
also expanded mk_boolean to allow for 'on/off'
fixes #16815
2016-07-25 08:05:56 -04:00
Joe (rook)
2219339dd5 Adding ethtool info to Ansible interface facts (#16513)
This will give the user details on how the interfaces are configured.
They user could query to see if TSO, GSO, etc are enbaled
on an interface.
2016-07-24 21:39:47 -04:00
Brian Coca
7fdbfd490e allow include_vars to namespace imports 2016-07-24 21:31:11 -04:00
James Cammarata
a9ff363ead Merge pull request #16779 from mirskifa/devel
Make returning results after loading vars optional
2016-07-24 08:32:18 -05:00
Matt Martz
4065acc37d indent callback output if using 3verbosity or higher (#16231) 2016-07-23 18:10:53 -04:00
Alexandre Garnier
ba2d1d0bc4 Colorize around text (#16415)
Avoid to colorize separately `lead`, equals sign and `num` and separate
them by coloring characters.
2016-07-23 18:09:20 -04:00
Robin Roth
2b28beb1d7 add check_mode option for tasks (#16056)
* add check_mode option for tasks

includes example testcases for the template module

* extend check_mode option

* replace always_run, see also proposal rename_always_run
* rename always_run where used and add deprecation warning
* add some documentation

* have check_mode overwrite always_run

* use unique template name to prevent conflicts

test_check_mode was right before, but failed due to using the same filename as other roles

* still mention always_run in the docs

* set deprecation of always_run to version 2.4

* fix rst style

* expand documentation on per-task check mode
2016-07-22 20:40:14 -04:00
Brian Coca
71c97685a1 fixes for service module interaction with systemd (#16720)
now systemd will run even if service module is inovked with parameters that it does not support
these will be removed before invoking systemd and issue a warning.

this facility will work for any new service modules.
2016-07-22 20:35:20 -04:00
nyasukun
adea1f2b80 fixed memoryerror when coping huge file (#16392)
* fixed

* support both python 2 and 3
2016-07-22 09:06:06 -04:00
Toshio Kuratomi
84c1697271 Only show the traceback for importing cryptography when in Ansible Debug. (#16795) 2016-07-22 05:40:43 -07:00
Toshio Kuratomi
15cee34f9e Update submodule refs 2016-07-21 11:09:22 -07:00
s-hertel
7e834f4178 Fixes #163 in galaxy-issues 2016-07-21 14:04:17 -04:00
Toshio Kuratomi
48a2773463 Find places where ziploader is used and change them to ansiballz so that people aren't confused when they google for information.information (#16715) 2016-07-21 10:58:24 -07:00
Alex Mirski-Fitton
7dc09adaf4 Make returning results after loading vars optional
Reinstates some functionality removed by commit 0ba9a6a but
makes the expensive operation optional (and default to off)
2016-07-21 14:25:57 +01:00
Shintaro Kaneko
372018dfce Fix typo in lib/ansible/parsing/__init__.py (#16761) 2016-07-20 18:03:50 -04:00
Connor Osborn
b06c61c49b Fix exceptions thrown from cryptography import (#16723)
A simple import of cryptography can throw several types of errors. For example,
if `setuptools` is less than cryptography's minimum requirement of 11.3, then
this import of cryptography will throw a VersionConflict here. An earlier case
threw a DistributionNotFound exception.

An optional dependency should not stop ansible. If the error is more than
an ImportError, log a warning, so that errors can be fixed in ansible or
elsewhere.
2016-07-20 03:32:23 -07:00
James Cammarata
d8a3feb976 Fix bug where getting role vars does not follow the dep chain
This bug was introduced in 3ced6d3, where getting vars from a role
did not follow the dep chain. This was originally hidden by the fact
that we got vars twice (from the block and from the roles directly).

Fixes #16729
2016-07-19 16:59:11 -04:00
Peter Sprygada
e4b3032231 removes methods to write to dest from net_config 2016-07-15 17:34:46 -04:00
Peter Sprygada
c4e2c0f487 Merge pull request #16728 from privateip/netcfg
minor update to the default comment tokens in netcfg
2016-07-15 16:42:51 -04:00
Peter Sprygada
ab3c5a0a17 minor update to the default comment tokens in netcfg
* adds checkout /* and */ as comment delimiters
* now raises exception if invalid output keyword value is used
2016-07-15 16:13:41 -04:00
Peter Sprygada
05ca246ddc adds new function to check config for unsupported commands
Some commands fail when being set so the load_config function will
now filter those commands out and return them in the result key
as filtered.
2016-07-15 16:12:12 -04:00
Peter Sprygada
e560bfeaca Merge pull request #16719 from privateip/action-plugin-vyos
add vyos action plugin for handling local operations
2016-07-15 13:52:45 -04:00
Toshio Kuratomi
9055d3ad5c Update submodule refs 2016-07-15 10:09:39 -07:00
Peter Sprygada
e5e387562d add vyos action plugin for handling local operations
This plugin extends the functions of the net_config plugin to vyos
2016-07-15 08:30:21 -04:00
Peter Sprygada
7ecc75b555 Merge pull request #16718 from privateip/vyos
add common argument save_config to vyos_argument_spec
2016-07-15 05:14:47 -07:00
jctanner
238c6461f6 Add a function to check for killed processes in all strategies (#16684)
* Add a function to check for killed processes so that if any
threads are sigkilled or sigtermed, the entire playbook execution is aborted.
2016-07-14 16:37:35 -04:00
Brian Coca
ae0c1bbc47 ansible-doc now notes when module has action plugin 2016-07-14 15:50:58 -04:00
James Cammarata
1905b7cc33 Submodule ref update 2016-07-14 12:15:39 -05:00
James Cammarata
153133132d Updating tests for new module feature for remote_src in unarchive
Fixes #10218
2016-07-14 12:15:17 -05:00
Peter Sprygada
f0c8c9e55c add common argument save_config to vyos_argument_spec 2016-07-14 07:29:24 -07:00
Brian Coca
ee815bc9a4 fxed typo 2016-07-14 09:05:01 -04:00
Toshio Kuratomi
786ee97c38 Update submodule refs 2016-07-13 10:44:26 -07:00
Brian Coca
3c39bb5633 fixed lookup search path (#16630)
* fixed lookup search path

added ansible_search_path var that contains the proper list and in order
removed roledir var which was only used by first_found, rest used role_path
added needle function for lookups that mirrors the action plugin one, now
both types of plugins use same pathing.

* added missing os import

* renamed as per feedback

* fixed missing rename in first_found

* also fixed first_found

* fixed import to match new error class

* fixed getattr ref
2016-07-13 10:06:34 -04:00
Chris Houseknecht
30c0ce1e60 Merge pull request #16680 from chouseknecht/devel
Fix find_image() not matching on tag
2016-07-12 12:54:17 -04:00
Brian Coca
ed7623ecde J2 test docs (#16646)
* moved tests from filters to actual jinja2 tests

also removed some unused declarations and imports

* split tests into their own docs

removed isnan as existing jinja2's 'number' already covers same
added missing docs for several tests

* updated as per feedback
2016-07-12 10:13:00 -04:00
James Cammarata
245ce9461d Fix unreachable host/any_errors_fatal bug in linear strategy
2e003adb added the ability for tasks using any_errors_fatal to fail
when there were unreachable hosts. However that patch used the running
unreachable hosts data rather than the results from the current task,
which causes failures when any run_once or BYPASS_HOST_LOOP task is hit
after an unreachable host causes a failure. This patch corrects that by
using the current set of results to determine if any hosts were
unreachable during the last task only.

Fixes ansible/ansible-modules-core#4160
2016-07-12 03:01:47 -05:00
Chris Houseknecht
16a3f28f6e Fix find_image() not matching on tag 2016-07-11 17:13:07 -04:00
nitzmahone
31e963dd2a tkuratomi bugfix for BOMs in powershell modules
fixes #15998
2016-07-11 11:51:42 -07:00
Brian Coca
0a439df4b0 removed redundant True/False cause arg.lower() 2016-07-11 14:22:30 -04:00
Peter Sprygada
54fc1a10fe Merge pull request #16674 from privateip/ios_config_action
adds action plugin for working with network configuration files
2016-07-11 09:57:15 -04:00
Peter Sprygada
075a03d511 adds action plugin for working with network configuration files
This adds a action plugin that will allow config and template modules
to be merged into a single module.  Once completed this will supercede
the net_template action plugin.
2016-07-11 06:12:31 -07:00
Peter Sprygada
637bbdadfa add new features to ios shared module
* add load_config() for loading a set of configuration commands
* add load_candidate() function for loading a candidate config
* updates shared module to provide NetworKModule instead of get_module
* fixes Cli transport implementation for 2.2 refactor
* updates ios documentation fragments with new options
2016-07-11 05:57:15 -07:00
Rene Moser
fffd4b7b46 update extras submodule ref
fixes build in ansible-module-extras
2016-07-11 01:14:20 +02:00
Rene Moser
be7a3b2fe6 update extras submodule ref 2016-07-10 10:35:30 +02:00
Peter Sprygada
80ab80b6fd adds additional capabilities to diff of network configs
* diff functions now split out for easier troubleshooting
* added dumps() function to serialize config objects to strings
* difference() can now expand all blocks instead of just singluar blocks
2016-07-09 14:53:39 -04:00
Peter Sprygada
c2d5865627 adds restconf transport option to ios shared module
includes changes from PR ansible/ansible#16636 and refactors for the
NetworkModule changes

new features

* ios now supports transport=restcon will additional arguments
* ModuleStub refactored into common network shared module
* import temporary get_module() function (to be removed prior to 2.2 final)
2016-07-09 08:19:10 -04:00
Peter Sprygada
c0c9cf6441 add helper factory function to avoid breaking network modules in devel
This is a temporary change to keep the get_module() function until all
of the network module refactoring is completed to avoid breaking them
in devel.   The get_module() function should not be used and will be
removed before 2.2 final.
2016-07-09 07:20:17 -04:00
jctanner
fe8258a378 make timeout decorator for facts have a configurable duration (#16551)
* Add a gather_timeout parameter
* update example ansible.cfg
* fix play level fact gathering too
2016-07-08 17:46:41 -04:00
James Tanner
ebd3eeec8c Update submodule refs 2016-07-08 17:28:11 -04:00
Brian Coca
7657f75f75 removed defined/undefined as jinja2 already has em 2016-07-08 12:11:22 -04:00
Brian Coca
7f28bcacaa added defined/undefined tests 2016-07-08 11:28:37 -04:00
Nathaniel Case
af5fba759f EOS new ModuleStub
As per #16575
2016-07-07 16:09:28 -04:00
James Cammarata
9ad8132628 Updating submodule refs 2016-07-07 13:49:42 -05:00
Peter Sprygada
b4d36f6ed4 Implement IOS restconf 2016-07-07 14:39:47 -04:00
Nathaniel Case
18738c81da New ModuleStub solution 2016-07-07 14:35:27 -04:00
Matt Davis
30c63a41e9 Merge pull request #16555 from matsu-chara/fix-error-msg-default-to-defaults
fix default/main.yml to defaults/main.yml
2016-07-07 11:14:54 -07:00
nitzmahone
b6d41d3d4b bump extras submodule ref 2016-07-07 10:59:36 -07:00
Nathaniel Case
72204ddd3e Net mod ios (#16426)
* Update IOS with new NetworkModule

* Remove redundant EOS code

* `authorize` can get rolled into NetCli

* Fix up IOS to where EOS is.

* Update IOSXR for NetworkModule

* collections is unnecessary
2016-07-07 13:46:33 -04:00
James Cammarata
6cde80fe69 Updating submodule refs 2016-07-07 11:32:46 -05:00
Brian Coca
906dc99c64 correctly set become value in console
fixes #16614
2016-07-07 10:42:40 -04:00
James Cammarata
9248cde239 Force remote_user to be the currently user for connection=local
Fixes ansible-modules-core#4092
2016-07-06 23:09:07 -05:00
Toshio Kuratomi
251c9182fe Refactor network and eos module_utils to use a subclass instead of factory function to create the NetworkModule 2016-07-06 18:24:24 -07:00
Toshio Kuratomi
626e6aee7d Update core submodule for unarchive fixes 2016-07-06 16:24:29 -07:00
Toshio Kuratomi
d1558fcee4 Don't check that we import basic.py in new-style modules (#16613)
Since Ansiballz, we no longer need to import basic directly into
a new-style module.  Some modules, like the Networking modules, may
import basic in their own module_utils files and the module will import
that specialized module_util file rather than basic.
2016-07-06 15:28:08 -07:00
Toshio Kuratomi
a93cf801e1 Update submodule refs 2016-07-06 14:42:32 -07:00
Monty Taylor
229d8f6b21 Don't treat parsing problems as async task timeout (#16458)
* Don't treat parsing problems as async task timeout

If there is a problem reading/writing the status file that manifests as
not being able to parse the data, that doesn't mean the task timed out,
it means there was what was likely a tempoarary problem. Move on and
keep polling for success. The only things that should cause the async
status to not be parseable are bugs in the async_runner.

* Add comment explaining not bailing out of loop

* Return different error when result is unparseable

* Remove extraneous else
2016-07-06 14:26:50 -07:00
James Cammarata
930d090507 Fix the way handlers are compiled and found/notified
* Instead of rebuilding the handler list all over the place, we now
  compile the handlers at the point the play is post-validated so that
  the view of the play in the PlayIterator contains the definitive list
* Assign the dep_chain to the handlers as they're compiling, just as we
  do for regular tasks
* Clean up the logic used to find a given handler, which is greatly
  simplified by the above changes

Fixes #15418
2016-07-06 14:57:38 -05:00
Brian Coca
729686a434 added back spaces for profile_tasks formatting 2016-07-06 15:39:09 -04:00
Toshio Kuratomi
d38cc1e0a1 Remove doubled instantiation of the zipfile (#16609) 2016-07-06 12:22:42 -07:00
René Moser
0f5f5fffee cloudstack: handle unicode API results in has_changed (#16601)
* cloudstack: handle unicode API results in has_changed

* cloudstack: add more case sensitve keys
2016-07-06 20:27:31 +02:00
Peter Sprygada
58eab8ee9f Merge pull request #16573 from privateip/network
captures the responses from running commands and adds response to object
2016-07-06 14:19:13 -04:00
James Cammarata
690bc192d5 Use get_handler_blocks() to get list of role handlers 2016-07-06 12:29:29 -05:00
Toshio Kuratomi
3f4027f7b4 Add the PID of the Ansible process to local_tmp directory. (#16589)
This aids in associating a leftover cachedir with a previous run of
Ansible.  Came about because of #16489
2016-07-06 10:02:20 -07:00
Will Thames
0e16a5f3ee Retain local tar.gz roles during galaxy install (#16592)
Don't treat local tar.gz files as temporary when cleaning
up at the end of an ansible-galaxy install
2016-07-06 12:28:54 -04:00
Ryan S. Brown
ddf2a73640 Make it possible to use boto3_conn outside modules
The `boto3_conn` function requires a module argument, and calls
`module.fail_json` if the connection doesn't receive enough arguments.
In non-module settings like inventory scripts, there is no module to be
passed.

The `boto3_inventory_conn` function takes the same arguments except for
`module`, and both call _boto3_conn which doesn't require a module be
passed.
2016-07-06 10:57:31 -04:00
Peter Sprygada
7d53fd2ef2 Merge pull request #16587 from privateip/netcfg
minor bug fixes found in netcfg
2016-07-05 21:16:15 -04:00
Peter Sprygada
c9dccd3566 Merge pull request #16588 from privateip/vyos
bug fixes in vyos shared module
2016-07-05 21:15:57 -04:00
Peter Sprygada
f30a836063 bug fixes in vyos shared module
* fixes lots of bugs with get_config function to perform correctly
* refactors load_config into load_candidate
* adds load_config function to convert commands to NetworkConfig
2016-07-05 20:27:11 -04:00
Peter Sprygada
3002965af0 minor bug fixes found in netcfg
* fixes issue with converting config to lines
* fixes issue with returning text config with single line
2016-07-05 20:25:53 -04:00
nitzmahone
c5e0d3d17b prevent spurious pywinrm arg warnings for non-pywinrm connection args 2016-07-05 16:04:59 -07:00
nitzmahone
908ca727d6 bump core submodule ref 2016-07-05 15:50:26 -07:00
James Cammarata
a178ffa674 Merge pull request #15890 from brandond/inv_refresh_hostvars-fixes_15115
Ignore limits and restrictions when parsing inventory.
2016-07-05 15:59:05 -05:00
Brian Coca
ec61fba553 updated subref to fix pip issue 2016-07-05 16:49:43 -04:00
Brian Coca
65f87486fc updated module subrefs 2016-07-05 15:36:26 -04:00
James Tanner
d51917f306 Update submodule refs 2016-07-05 15:00:11 -04:00
James Cammarata
06379bb288 Prevent loop_control from being inherited via parent includes
Fixes #16542
2016-07-05 12:02:38 -05:00
James Cammarata
ea6efdbf2c Merge branch 'iterator-returncode' of https://github.com/axelspringer/ansible into axelspringer-iterator-returncode 2016-07-05 10:05:20 -05:00
Martin Matuska
8bff6154a6 Determine failed hosts with _check_failed_state() (#16566) 2016-07-05 12:26:41 +02:00
Peter Sprygada
54199f1cfb initial add of vyos shared documentation fragments 2016-07-04 22:58:00 -04:00
Peter Sprygada
0430923647 Merge pull request #16423 from privateip/netcfg
bug fix in netcfg replace method to handle whitespace argument
2016-07-04 22:54:16 -04:00
Peter Sprygada
65713c2418 Merge pull request #16574 from privateip/vyos
add get_config function to vyos shared module
2016-07-04 22:53:26 -04:00
Peter Sprygada
2866c7a9fb updates netcfg to remove dependency on collections module
This fixes the netcfg shared lib to be compatable with python versions
prior to 2.7.
2016-07-04 22:25:39 -04:00
Peter Sprygada
6b8c24e0f8 bug fix in netcfg replace method to handle whitespace argument 2016-07-04 22:24:02 -04:00
Peter Sprygada
75b8cf6ab3 captures the responses from running commands and adds response to object
The Command object can now store the response from executing the command
to allow it to be retrieved later by command name.  This update will
update the Command instance with the response before returning.
2016-07-04 22:21:15 -04:00
Peter Sprygada
527e4196b2 adds new method to return specific response from command to netcmd
This adds a new method that will return the output from a specified
command that has already been excuted by the CommandRunner.  The new
method, get_command takes a single argument which is the full name
of the command to retrieve.
2016-07-04 22:20:51 -04:00
Peter Sprygada
062db03f99 add get_config function to vyos shared module
This adds a new shard function get_config to retrieve the device
configuration either from module arguments or remotely from the
device.
2016-07-04 22:10:39 -04:00
Chris Houseknecht
54db1df244 Merge pull request #16559 from chouseknecht/azure-rc5
Fix authentication via params and env variables.
2016-07-04 15:03:13 -04:00
James Cammarata
83e4a4048b Fix the way pull localhosts out of inventory for delegate_to
This patch corrects the way we look in the inventory hosts list for
implicit localhost entries when localhost aliases are used.

Fixes #16568
2016-07-04 11:25:53 -05:00
Chris Houseknecht
c71a939b08 Fix authentication via params and env vars. Update guide to RC5. 2016-07-02 21:36:34 -04:00
Chris Houseknecht
9e93f1c907 Merge pull request #16558 from chouseknecht/azure-rc5
Update and pin to azure-2.0.0rc5
2016-07-02 18:35:36 -04:00
chouseknecht
a076612b63 Update and pin to azure-2.0.0rc5 2016-07-02 18:16:43 -04:00
matsu-chara
9f8b0cabcd fix default/main.yml to defaults/main.yml 2016-07-02 21:16:33 +09:00
Eric Chou
b6c30e7985 Added axapi_authenticate_v3 and axapi_call_v3 for new AXAPIv3 that is not backward compatible 2016-07-01 17:59:49 -07:00
Matt Clay
292785ff2b Parse async response in async action. (#16534)
* Parse async response in async action.
* Add async test for non-JSON data before module output.
* Fix existing async unit test.

Resolves #16156
2016-07-01 14:52:45 -07:00
Eric Chou
147857d7ac Added axapi_authenticate_v3 and axapi_call_v3 for new AXAPIv3 that is not backward compatible 2016-07-01 13:49:28 -07:00
jctanner
f86c527736 If the known_hosts file does not exist, do not attempt to stat it. (#16548)
paramiko: If the known_hosts file does not exist, do not attempt to stat it.

Fixes #10057
2016-07-01 16:39:02 -04:00
NAGA RAVI CHAITANYA ELLURI
b312a43544 fix(callback-mail plugin): fixes the warning 'TaskResult' object has no attribute '__getitem__' because of which its not sending an email on failure (#16547) 2016-07-01 13:25:48 -04:00
Stian Vikan
288446c9bf Added and-quit to all commit statements. (#16411) 2016-07-01 12:11:05 -04:00
Brian Coca
faec03aabc fix encoding issues in profile_tasks (#16522)
* fix encoding issues in profile_tasks

fixes #16521

* really fix it

* unicode the nested

* simpler format

* readded space after name
2016-07-01 10:21:49 -04:00
Abhijit Menon-Sen
950cc26aab Use loop_control.loop_var directly
6eefc11c converted task.loop_control into an object, but while the other
callers were updated to use .loop_var instead of .get('loop_var'), this
site was overlooked.

This can be reproduced by including with loop_control a file that does
set_fact; a simple regression test along these lines is included.
2016-07-01 07:03:42 +05:30
graywulf
9b7d782abb Ignore broken pipe errors if the sshpass process has exited (#16515)
This fix prevents a broken pipe exception from occurring when password-less
SSH is configured and the sshpass process exits and closes the pipe before
the password is written to the pipe.
2016-06-30 19:39:30 -04:00
Brad Davidson
0c4effb8a6 Ignore limits and restrictions when parsing inventory.
We want to update host vars for all hosts (even those that might
have failed), and the in case of a refresh_inventory, the code has
a stale restrictions list at this point anyway.
2016-06-30 13:32:48 -07:00
Peter Sprygada
46a97e1f55 removes dependency on collections module from eos (#16485)
This removes the dependency on the Python collections module to make
it fully compliant with version prior to py2.7
2016-06-30 11:55:21 -04:00
nitzmahone
6df56f009f bump submodule refs 2016-06-29 17:36:51 -07:00
Shota
47f715fb37 Fix some typos (#16498) 2016-06-29 14:31:25 -04:00
Toshio Kuratomi
4f76222f5b Update submodule refs 2016-06-29 10:05:24 -07:00
Toshio Kuratomi
c7129c4efe In some cornercases, sys.executable is empty. Work around that by choosing a sensible default path to python and emitting a warning (#16487)
Fixes #13585

Fix grammar of warning method
2016-06-29 08:50:22 -07:00
Brian Coca
7c690f04e2 task get_path returns empty string when not in play 2016-06-29 10:50:36 -04:00
Peter Sprygada
216a845244 Merge pull request #16486 from privateip/netcmd
removes dependency on collections module from netcmd
2016-06-28 17:46:32 -07:00
Peter Sprygada
9b40e1106e removes dependency on collections module from netcmd
This change removes the dependency on collections so netcmd is
compatable with python versions prior to py2.7
2016-06-28 17:13:13 -07:00
Matt Clay
8f1b487141 Handle repeat includes in junit callback. (#16484) 2016-06-28 15:55:46 -07:00
Toshio Kuratomi
405dca1abe Update submodule refs 2016-06-28 14:53:46 -07:00
Brian Coca
2bb7feec6d Search path (#16387)
* smarter function to figure out relative paths

takes list of paths in order of relevance to current task
and does the dwim magic on them

* shared function for action plugins using new dwim

unify path construction and error info/messaging
made include and role non exclusive
corrected order and now smarter about tasks
includes inside roles are currently broken as they don't provide the correct role data
make dirname full match to avoid corner cases

* migrated action plugins to new dwim function

reported plugins to use exceptions instead of info

* clarified needle
2016-06-28 17:23:30 -04:00
Brian Coca
d843e5a79d removed unused boolean 2016-06-28 15:25:18 -04:00
Brian Coca
9abdb1bb7c added skipped_reason for verbosity not met
fixes http://github.com/ansible/ansible-modules-core/issues/4062
2016-06-28 15:24:59 -04:00
jctanner
4ba60d00c8 Refactor the parameter splitting in ini lookup to handle more path formats (#16477)
Refactor the parameter splitting in ini lookup to handle more path formats.

Fixes #16468
2016-06-28 13:24:57 -04:00
Brian Coca
3afe50dfe2 push unicode handling into unfrack 2016-06-28 10:57:41 -04:00
Brian Coca
bae988ee9b fix path utils 2016-06-28 10:38:34 -04:00
Lars Fredriksen
4b5203c5fb add holders to partitions (#16446)
* add holders to partitions

* make holder gathering a function
2016-06-28 09:44:51 -04:00
James Cammarata
af249b83e6 Don't modify the original task ds when preprocessing data
In the case of using YAML anchors/aliases, YAML actually uses references
to the duplicated object so any modifications to the original impacts
later uses of the object.

Fixes #13575
2016-06-28 03:07:59 -05:00
Pilou
b361bf90d7 Lookup password omit salt (#16361)
* Lookup unencrypted password must not include salt
* Integration test lookup: remove previous directory
* Test that lookup password doesn't return salt
* Lookup password: test behavior with empty encrypt parameter

Closes #16189
2016-06-27 10:44:25 -07:00
nitzmahone
60a8af95a5 bump core submodule ref 2016-06-27 09:00:25 -07:00
Brian Coca
1b7b1ca15e if seconds are specified, min is 1 2016-06-27 09:36:15 -04:00
Peter Sprygada
d83962d3f5 Merge pull request #15992 from ogenstad/asa
Module util, template action and doc fragment for Cisco ASA
2016-06-27 06:32:12 -07:00
Matt Clay
c2a5cb6174 Fix junit callback plugin for Python 2.6. (#16440) 2016-06-24 14:22:27 -07:00
James Cammarata
04fca42b62 Fixing issues with getattr caused by 5a3493b 2016-06-24 15:43:03 -05:00
Toshio Kuratomi
9330edd6b9 Update submodule refs 2016-06-24 09:01:40 -07:00
Peter Sprygada
32b605f603 Merge pull request #16422 from privateip/network
bug fix changes Config class in network to only raise exceptions
2016-06-23 16:15:20 -07:00
Peter Sprygada
02902325b4 Merge pull request #16424 from privateip/vyos
initial commit of vyos shared module with Cli transport
2016-06-23 16:15:07 -07:00
James Cammarata
948682dbe2 Fix off-by-one error with retries
Fixes #16408
2016-06-23 18:07:11 -05:00
James Cammarata
3e4755f7e4 Remove unnecessary role initialization and lookup stuff
* Remove unnecessary copying of values from parents to role deps, as
  this can cause problems when roles have multiple parents (or the same
  parents with different params speficied through deps)
* Since we're already checking the dep chain in the block for role
  things (which every task in a role should have), it is not necessary
  to check the role directly in case it improperly grabs something

Fixes #14438
2016-06-23 17:00:01 -05:00
nitzmahone
ac04ffb9b1 apply @zazard's fix to parent attribute lookup 2016-06-23 14:11:07 -07:00
Peter Sprygada
77922f82e2 initial commit of vyos shared module with Cli transport
This adds support for the VyOS network operating system using the
Cli transport.   This module will simplify building VyOS based
modules in Ansible
2016-06-23 12:27:33 -07:00
James Cammarata
c24c0f5f6b Properly wrap objects using json default encoder
Our custom encoder for the to_json filter was simply returning the
object if it was not a HostVars object, leading in some cases to a
TypeError when the data contained an undefined variable. This lead
to an odd error message being propagated up, so we now properly catch
this as an undefined variable error.

Fixes #15610
2016-06-23 09:19:32 -05:00
w1r0x
7d24e6e95c Fixes #12309 (#14121) 2016-06-23 09:02:34 -04:00
James Cammarata
3ea3fa8d46 Merge pull request #14639 from ivovangeel/find_mount_point-bug
Fixed bug in find_mount_point function
2016-06-22 22:38:54 -05:00
nitzmahone
5f9ca67685 bump extras submodule ref for test failures 2016-06-22 17:27:16 -07:00
nitzmahone
76633ddc4c bump submodule refs 2016-06-22 17:21:54 -07:00
James Cammarata
7c27f72515 Merge pull request #14356 from mludvig/session_token
Add support for AWS_SESSION_TOKEN environment variable. (trivial patch)
2016-06-22 18:51:09 -05:00
Peter Sprygada
107c13759e changes Config class in network to only raise exceptions
The Config class should not call fail_json but simply raise exceptions
and allow the implementor to handle the exception
2016-06-22 09:22:50 -05:00
Toshio Kuratomi
39c543e356 Use find -exec + so that failures will be visible in find's exit code (#16389)
Fixes #16385
2016-06-22 05:42:37 -07:00
James Cammarata
4c1601e9f2 Take previously failed/unreachable hosts into account when checking the batch
Again, as we're carrying failed/unreachable hosts forward from play to play via
internal structures, we need to remember which ones had previously failed so that
unrelated host failures don't inflate the numbers for a given serial batch in the
PlaybookExecutor causing a premature exit.

Fixes #16364
2016-06-21 16:47:38 -05:00
James Cammarata
aefa12a20f Merge pull request #13709 from traveloka/credstash-support-encr-context
Make credstash lookup plugin support encryption contexts
2016-06-21 11:00:43 -05:00
James Cammarata
15e648dd94 Fix handler listeners as a list
The listen statement on handlers should have supported a list, however
it was broken in the revision of the pub/sub feature based on the handler
revamp. This patch corrects the bug, so this works again:

- name: some handler
  ...
  listen:
  - some target
  - another target

Fixes #16378
2016-06-21 10:00:10 -05:00
James Tanner
b1d32e6e32 Update submodule refs 2016-06-20 18:08:20 -04:00
nitzmahone
2bf9f593b5 bump submodule refs 2016-06-20 13:09:57 -07:00
James Cammarata
96a96b0e97 Merge pull request #16360 from agaffney/old_style_module_args_quoting
Fix quoting of args for old-style modules
2016-06-20 12:42:47 -05:00
Nathaniel Case
5dccff29bf Network Module: EOS (#16158)
* add new module network

* move EOS to NetworkModule

* shell.py Python 3.x compatibility

* implements the Command class through the connection for eos

This implements a new Command class that specifies the cli command
and output format.  This removes the need to batch commands through
the connection

* initial add of netcmd module
2016-06-20 12:11:48 -04:00
James Cammarata
17447ff035 Fixing typo in base strategy code from handler listen feature merge 2016-06-20 09:47:43 -05:00
James Cammarata
ca6ee4c789 FEATURE: handler listeners
Fixes ansible/proposals#8
2016-06-20 09:30:20 -05:00
James Cammarata
8218591fec Track notified handlers by object rather than simply their name
Due to the fact that roles may be instantiated with different sets of
params (multiple inclusions of the same role or via role dependencies),
simply tracking notified handlers by name does not work. This patch
changes the way we track handler notifications by using the handler
object itself instead of just the name, allowing for multiple internal
instances. Normally this would be bad, but we also modify the way we
search for handlers by first looking at the notifying tasks dependency
chain (ensuring that roles find their own handlers first) and then at
the main list of handlers, using the first match it finds.

This patch also modifies the way we setup the internal list of handlers,
which should allow us to correctly identify if a notified handler exists
more easily.

Fixes #15084
2016-06-20 09:30:20 -05:00
Andrew Gaffney
a64f7fd602 Fix quoting of args for old-style modules
This removes the extra layer of quotes around values in the 'args' file.
These quotes were there before the pipes.quote() call was added, but
were not removed, resulting in too much quoting.
2016-06-19 19:21:25 +00:00
jctanner
1db02dfb71 If decryption of a vaulted file failed, include the filename in the error. (#16329)
Fixes #16327
2016-06-18 09:30:08 -04:00
James Cammarata
8ee851cd95 Merge pull request #13460 from yesbox/devel
Adds support for converting a MAC address to an integer
2016-06-18 08:16:12 -05:00
James Cammarata
4bc85e150a Merge pull request #12807 from Lujeni/devel
Ansible-galaxy requirements support a include directive
2016-06-18 07:50:59 -05:00
James Cammarata
20754c1094 Allow groups to be specified using YAML list syntax for add_host
Fixes #12622
2016-06-18 07:47:10 -05:00
Zempashi
af150ea43a Fix linux 'ip' stdout parsing. (#16170)
With network-manager in debian (stretch) and openvpn connection enabled
the output for ipv6 is different and include a 'peer' keyword.

Fixes #15448
2016-06-17 17:10:45 -04:00
Nate Coraor
706778ee7f Fix distro detection for Solaris derivatives 2016-06-17 16:54:52 -04:00
art-at-sky
38590fbab9 Fix string coercion problem in error handling code 10:50 (#16270)
Manifests as the following stack trace
  File "/usr/local/Cellar/ansible/2.0.1.0/libexec/lib/python2.7/site-packages/ansible/utils/display.py", line 259, in error
      new_msg = u"ERROR! " + msg
      TypeError: coercing to Unicode: need string or buffer, AnsibleParserError found
2016-06-17 12:02:01 -07:00
Mark Szymanski
2b0d0d0323 Allowing changed colour to be set properly from ansible.cfg (#16338) 2016-06-17 12:26:20 -04:00
Toshio Kuratomi
bef1971ffe Update core submodule for wait_for fix 2016-06-17 07:09:00 -07:00
Toshio Kuratomi
6cb8fdeaf2 Use find instead of -R for recursive setfacl (#16340)
(-R is not present on Solaris or freebsd setfacl)

Fixes #16322
2016-06-17 10:00:21 -04:00
James Tanner
a5046a3ffe Update submodule refs 2016-06-17 09:59:21 -04:00
Matt Davis
5900571273 Merge pull request #16296 from ccin2p3/hotfix/issue_16295
Properly template task names in free strategy
2016-06-16 10:53:56 -07:00
Matt Davis
9e2e2b1c54 Merge pull request #16279 from md5/show-facl-error
Show stderr when there is an error calling setfacl
2016-06-16 09:58:24 -07:00
nitzmahone
0a0b44baeb bump submodule refs 2016-06-15 14:50:52 -07:00
Toshio Kuratomi
a3959644ee Change the default of module_set_locale to False. (#16313)
This makes Ansible no longer set LC_ALL for remote systems.  It is up to
the individual modules to set LC_ALL if they need it for screenscraping
the output from a program.

This is the 2.2 followup for #15138
2016-06-15 14:21:04 -04:00
Colin Hoglund
5a2b34e159 allow spaces before the filter string (#16312) 2016-06-15 14:17:17 -04:00
Toshio Kuratomi
e088193599 Update submodule refs 2016-06-15 10:36:01 -07:00
Toshio Kuratomi
16211e7dab Check that required arguments src and dest are present.
Fixes #16301
2016-06-15 09:37:09 -07:00
Adrian Likins
a7639896a2 Delete currently unused code. (#16290)
This was kind of confusing, and also caused sphinx-apidoc
to throw strange errors.
2016-06-15 12:07:40 -04:00
Brian Coca
13d52ae438 subref update 2016-06-15 11:25:12 -04:00
Brian Coca
4acac55d23 add executable if none exists when become
this is needed as become adds commands that require shell
2016-06-15 11:24:16 -04:00
elotje
8c7ceaab81 Unprivileged become on HP-UX/UNIX (Fixes #16249) (#16275)
Problem: When setting the file permissions on the remote server for
unprivileged users ansible expects that a chown will fail for unprivileged
users. For some systems (e.g. HP-UX) this is not the case.

Solution: Change the order how ansible sets the remote permissions.
* If the remote_user sudo's to an unprivileged user then we attempt to
  grant the unprivileged user access via file system acls.
* If granting file system acls fails we try to change the owner of the
  file with chown which only works in case the remote_user is privileged
  or the remote systems allows chown calls by unprivileged users (e.g.
  HP-UX)
* If the chown fails we can set the file to be world readable so that
  the second unprivileged user can read the file. Since this could allow
  other users to get access to private information we only do this
  ansible is configured with "allow_world_readable_tmpfiles" in the
  ansible.cfg
2016-06-15 08:16:24 -07:00
Adrian Likins
f819bb524a zone plugin updates for newer api (#16289)
Fixes errors on import.
2016-06-15 07:37:38 -07:00
Toshio Kuratomi
c4838286ac Make sure we don't end up with an empty PYTHONPATH (#16240)
When the PYTHONPATH is an empty string python will treat it as though
the cwd is in the PYTHONPATH.  This can be undesirable.  So make sure we
delete PYTHONPATH from the environment altgether in this case.

Fixes #16195
2016-06-15 07:02:56 -07:00
Remi Ferrand
9c3447c619 Properly template task names in free strategy
* Fixes #16295
2016-06-15 09:49:04 +02:00
jctanner
dc9b53a6aa Add further commentary about synchronize process_remote. (#16292)
Addresses #16284
2016-06-14 20:20:19 -04:00
Sergei Smolianinov
9753cac530 Fix synchronize module incorrect remote host processing. (#15993)
Fixes  #15539
2016-06-14 19:37:26 -04:00
biancalana
e143d3a75b Better FreeBSD distribution facts (#15866)
* - Give more usable content to distribution_version and set distribution_major_version

* Make python 2.4 friendly
2016-06-14 17:58:23 -04:00
Toshio Kuratomi
8c8e064828 Be more lenient of symlinked /bin/sh inside the chroot (#16239)
Symlinks inside of the chroot were failng because we weren't able to
    determine if they were pointing to a real file or not.  We could write
    some complicated code to walk the symlink path taking into account where
    the root of the tree is but that could be fragile.  Since this is just
    a sanity check, instead we just assume that the chroot is fine if we
    find that /bin/sh in the chroot is a symlink.  Can revisit if it turns
    out that many chroots have a /bin/sh that's a broken symlink.

    Fixes #16097
2016-06-14 12:03:59 -07:00
nitzmahone
9dcfa468f7 bump core submodule ref 2016-06-14 11:37:22 -07:00
Brian Coca
90ae3f4d6d removed duplicate constants setting
also it had a non ANSIBLE_ env var
2016-06-14 13:15:47 -04:00
Mike Dillon
17372244d4 Show stderr when there is an error calling setfacl 2016-06-14 09:29:20 -07:00
Jiri Tyr
27d065924f Adding custom indentation of YAML and JSON filters (#10008) 2016-06-14 10:07:34 -04:00
ben-taylor-nzme
e1d248dddf fix error message (#16264)
The error was: TypeError: fail_json() takes exactly 1 argument (2 given)
2016-06-14 10:02:07 -04:00
Brian Coca
07846f7bec ignore closing file error when file not open
fixes #16268
2016-06-14 09:34:41 -04:00
Peter Sprygada
59e1bb3e6e fixes using ssh keyfile with junos network module
The junos network module will now properly use the ssh key file if its
passed from the playbook to authenticate to the remote device.  Prior
to this commit, the ssh keyfile was ignored.
2016-06-13 22:39:51 -04:00
Toshio Kuratomi
a88919c751 Update submodule refs 2016-06-13 12:05:42 -07:00
Toshio Kuratomi
0e98ce11c4 Comment on is_executable's limitations and change logic to only use bit-manipulations
This is clearer to anyone who understands that unix file modes are bitfields.
2016-06-13 09:43:51 -07:00
Toshio Kuratomi
facea1ff0c Remove unneeded pass 2016-06-13 09:43:51 -07:00
Toshio Kuratomi
9273e1e7c7 Update submodule refs 2016-06-13 08:00:22 -07:00
Toshio Kuratomi
94dc4554db Workaround bad interaction with .pth files. (#16238)
When setuptools installs a python module (as is done via python setup.py
install)  It puts the module into a subdirectory of site-packages and
then creates an entry in easy-install.pth to load that directory.  This
makes it difficult for Ansiballz to function correctly as the .pth file
overrides the sys.path that the wrapper constructs.  Using
sitecustomize.py fixes this because sitecustomize overrides the
directories handled in .pth files.

Fixes #16187
2016-06-13 07:56:18 -07:00
René Moser
7aca70b4b0 cloudstack: simplify tag handling (#16188)
Fixes tag support in projects.
2016-06-13 08:27:27 +02:00
nitzmahone
445a88d3e8 call base _connect() from winrm._connect()
without it, we don't get the base's free become method error check
2016-06-10 14:40:29 -07:00
Brian Coca
734bbcb1d3 better handling of retry files 2016-06-10 14:03:22 -04:00
Brian Coca
de18566882 made ssh compression configurable (#16214)
AIX ssh does not seem to like compression, moved it to ssh_args
to allow making it configurable. Note that those using ssh_args
already will need to add it explicitly to keep compression.
2016-06-10 13:17:49 -04:00
nitzmahone
ece1ed09d5 fix for psuedo-connection hostvars not propagating to connection
(mostly done by jimi-c, tested working)
2016-06-10 10:14:41 -07:00
Dag Wieers
04ce71b4bd Give a module the possibility to known its own name (#16087)
* Give a module the possibility to known its own name

This is useful for logging and reporting and fixes the longstanding problem with syslog-messages:

    May 30 15:50:11 moria ansible-<stdin>: Invoked with ...

now becomes:

    Jun  1 17:32:03 moria ansible-copy: Invoked with ...

This fixes #15830

* Rename the internal name from module.ansible_module_name to module._name
2016-06-10 11:48:54 -04:00
Brian Coca
a529a60478 raw should not use default executable (#16085)
also removed unused cruft in script
2016-06-10 11:37:58 -04:00
J. Javier Maestro
828b73dd2d Fix: create retry_files_save_path if it doesn't exist (#15659)
* Fix: create retry_files_save_path if it doesn't exist

Ansible documentation states that retry_files_save_path directory will be
created if it does not already exist. It currently doesn't, so this patch
fixes it :)

* Use makedirs_safe to ensure thread-safe dir creation

@bcoca suggested to use the makedirs_safe helper function :)
2016-06-10 09:30:06 -04:00
Toshio Kuratomi
10860c50bd Update submodule refs for revert of git change 2016-06-09 14:50:13 -07:00
Brian Coca
4625bd2de5 updated submodule refs 2016-06-09 15:18:29 -04:00
Brian Coca
c376954ecf avoid processing bad mtab entries (#16206)
fixes #16174
2016-06-09 15:05:06 -04:00
Toshio Kuratomi
1b58b55346 Update submodule refs 2016-06-09 08:56:52 -07:00
jctanner
02e52c319c Force an include to be a static task if no vars or loops are being used. (#16192)
Fixes #15735
2016-06-08 19:23:48 -04:00
James Cammarata
b51d0dd69b Fix hostvars lookup of locahost based on 5f1bbb4 2016-06-08 14:14:02 -05:00
James Cammarata
5f1bbb4fcd There can be only one localhost
The changes to exclude implicit localhosts from group patterns exposed
the bug that we sometimes create multiple implicit localhosts, which
caused some bugs with things like includes, where the host was used as
an entry into a dict, so having multiple meant that the incorrect host
(with a different uuid) was found and includes were not executed for
implicit localhosts.
2016-06-08 13:03:52 -05:00
James Cammarata
fbec2d9692 Expand return code values returned by TQM and strategies
This allows the PlaybookExecutor to receive more information regarding
what happened internal to the TaskQueueManager and strategy, to determine
things like whether or not the play iteration should stop.

Fixes #15523
2016-06-08 10:21:57 -05:00
Peter Sprygada
178cfd142b fixes issue with ssh keyfile and nxos authentication
The nxos cli provider would not properly handle ssh key files passed
from the playbook task.   The ssh_keyfile argument is now properly
passed to the ssh authentication method

This fix address the bug reported in #3862
2016-06-07 21:01:34 -04:00
nitzmahone
d91315f2a0 bump submodule refs 2016-06-07 17:15:19 -07:00
James Cammarata
f9803bfcc9 Revert "don't tempalte register"
This reverts commit 7ba790bbaf.

Fixes #15700
2016-06-07 13:38:26 -05:00
James Cammarata
068e447fda Further tweaks to variable precedence to make it match our docs
Also removes looking at role variables from the Block, as those are
merged in separately via VariableManager
2016-06-07 12:08:01 -05:00
James Cammarata
b37b51dcea Fix variable precedence issue where set facts beat role params
Also updates doc on variable precedence, as it was incorrect for the
order of play vars/vars_prompt/vars_files in relation to set_fact and
registered variables.

Fixes #14702
Fixes #14826
2016-06-07 11:25:02 -05:00
James Cammarata
fa368934bd Create state in PlayIterator for unknown hosts rather than raise errors
Since we now use the PlayIterator to carry forward failures from previous
play executions, in the event that some hosts which had previously failed
are not in the current inventory we now create a stub state instead of
raising an error.
2016-06-07 09:42:39 -05:00
Brian Coca
f76befdb9a fix issues when state is not supplied 2016-06-07 10:29:24 -04:00
Krzysztof Magosa
721da46842 fix: playbook_on_task_start expects name and not task object (#16168) 2016-06-07 09:43:01 -04:00
Ritesh Khadgaray
ef9238ab85 set remote_user to default if none is found when using delegate_to (#16138) 2016-06-07 09:36:17 -04:00
Peter Sprygada
596b32f31e Merge pull request #16148 from privateip/working
fixes issues with authenticating using ssh-agent for ios devices
2016-06-07 06:31:46 -04:00
Brian Coca
6f36909074 service now passes 'started' instead of 'running'
other modules don't have to implement this directly
also updated docs to prefer 'started'.
fixes #16145
2016-06-06 22:30:04 -04:00
Trond Hindenes
ad4eb751a5 moved pending reboot to powershell.ps1 2016-06-06 23:18:51 +02:00
James Cammarata
e36b4014f5 Merge pull request #15958 from Schnitzel/taskinclude_handler
new HandlerTaskInclude Class which can run TaskIncludes inside Handlers
2016-06-06 14:01:57 -07:00
Adrian Likins
7eec99a140 Merge pull request #16154 from vlna/patch-1
Typo fix: Kuraotmi -> Kuratomi
2016-06-06 13:36:18 -04:00
James Cammarata
b33aeee2f0 Merge branch 'andreyshestakov-devel' into devel 2016-06-06 11:26:08 -05:00
James Cammarata
add2d1947e Fix recursive call of _load_inventory_file() in VariableManager
Fixes #16128
2016-06-06 11:25:15 -05:00
James Cammarata
1f18f5c92d Tweak the poll time to 0.005 to improve perf with large playbooks 2016-06-06 11:24:32 -05:00
James Cammarata
b9e743b478 Merge branch 'devel' of https://github.com/andreyshestakov/ansible into andreyshestakov-devel 2016-06-06 11:03:28 -05:00
James Cammarata
560532da7d Make sure we add host/group vars files when parsing inventory
Also fixes a bug where add_host was not adding the vars files

Fixes #16117
2016-06-06 10:52:39 -05:00
Brian Coca
2a984bbc98 much more fine grained error messages
fixes #16039
2016-06-06 11:48:16 -04:00
rdezavalia
a7274774ed Support etcd v2. Use this version by default (#12312)
* Support etcd v2. Use this version by default

* default to etcd v1
2016-06-06 11:26:12 -04:00
vlna
53ac89e40d Typo fix: Kuraotmi -> Kuratomi 2016-06-06 15:24:44 +02:00
Peter Sprygada
0a87651fc5 fixes issues with authenticating using ssh-agent for ios devices
Exception was raised when trying to use ssh-agent for authentication to
ios devices.   This fix enables ssh-agent and enable use of password
protected ssh keys.  There is one additional fix to capture authentication
exceptions nicely.
2016-06-06 07:53:42 -04:00
James Cammarata
d21cd16a91 Change uses of unicode() to to_unicode() in inventory/__init__.py 2016-06-04 21:05:33 -05:00
James Cammarata
879dc3a687 Mark implicitly hosts as such and exclude them from the all group
Fixes #16059
2016-06-04 18:53:47 -05:00
Toshio Kuratomi
5a3493be5f Port urls.py to python3 and other byte vs text fixes (#16124)
* Port urls.py to python3

Fixes (largely normalizing byte vs text strings) for python3

* Rework what we do with attributes that aren't set already.

* Comments
2016-06-04 16:19:57 -07:00
nitzmahone
434c949d03 update azure minimum doc fragment 2016-06-04 16:05:58 -07:00
nitzmahone
d1b611a730 updates for Azure SDK 2.0.0rc4 2016-06-04 15:05:13 -07:00
Toshio Kuratomi
4fe8fe303f Update submodule refs 2016-06-04 10:50:09 -07:00
Toshio Kuratomi
80c36bef9f Update submodule refs 2016-06-04 08:50:54 -07:00
Toshio Kuratomi
3bac945147 Fix the copy action to not send the content as a param. (#16127)
Has already been transferred as a tempfile.

This fixes the error in https://github.com/ansible/ansible/issues/16125
but there may be higher level issues that should be fixed as well (other
modules might be able to cause status fields like failed and changed to
return a censored string instead of a bool).  So leaving 16125 open for
now.
2016-06-03 12:32:15 -07:00
nitzmahone
14fec788a1 bump core submodule ref 2016-06-03 10:43:19 -07:00
Matt Clay
7a533406f9 Merge pull request #13145 from Mic92/devel
lxc connection plugin
2016-06-03 10:09:04 -07:00
Brian Coca
85f4c95843 minor optimization 2016-06-03 09:56:56 -04:00
Brian Coca
2482c687b7 optimize openbsd pkg_mgr fact discovery 2016-06-03 09:54:59 -04:00
Brian Coca
44bd1db976 updated package to use minimal fact gathering
also fixed results handling of fact gathering
2016-06-03 09:54:59 -04:00
Michael Scherer
f07d6b26a7 Show a better error message when there is too much arguments (#16119)
If someone run:

  ansible all -m file state=present

The error message is "Missing target hosts" which is misleading, since
the target hosts is here, the problem is the missing '-a'.
2016-06-03 09:53:41 -04:00
jctanner
2bf2e0fdfd Force relative role paths to be absolute and correct errors about missing path(s). (#16088)
Addresses #10811
2016-06-03 09:46:51 -04:00
James Cammarata
273a965dcc Fix the way host and group vars are loaded
* In the VariableManager, we were not properly tracking if a file
  had already been loaded, so we continuously append data to the end
  of the list there for host and group vars, meaning large sets of data
  are duplicated multiple times
* In the inventory, we were merging the host/group vars with the vars
  local to the host needlessly, as the VariableManager already handles that.
  This leads to needless duplication of the data and makes combining the
  vars in VariableManager take even longer.
2016-06-02 16:52:37 -04:00
Bede Carroll
805e0ec529 Add validate_certs to vmware doc fragment (#16096) 2016-06-02 10:21:39 -04:00
Matt Clay
7edfeb3665 Add junit callback plugin. (#16089)
Add junit callback.
2016-06-01 13:34:00 -07:00
ogenstad
6027e5b580 Module util, template action and doc fragment for Cisco ASA 2016-06-01 20:57:30 +02:00
Adrian Likins
644f0fb190 Merge pull request #15178 from alikins/galaxy_info_output
galaxy info displayed 'galaxy_info' section wrong [fix for #15177]
2016-06-01 10:27:15 -04:00
Brian Coca
3387d557bc Revert "Add prefixing and suffixing fuctionality to assemble module" (#16084) 2016-06-01 09:17:10 -04:00
Matt Clay
10a07fcc26 Update submodule refs. 2016-05-31 17:21:22 -07:00
Chris Houseknecht
ce34397cf8 Merge pull request #10399 from underyx/assemble-with-prefix-and-suffix
Add prefixing and suffixing fuctionality to assemble module
2016-05-31 18:16:23 -04:00
Bence Nagy
fadef43af7 Add header and footer support to assemble action 2016-05-31 14:40:27 -07:00
Matt Clay
126bc40ecf Do not remove exception from result, hide output.
This allows all callback plugins access to exception details.
2016-05-31 11:28:22 -07:00
Adrian Likins
1468538414 galaxy info displayed 'galaxy_info' section wrong
The output of 'ansible-galaxy info' was formatting the
'galaxy_info' key with one char per line.

Previously, when building the output string, items in
role_info that had a dict for value, the label for
it's key ('galaxy_info' for ex) was being added to
the text list in addition to being appended. Only
the append is needed.

Also added a unit test in test/units/cli/test_galaxy.py,
but skip it on py3 until galaxy is py3 compatible.

fixes #15177
2016-05-31 13:28:15 -04:00
Brian Coca
4c3c294a03 fixed confusing reporting when no hosts are matched
it was hitting 'empty inventory' warning.
2016-05-31 12:16:06 -04:00
Brian Coca
e63bf1d86e fix version/help when missing action
also fixed issues with galaxy cli options
2016-05-31 09:30:50 -04:00
Brian Coca
eaa7b9c0b7 treat roles_path as the list it is for galaxy list 2016-05-31 09:00:56 -04:00
Andrey Shestakov
295c7ce1c8 Fix sleep intervals (14219) 2016-05-31 09:33:58 +03:00
Jörg Thalheim
88482234e6
lxc connection plugin 2016-05-28 00:15:09 +02:00
chouseknecht
38c99fa9d5
Bump ansible-modules-core submodule to commit 90e8a36d4c 2016-05-27 13:47:07 -04:00
Tobias Wolf
328b423a0e Solve performance issue with a large number of groups (#13957)
Ansible excessively checks the file system for the potential presence of
`group_vars` and `host_vars` files.

For large numbers of groups this leads to combinatorial performance
issues.

This commit generates a set of group_vars and host_vars filenames using
`os.listdir()` in every possible location and then checks against the sets
before making a stat of the file system.

Also included in this commit is caching of the base directory lookup
for the inventory.
2016-05-27 10:43:11 -04:00
Brian Coca
011320793b moved validate info from vvv to debug 2016-05-27 09:45:10 -04:00
Chris Houseknecht
2261b2e59a Fix missing ignore_certs (#16018) 2016-05-27 09:39:00 -04:00
Toshio Kuratomi
c03555b650 Fix unarchive failures when the destination is a symlink to a directory (#15999)
Also add integration tests for this problem and unicode filenames inside
a tarball.

Fixes #3725
2016-05-26 14:47:11 -07:00
Matt Davis
b5bb518279 Merge pull request #16012 from stpierre/list-like-choices
Modules: check for list-like choices in arg spec
2016-05-26 14:36:47 -07:00
Chris St. Pierre
bfd69a7042 Modules: check for list-like choices in arg spec
This makes it possible to use anything other than a list (e.g., a
tuple, or dict.keys() in py3k) for argument_spec choices. It also
improves the error messages if you don't use a list type.
2016-05-26 16:20:31 -05:00
James Cammarata
3e03004b6f Use get_dep_chain() instead of directly using a blocks _dep_chain
Child blocks (whether nested or via includes) don't get a copy of the
dependency chain, so the above method should be used to ensure the block
looks at its parents dep chain.

Fixes #15996
2016-05-26 15:48:07 -04:00
Brian Coca
6a0a366746 fixed service fact usage 2016-05-26 13:37:59 -04:00
René Moser
176a207c61 Merge pull request #15974 from resmo/feature/vpc
cloudstack: add VPC support
2016-05-26 07:43:40 +02:00
Brian Coca
48d8fa0380 updated subrefs 2016-05-25 17:29:44 -04:00
Brian Coca
90cbb8c01b re-add the service action plugin (#13001)
* readd the service action plugin, was removed cause it created unexpected fact gathering and there are no split service plugins that would make this useful (yet)
Revert "removed action plugin as service facts and separate modules don't work yet and this forces gathering facts"

This reverts commit 7368030651.

* now only does minimal fact gathering
2016-05-25 17:14:04 -04:00
Toshio Kuratomi
3b69ef7e8b Add strings 'True' and 'False' as booleans as python bools converted to strings will look that way.
Workaround for custom modules which are using choices=BOOLEANS instead
of type='bool'.
2016-05-25 10:36:16 -07:00
Rene Moser
62c424797a cloudstack: add common network code
Also used for VPC support.
2016-05-24 23:18:17 +02:00
Toshio Kuratomi
a2bef45cf6 Update submodule refs 2016-05-24 11:52:19 -07:00
Tim Rupp
9041a0fee9 Adds a general purpose Exception class for F5 modules (#15977)
This class can be used by F5 modules for raising exceptions.
This should be used to handle known errors and raise them so
that they can be printed in the fail_json method.

The common Exception class built-in should not be used because
it hides tracebacks that are necessary to have when debugging
problems with the module.
2016-05-24 11:18:39 -04:00
Brian Coca
52a0165c77 skip non executable inventory when no shebang (#15969)
alternate fix #15934
2016-05-24 10:25:10 -04:00
Rene Moser
fe05c5e35a cloudstack: add VPC support 2016-05-23 23:01:31 +02:00
Michael Scherer
cf44db58e0 Add SEQUENCETYPE to handle the dict_keys type (#15953)
On python 3, there is a specific type for dict keys
instead of list, so previous tests based on Sequence didn't
not work anymore.
2016-05-23 15:17:28 -04:00
Brian Coca
c8f0cdbdfd renamed systemd detection function 2016-05-23 15:09:09 -04:00
James Cammarata
733d017ad0 Save and restore the loader's basedir when loading playbooks
Fixes #15930
2016-05-23 15:04:44 -04:00
Michael Scherer
f9f6f24acd Add a alias for 'long' since python3 do not have it (#15952) 2016-05-23 10:30:06 -04:00
James Cammarata
72b29d122e When adding nested blocks, don't pass in any parent includes
We previously changed block behavior to prefer includes over parent
blocks, which broke inheritence in nested blocks.

Fixes #15926
2016-05-23 10:08:29 -04:00
Michael Schmid
566690a44a Fixes #15915: New HandlerTaskInclude Class which can run TaskIncludes inside Handlers 2016-05-22 15:45:55 +02:00
Toshio Kuratomi
b75895df9b Fix the error handling for loop squashing to restore the name argument into the task args 2016-05-21 07:07:26 -07:00
nitzmahone
a0ff49194e bump submodule refs 2016-05-20 17:29:42 -07:00
Brian Coca
4821dc66ad now we show path from which we load module on vvv
also added remote module location on debug
2016-05-20 09:25:20 -04:00
Brian Coca
38cca53669 return friendlier error when failing to make dirs 2016-05-20 09:03:01 -04:00
jctanner
5bb4ee0c1e Avoid duplicate system related fact calls. (#15716)
* Avoid duplicate system related fact calls.

Addresses #1461
2016-05-19 22:34:19 -04:00
Toshio Kuratomi
97791f8b4e Update submodule refs 2016-05-19 13:28:36 -07:00
Matt Davis
aee3b2e430 Merge pull request #15919 from camradal/devel
Fix issue with latest pyvmomi and certificate validation
2016-05-19 12:30:12 -07:00
Peter Oliver
95cfceda98 Catch DistributionNotFound when pycrypto is absent (#15731)
* Catch DistributionNotFound when pycrypto is absent

On Solaris 11, module `pkg_resources` throws `DistributionNotFound` on import if `cryptography` is installed but `pycrypto` is not.  This change causes that situation to be handled gracefully.

I'm not using Paramiko or Vault, so I my understanding is that I don't
need `pycrpto`.  I could install `pycrypto` to make the error go away, but:
- The latest released version of `pycrypto` doesn't build cleanly on Solaris (https://github.com/dlitz/pycrypto/issues/184).
- Solaris includes an old version of GMP that triggers warnings every time Ansible runs (https://github.com/ansible/ansible/issues/6941).  I notice that I can silence these warnings with `system_warnings` in `ansible.cfg`, but not installing `pycrypto` seems like a safer solution.

* Ignore only `pkg_resources.DistributionNotFound`, not other exceptions.
2016-05-19 11:39:34 -07:00
Matt Clay
bad293ae35 Add work-around for ssh pty race condition.
This should minimize loss of stdout when using
a pty and connecting with ssh or paramiko_ssh.
2016-05-19 10:33:17 -07:00
René Moser
ff62d7bbbd docs: cloudstack: add cloudstack guide to doc fragments (#15898) 2016-05-19 10:31:44 +02:00
Toshio Kuratomi
8363ef43c9 Update submodule refs 2016-05-18 17:04:16 -07:00
Matt Davis
ec2cb07988 Make 'required' optional in module docs (#15906)
Updated module dev docs, doc build, ansible-doc to match
2016-05-18 16:57:36 -07:00
James Cammarata
74a252d0a5 More playbook executor compatibility fixes
With some earlier changes, continuing to forward failed hosts on
to the iterator with each TQM run() call was causing plays with
max_fail_pct set to fail, as hosts which failed in previous plays
were counting those old failures against the % calculation.

Also changed the linear strategy's calculation to use the internal
failed list, rather than the iterator, as this now represents the
hosts failed during the current run only.
2016-05-18 14:09:21 -04:00
Toshio Kuratomi
aad9f43dda Make load_params into a function that custom modules can access (#15913) 2016-05-18 10:50:55 -07:00
Peter Sprygada
d197407306 Merge pull request #15743 from mattchilders/multi-parent-netcfg-difference
Fixed issue with parents havings depth of 3+ on add method of Network…
2016-05-18 09:30:57 -04:00
Toshio Kuratomi
61f2147385 Rename pycompat to pycompat24
This change makes it so we know when it is safe to get rid of the module
(when we stop supporting python2.4) and makes it easier for us to find
code that is using the functions in there to update.

If needed, we'll create a pycompat26 and pycompat27 as well.  These
files are for functions that are needed on that python version to write
portable code.  So python-2.4 compatible modules may need code in
pycompat24, python26+ modules may need code in pycompat26, etc.  If
a function is needed in multiple python versions, we should implement it
in an internal common file and use import to put it in the namespace for
each pycompatXY module.
2016-05-18 06:18:01 -07:00
James Cammarata
f0e26d0b76 In TQM run() mark any entries in _failed_hosts as failed in the PlayIterator
As noted in the comment, the TQM may be used for more than one play. As such,
after creating the new PlayIterator object it is necessary to mark any failed
hosts from previous calls to run() as failed in the iterator, so they are
properly skipped during any future calls to run().
2016-05-18 08:17:39 -04:00
James Cammarata
0f659d699e Re-remove checking for failed state on hosts when building list of hosts
This was re-added by 63471cd (and modified by me to use iterator again),
it simply needs to be removed.

Fixes #15395
2016-05-18 08:17:39 -04:00
Vincent Roy
7a1309c98a Make sure that serial failures are handled correctly. 2016-05-18 08:17:39 -04:00
Vincent Roy
59d3ae6136 Don't let max_fail_percentage affect future plays. 2016-05-18 08:17:39 -04:00
Vincent Roy
994e57fa2b Handle max_fail_percentage per task. 2016-05-18 08:17:39 -04:00
Vincent Roy
e193e80f04 Don't stop executing plays after failure.
https://github.com/ansible/ansible/pull/13750/files
2016-05-18 08:17:39 -04:00
Vincent Roy
ba89b2a095 Backward compatibility execution failures with 1.9 2016-05-18 08:17:39 -04:00
Peter Sprygada
48aa9153f2 Merge pull request #15755 from ocadotechnology/fix-junos-netconf-ssh-agent
Allow ssh agent usage for junos_netconf
2016-05-18 07:54:59 -04:00
Peter Sprygada
9553dfdbab Merge pull request #15911 from keinohguchi/ops_rest_auth_fix
openswitch.py: Fix the OpenSwitch REST authentication
2016-05-18 07:40:15 -04:00
Peter Sprygada
114a0596aa Merge pull request #15727 from privateip/shell_module
handle name resolution errors more gracefully from shell.py
2016-05-18 06:53:06 -04:00
Kei Nohguchi
2043c32551 openswitch.py: Fix the OpenSwitch REST authentication
It's a cookie based authentication, that we get it
through /login endpoint, called by connect() method
and save the cookie for the rest of the call.
2016-05-18 00:17:32 -07:00
Toshio Kuratomi
73a2bddf84 Update submodule refs 2016-05-17 10:51:14 -07:00
Peter Sprygada
7cb7132b24 Merge pull request #15891 from privateip/fixes-ansible-modules-core-3502
bugfix for issue with trying to eval contains with non-string
2016-05-17 06:43:42 -04:00
Michael Scherer
fb2355e47d Port rax.py to python3 compatible syntax (#15875)
Since the pyrax website say that only python 2.7 is tested,
I do not think it is worth to aim for python 2.4 compatibility
for the various rackspace modules.
2016-05-16 17:30:25 -07:00
Peter Sprygada
83d0a15588 bugfix for issue with trying to eval contains with non-string
fixes ansible/ansible-modules-core#3502
2016-05-16 14:54:26 -04:00
Brian Coca
c648c95eb7 made format more flexible and allow for non dict entries 2016-05-16 14:39:49 -04:00
Peter Sprygada
8f7c879574 Merge pull request #15629 from privateip/fix-15496
make netcfg preserve command order
2016-05-16 13:59:46 -04:00
Rob
ba63ccb880 Handle case of both Key and key (#15468) 2016-05-16 12:19:41 -04:00
Michael Scherer
8680cc7156 Fix pkgin detection on NetBSD 6 and 7 (#15834)
Since this is now the default package manager, it got moved
to another location on Netbsd :

  netbsd# type pkgin
  pkgin is a tracked alias for /usr/pkg/bin/pkgin
  netbsd# uname -a
  NetBSD netbsd.example.org 6.1.4 NetBSD 6.1.4 (GENERIC) amd64

But since the package manager is also used outside of NetBSD, we
have to keep the /opt/local path too.
2016-05-16 10:13:49 -04:00
Kei Nohguchi
8de25db681 net_template.py: Fix jinja2 template file search path (#15134)
The change is needed to support the multiple include statements
inside the jinja2 template file, as in '{% include ['another.j2'] %}'.
statement.  I need this capability, as OpenSwitch `switch` role needs
to handle multiple *.j2 files and supporting the include statement
inside jinja2 file is essential, otherwise I need to combine multiple
template files into a single file, which easily causes conflicts
between developers working on different parts of the teamplate, ports
and interface.
2016-05-16 10:05:08 -04:00
Michael Scherer
10edaabed5 Port module_utils/ec2.py to python 3 syntax (#15879)
Since boto is considered as python 2.6 only (cf
https://github.com/ansible/ansible/blob/devel/test/utils/run_tests.sh#L15 ),
no need to use the 2.4 compatible syntax.
2016-05-16 08:44:51 -04:00
Michael Scherer
eb52dc9af0 Port azure_rm_common.py to py3 syntax (#15880)
Since the rest of the file already use a non 2.4 syntax
(such as format), I didn't bother using the 2.4 syntax for
exceptions.
2016-05-16 08:42:28 -04:00
Michael Scherer
cdef2f5db6 Port the gce snippet to a python 2.6 to 3 compatible syntax (#15872)
Since it depend on libcloud and libcloud requirements include python 2.6
since libcloud 0.4.0 (https://libcloud.apache.org/about.html), which
was released in 2011 Q2, and GCE drivers were added in 2013,
we can't run a libcloud version with GCE support on 2.4.
2016-05-16 08:11:31 -04:00
Michael Scherer
fae492324e Port the rest of the file to the 2.4/3 compatible syntax (#15873)
Since the modules can use a paramiko transport (ergo
python 2.4 syntax), we need to keep compat with 2.4 and python 3,
so we need to use the get_exception trick, even if the various juniper
libraries are not compatible with 2.4.
2016-05-16 08:11:15 -04:00
Michael Scherer
a4f6fc0dc2 Port docker_common.py to py3 compatible syntax (#15877)
Since docker-py depend on python 2.6 (cf their tox.ini),
we do not need to make it python 2.4 compatible.
2016-05-16 08:10:35 -04:00
Michael Scherer
97f16b7700 Port shell snippet to python3/2.4 compatible syntax (#15874) 2016-05-16 08:10:07 -04:00