Commit graph

7576 commits

Author SHA1 Message Date
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
Michael Scherer
127a37f67c Port the module snippet to python3 (#15870)
vca depend on pyvcloud, who depend on PyYAML 3.10, which
support python 2.5 as a minimum, cf https://github.com/vmware/pyvcloud/blob/master/requirements.txt
and http://pyyaml.org/wiki/PyYAML

vmware.py depend on PyVIM, who depend on python 2.6.

So we can use the modern syntax for both of them.
2016-05-16 08:04:43 -04:00
Michael Scherer
e539b2003d Make the facts module run on netbsd (#15833)
It currently fail with

 ansible/module_utils/facts.py\", line 357, in get_service_mgr_facts\r\nKeyError: 'distribution'\r\n"

Since self.facts['distribution'] is used after, we need to make sure
this is set by default and if needed, corrected somewhere for Linux.
2016-05-16 08:02:38 -04:00
feliksik
95cf095222 hashi_vault lookup: be more rebust, and allow fields with other name than 'value' (#13690)
* more robust hashi_vault module, and allow querying specific field in secret-dict

* allow fetching entire secret dict with trailing ':'

* process comment by bcoca for PR #13690
2016-05-14 21:48:31 -04:00
Alexey Kalinin
1d113c384e Fix issue with latest pyvmomi and certificate validation 2016-05-14 11:02:07 -07:00
Toshio Kuratomi
0cb05d8ac9 Some Python-3 module_utils support 2016-05-14 07:51:13 -07:00
chouseknecht
56bb3ec680
Bump core submodule ref. 2016-05-14 09:37:27 -04:00
chouseknecht
7f8a6d11c2
Bumping core submodule ref. 2016-05-14 09:26:32 -04:00
camradal
4bb4c7e68e vCloud module utils error handling bug fixes (#15859)
* Fix AttributeError that hides login errors

* Typo fixes for vca error messages
2016-05-13 23:57:08 -07:00
James Cammarata
6f6456dff5 Adding a deprecation message for accelerated mode 2016-05-13 17:01:07 -04:00
Thomas Quinot
a2c905c32e Fix uninitialized distribution fact on FreeBSD (#15842)
Initialize facts['distribution'] with self.system so that this fact does
not remain uninitialized on systems_platform_working platforms (FreeBSD,
OpenBSD).

Fixes #15841
2016-05-13 16:57:17 -04:00
Nathaniel Case
043e910652 Check for jxmlease when using netconf on JUNOS. (#15835) 2016-05-13 16:26:07 -04:00
James Cammarata
4f0be29d65 Reworking retry/until logic to fix bugs
Prior to this patch, the retry/until logic would fail any task that
succeeded if it took all of the alloted retries to succeed. This patch
reworks the retry/until logic to make things more simple and clear.

Fixes #15697
2016-05-13 16:09:38 -04:00
Toshio Kuratomi
03d33f0905 Start adding required to docs 2016-05-13 11:01:52 -07:00
jctanner
e083fa3d11 Disable sftp batch mode if sshpass (#15829)
Make use of the -oBatchMode=no option to force password prompts from sftp

Addresses #13401
2016-05-13 13:39:04 -04:00
Toshio Kuratomi
119baba6b1 Update submodule refs 2016-05-13 10:17:20 -07:00
Toshio Kuratomi
c1cc9f1f23 Merge pull request #15845 from abadger/ziploader-constants
Ship constants to the modules via internal module params rather than a secondary dict
2016-05-13 10:03:16 -07:00
Matt Martz
878b0dca68 Use .code instead of .getcode() as py24 does not have .getcode(). Fixes https://github.com/ansible/ansible-modules-core/issues/3608 2016-05-13 09:44:00 -05:00
James Cammarata
d2bade6daf Make sure setting facts with run_once makes copies of the data
When using run_once, there is only one dict of facts so passing that
to the VariableManager results in the fact cache containing the same
dictionary reference for all hosts in inventory. This patch fixes that
by making sure we pass a copy of the facts dict to VariableManager.

Fixes #14279
2016-05-13 10:05:19 -04:00
Toshio Kuratomi
186337db28 Ship constants to the modules via internal module params rather than a secondary dict. 2016-05-12 20:30:05 -07:00
Toshio Kuratomi
a404d0ffe2 Update submodule refs 2016-05-12 17:01:25 -07:00
Matt Martz
a521b70217 Merge pull request #15306 from sivel/ansible-modules-core/issue/3370
Cascade ssh_*args configurations in synchronize
2016-05-12 18:59:37 -05:00
Matt Martz
196453b9b2 Merge pull request #13771 from sivel/binary-modules
First pass at allowing binary modules
2016-05-12 18:36:34 -05:00
Matt Martz
72b6f8244c Merge pull request #15337 from sivel/ignore-profile-crap
Guard against a shell profile printing extraneous data
2016-05-12 18:32:02 -05:00
James Cammarata
ae09648068 Merge pull request #15812 from cThrice/patch-3
Fixes #15745 playbook include: Conditional scoping
2016-05-12 15:02:17 -04:00
Toshio Kuratomi
b4e78caf25 Merge pull request #15825 from abadger/fix-squashing-traceback
If we can't squash for any reason, then simply do not optimize the items loop.
2016-05-12 10:59:48 -07:00
Matt Martz
ca22783086 modify_module does not need to return module_path, as the calling code already has access to it 2016-05-12 12:53:49 -05:00
Matt Martz
34adb54734 Make _is_binary use already read module_data, move _is_binary check to the top of the stack 2016-05-12 12:53:49 -05:00
Matt Martz
0faddfa168 Move binary module detection into executor/module_common.py 2016-05-12 12:25:09 -05:00
Matt Martz
ddf3c3838f Re-implement/move some code lost due to merge conflicts 2016-05-12 12:25:09 -05:00
Matt Martz
35246abb2e Don't register new vars that aren't needed 2016-05-12 12:25:09 -05:00
Matt Martz
1e038e5043 Update for py26 2016-05-12 12:25:09 -05:00
Matt Martz
0a8d016642 Get binary modules working for windows, assuming .exe for windows 2016-05-12 12:25:08 -05:00
Matt Martz
d8a243bef0 First pass at allowing binary modules 2016-05-12 12:25:08 -05:00
Toshio Kuratomi
292f0ed0d6 If we can't squash for any reason, then simply do not optimize the items loop.
Also add more squashing testcases

Fixes #15649
2016-05-12 10:06:18 -07:00
Matt Martz
1cee3f35b1 Guard against a shell profile printing extraneous data 2016-05-12 11:43:37 -05:00
Toshio Kuratomi
4d59779e0a Fixed importing the libcloud modules to give a nice error rather than a traceback. 2016-05-12 09:13:46 -07:00
Vic Iglesias
dac356466c Update GCE module to use JSON credentials (#13623)
* Update GCE module to use JSON credentials

* Ensure minimum libcloud version when using JSON crednetials for GCE

* Relax langauge around libcloud requirements
2016-05-12 08:57:26 -07:00
James Cammarata
d391c53b4f Clear blocked hosts when a role duplicate task is found in free strategy
In the free strategy, we mark a host as blocked when it has work to do
(the PlayIterator returns a task) to prevent multiple tasks from being sent
to the host. However, we check for role duplicates after setting the blocked
flag, but were not clearing that when the task was skipped leading to an
infinite loop. This patch corrects that by clearing the blocked flag when
the task is skipped.

Fixes #15681
2016-05-12 10:38:53 -04:00
James Cammarata
08f6283c3f Merge pull request #15747 from larsks/bug/15744
do not erroneously set gathered_facts=True
2016-05-12 10:22:45 -04:00
James Cammarata
3439bcc744 Merge branch 'refresh-inventory-exit' of https://github.com/zenbot/ansible into zenbot-refresh-inventory-exit 2016-05-12 09:36:12 -04:00
James Cammarata
0d7530e6da Change error about loop variable in use to a warning 2016-05-11 21:50:12 -04:00
Toshio Kuratomi
8a184381af Strip junk after JSON return. (#15822)
Fixes #15601
2016-05-11 17:54:01 -07:00
James Cammarata
9d9a451b34 Simply being in an always block shouldn't mean a host did not fail
Previously the changed code was necessary, however it is now problematic
as we've started using the is_failed() method in other places in the code.
Additional changes at the strategy layer should make this safe to remove
now.

Fixes #15625
2016-05-11 19:13:12 -04:00
Carl
fefd87c61a Fixes #15745 playbook include: Conditional scoping
Fixes #15745
Applies conditional forwarding to all tasks/roles within the included playbook.
The existing line only applies forwarded conditionals to the main Task block, and misses pre_, post_, and roles.

Typo ::

Made a selection mistake when I copied over the one line change
2016-05-11 15:58:36 -04:00
James Cammarata
33de7707c9 Do not include params when getting role vars in certain situations
In VariableManager, we fetch the params specifically in the next step,
so including them in the prior step is unnecessary and could lead to things
being overridden in an improper order.

In Block, we should not be getting the params for the role as they are
included earlier via the VariableManager.

Fixes #14411
2016-05-11 13:17:32 -04:00
Toshio Kuratomi
9096901c1f Update submodule refs 2016-05-10 21:59:42 -07:00
Toshio Kuratomi
99e3880181 small python3 fix so that ping will run on python3 2016-05-10 21:59:42 -07:00
Brian Coca
4561be00af simplified inventory error messaging 2016-05-10 17:16:26 -04:00
Tim Rupp
a685fa5543 Add port argument for bigsuds (#15434)
This patch adds the port argument as a valid parameter to the f5_spec.

This argument is supported in bigsuds version 1.0.4 and greater, so
this patch uses the __version__ variable of the bigsuds module to
determine when the port value should be honored by the module.
2016-05-10 16:07:01 -04:00
Brian Coca
f576082949 restore old jsonfile behaviour on key expiration
fixes #14456, now it won't expire keys in middle of a play when they
were 'valid' at 'gather time'.
2016-05-10 15:55:33 -04:00
Brian Coca
47d05e9b58 fix bad assignment, method modifies by ref already
fixes #15694
2016-05-10 12:08:03 -04:00
Matthew Stoltenberg
ddd9f92255 add repr for hostvars (#15793)
* allows passing full hostvars to a module
2016-05-10 10:23:10 -04:00
Toshio Kuratomi
9e88fa21f5 Update submodule refs 2016-05-10 07:13:57 -07:00
Kamjar Gerami
724e692f54 fixes-#15685-tools-that-paginate-show-spurious-less-output: less --version outputs to standard out not to standard error so this changes the redirect from 2> to > (#15720)
fixes-#15685-tools-that-paginate-show-spurious-less-output: Updated redirect to include stderr as well as stdout to not show any errors on screen
2016-05-09 16:48:46 -04:00
jctanner
781de83762 When walking through module directories, always follow symlinks. (#15784)
Fixes #15783
2016-05-09 14:24:39 -04:00
Mike Bryant
68795d8128 Allow ssh agent usage for junos_netconf
By default the `Shell` class disables ssh agents. The `junos_netconf`
module uses this class, but doesn't re-enable agents.
Here it's explicitly enabled again, so an ssh agent can be used to
connect to and configure Junos devices.
2016-05-09 17:54:53 +01:00
Toshio Kuratomi
409bfe4d0f Strip leading and trailing whitespace for json arg types 2016-05-09 08:14:50 -07:00
Robin Roth
30e5999812 Fix distribution_facts missing on BSD (#15780)
The previous fix in #15773 only solved MacOSX, but left other BSDs broken

fixes #15768
2016-05-09 10:55:28 -04:00
Pomin Wu
78808fc4cc Fixed ansible_os_family variable on OS X (#15768) (#15773)
Fixed `ansible_os_family` variable on OS X
2016-05-09 09:59:26 -04:00
nitzmahone
fca5ba153e bump extras submodule ref 2016-05-06 09:49:33 -07:00
Toshio Kuratomi
0a5831e654 Update submodule refs 2016-05-06 08:13:51 -07:00
Jiri Tyr
589f6d25bb Updating VCA module documentation (#14368) 2016-05-06 09:53:43 -04:00
James Cammarata
09c90f7f2f Fixing bugs in strategies
* Don't filter hosts remaining based on their failed state. Instead rely
  on the PlayIterator to return None/ITERATING_COMPLETE when the host is
  failed.
* In the free strategy, make sure we wait outside the host loop for all
  pending results to be processed.
* Use the internal _set_failed_state() instead of manually setting things
  when a failed child state is hit

Fixes #15623
2016-05-06 09:22:11 -04:00
Lars Kellogg-Stedman
21ac95402f do not erroneously set gathered_facts=True
In `lib/ansible/executor/play_iterator.py`, ansible sets a host's
`_gathered_facts` property to `True` without checking to see if there
are any tasks to be executed.  In the event that the entire play is
skipped, `_gathered_facts` will be `True` even though the `setup`
module was never run.

This patch modifies the logic to only set `_gathered_facts` to `True`
when there are tasks to execute.

Closes #15744.
2016-05-05 23:45:06 -04:00
nitzmahone
7708948d7d bump submodule refs 2016-05-05 17:05:36 -07:00
nitzmahone
133395db30 add jimi-c's unit test for squashed skip results, tweaked is_skipped() logic to pass 2016-05-05 15:29:10 -07:00
Andrew Taumoefolau
85868e07a9 Don't assume a task with non-dict loop results has been skipped.
This changeset addresses the issue reported here:

  ansible/ansible-modules-core#1765

The yum module (at least) includes its task results as strings, rather than
dicts, and the code this changeset replaces assumed that in that instance the
task was skipped. The updated behaviour assumes that the task has been
skipped only if:

* results exist, and
* all results are dicts that include a truthy skipped value
2016-05-05 15:29:10 -07:00
Brian Coca
3a6ca0b4a6 made ansible-doc complain on missing 'requried' 2016-05-05 17:02:39 -04:00
Brian Coca
fb7940fc50 check that variable first
before using string methods to check for magic interpreter var
2016-05-05 11:14:11 -04:00
camradal
be87cd8c26 Fix logging into vCloud Director and expose verify_certs argument (#15533) 2016-05-05 09:48:54 -04:00
Andrew Taumoefolau
bc81c76f86 Apply inventory host restrictions by host name rather than UUID.
Issue #15633 observes that a meta: inventory_refresh task causes the playbook
to exit. An inventory refresh flushes all caches and rebuilds all host
objects, assigning new UUIDs to each. These new host UUIDs currently fail to
match those on host objects stored for restrictions in the inventory, causing
the playbook to exit for having no hosts to run further tasks against.

This changeset attempts to address this issue by storing host restrictions
by name, and comparing inventory host names against these names when applying
restrictions in get_hosts.
2016-05-05 22:32:58 +10:00
machilde
97c6389d62 Fixed issue with parents havings depth of 3+ on add method of NetworkConfig 2016-05-05 00:36:22 -05:00
Robin Roth
56ba10365c better fix for arch version detection (#15705)
* better fix for arch version detection

fixes  #15696

* be extra safe about tracebacks in facts.py

* add comments to explain the setup
* make allowempty more conservative, ignore file content
* wrap function call in try/except
  * should never happen, but if it happens the bug should be distribtion=N/A and not a traceback
2016-05-04 12:32:08 -07:00
nitzmahone
6373f2b045 error message cleanup 2016-05-04 09:43:41 -07:00
Peter Sprygada
91f67ac37a handle name resolution errors more gracefully from shell.py
This change will catch socket.gaierror exceptions from shell.py and
return a more friendly message to the user
2016-05-04 11:12:26 -04:00
Toshio Kuratomi
ae9ddf0c1c Submodule updates to fix documentation 2016-05-03 10:12:02 -07:00
Tobias Wolf
87648f7bdf actionable.py: Do not print next task banner in handler callback (#15698)
Fix actionable callback plugin to not print the banner of the previous
task.

When a handler is executed there is no task banner, so in case it is run,
it will reference the banner from the preceding task.

**Author:** @hvhaugwitz

Test case:

      ---

      - name: actionable filter
        hosts: all
        handlers:
          - name: handler
            command: "true"
        tasks:
          - name: task 1
            file: path=/tmp/test state=touch
            notify: handler
          - name: task 2
            file: path=/tmp/test state=absent
          - name: task 3
            file: path=/tmp/test state=absent
          - name: task 4
            file: path=/tmp/test state=absent
          - name: task 5
            file: path=/tmp/test state=absent
          - name: task 6
            file: path=/tmp/test state=absent

Example output:

BEFORE
------

      PLAY [actionable filter] *******************************************************

      TASK [task 1] ******************************************************************
      changed: [localhost]

      TASK [task 2] ******************************************************************
      changed: [localhost]

      RUNNING HANDLER [handler] ******************************************************

      TASK [task 6] ******************************************************************
      changed: [localhost]

      PLAY RECAP *********************************************************************
      localhost                  : ok=8    changed=3    unreachable=0    failed=0

AFTER
-----

      PLAY [actionable filter] *******************************************************

      TASK [task 1] ******************************************************************
      changed: [localhost]

      TASK [task 2] ******************************************************************
      changed: [localhost]

      RUNNING HANDLER [handler] ******************************************************
      changed: [localhost]

      PLAY RECAP *********************************************************************
      localhost                  : ok=8    changed=3    unreachable=0    failed=0
2016-05-03 11:25:46 -04:00
James Pic
d72a03deae Add get_distribution_Archlinux (#15696) 2016-05-03 08:20:08 -07:00
Toshio Kuratomi
fff94551a1 Update core submodule ref to fix docs build 2016-05-03 07:53:27 -07:00
Toshio Kuratomi
3f104dcee9 Add a jsonarg type to arg spec (#15701)
This makes sure that if we get a list or dict that it is turned into
a jsonified string.
2016-05-03 10:21:00 -04:00
Brian Coca
e0573d3099 make vi the default editor if no EDITOR
fixes #15577
2016-05-03 09:39:19 -04:00
James Cammarata
c6a9d20b5c Merge pull request #15689 from axelspringer/include_fix
Restore Ansible 2.0 compatibility for include:
2016-05-03 09:18:13 -04:00
Martin Matuska
5ee38617b9 Treat "static: yes/no" with higher priority than "task_includes_static" in ansible.cfg 2016-05-03 12:15:13 +02:00
Toshio Kuratomi
c42501cfe7 Update submodule refs 2016-05-02 11:31:06 -07:00
Toshio Kuratomi
81019e03fc Update submodule refs 2016-05-02 10:05:02 -07:00
Martin Matuska
438ed70a43 Restore Ansible 2.0 compatibility for includes 2016-05-02 17:50:42 +02:00
jctanner
eb31faa7f5 Remove the ziploader provided pythonpaths from the env inside run_com… (#15674)
Remove the ziploader provided pythonpaths from the env inside run_command.

Fixes #15655
2016-05-02 11:29:35 -04:00
James Cammarata
1fc44e4103 Don't fail hosts when using any_errors_fatal when ignoring errors
Fixes #15431
2016-05-01 12:40:09 -04:00
Yannig
3901556b35 When var name is the same as var content, try to template it before reporting that var is not defined. (#13629)
* When var name is the same as var content, try to template it before reporting that var is not defined.
Add asserts in test_var_blending to check this special corner case.

* Fix integration tests when using debug with list or dict.
2016-05-01 06:42:09 -07:00
Toshio Kuratomi
f39ad1f13a Get rid of logentries.to_unicode.
It wasn't doing anything that a literal couldn't do and used
unicode_escape which only understands latin1 (The author of the code
seems to have thought it took an encoding argument but it looks like
that was silently ignored.)
2016-04-30 07:45:51 -07:00
Toshio Kuratomi
aec74b4b65 Fix inventory on python3 2016-04-30 07:28:41 -07:00
Toshio Kuratomi
b8a988e922 bytes when passing to os.path.* and opening the file, text at other times
Fixes #15644
2016-04-29 22:20:22 -07:00
Toshio Kuratomi
f61dd8c7fc Update submodule refs 2016-04-29 22:00:57 -07:00
Toshio Kuratomi
98feafb411 Fix the mapping of module_name to Locks
This was reinitialized every time we forked before so we weren't sharing
the same Locks.  It also was not accounting for modules which were
directly invoked by an action plugin instead of going through the
strategy plguins.
2016-04-29 20:47:51 -07:00
Robin Roth
1d6608e84f Dist version fix for Red Hat and more tests (#15663)
* add tests for centos6, rhel6 and rhel7

* gen_distribution_version_testcase with python2.6

* remove unused imports

* fix redhat/vmware/... parsing

* add centos7 test case
2016-04-29 13:18:50 -07:00
Brian Coca
6f4f8e6e79 fix typo 2016-04-29 15:01:25 -04:00
Toshio Kuratomi
1b78fd57b1 Merge pull request #15656 from abadger/ziploader-namespace
Fix ziploader for the cornercase of ansible invoking ansible.
2016-04-29 11:12:11 -07:00
Brian Coca
d53c4b8ae7 fixed method signature as per #15668 2016-04-29 13:13:01 -04:00
Toshio Kuratomi
487e6562ca Fix ziploader for the cornercase of ansible invoking ansible.
* Make ziploader's ansible and ansible.module_utils libraries into
  namespace packages.
* Move __version__ and __author__ from ansible/__init__ to
  ansible/release.py.  This is because namespace packages only load one
  __init__.py.  If that is not the __init__.py with the author and
  version info then those won't be available.
* In ziplaoder, move the version ito ANSIBLE_CONSTANTS.
* Change PluginLoader to properly construct the path to the plugins even
  when namespace packages are present.
2016-04-29 08:47:49 -07:00
Chris Houseknecht
361ee9d7a6 Merge pull request #15618 from chouseknecht/docker_doc_frag
Docker doc frag
2016-04-29 01:27:57 -04:00
Brian Coca
941564b366 API now connects to server lazily (#15632)
This should fix most issues with offline operation.

Fixes #14486
Fixes #13991

Alternate to #15363 and #15593
2016-04-28 23:28:02 -04:00
Dag Wieers
7af47a3886 Rename function bool() as it is a Python built-in function (#15651) 2016-04-28 14:39:35 -04:00
Toshio Kuratomi
8016f8a638 Update submodule refs 2016-04-28 07:21:05 -07:00
Toshio Kuratomi
01cd4fd06f Handle "/usr/bin/env python" style ansible_*interpreter settings.
Fixes #15635
2016-04-27 20:22:31 -07:00
Brian Coca
60c1155d50 added common azure tags fragment 2016-04-27 16:55:41 -04:00
Peter Sprygada
c43ea83275 fixes #15496
changed to using OrderedDict to preserve order of lines
2016-04-27 14:41:00 -04:00
Toshio Kuratomi
13532027ff Update submodules ref 2016-04-27 07:17:32 -07:00
Toshio Kuratomi
2583f2774d Some beginning python3 porting for urls.py 2016-04-27 07:15:51 -07:00
Toshio Kuratomi
c2efb0b7e6 Update submodule refs 2016-04-27 06:49:17 -07:00
Toshio Kuratomi
a0f397eb6c Fix traceback in fetch_urls when status code is in info as well as the error. 2016-04-27 06:49:12 -07:00
chouseknecht
9ddcf13661
Add aliases 2016-04-27 04:12:47 -04:00
chouseknecht
2e19a1d86a
Updated doc fragment to be consistent with the getting started guide. 2016-04-27 04:02:15 -04:00
Robin Roth
b861083dfb move machine_id back to Facts class 2016-04-27 09:29:39 +02:00
Robin Roth
5626c540ce refactor distribution version parsing
* split code as separate class
* split different distributions as individual functions
* keep program logic mostly identical (for now)
* increase readability, reduce complexity/indentation
* make future testing/refactoring easier
* step towards making distribution parsing independent of the Facts class
* add some changes to make facts.py python3 parsable
2016-04-27 09:15:01 +02:00
James Cammarata
8103793b55 Version bump to 2.2.0 for devel 2016-04-26 16:29:52 -04:00
nitzmahone
8c27018038 update submodule refs 2016-04-26 09:51:16 -07:00
Brian Coca
0652fa0ce6 ran dos2unix and renamed tags cannonical option 2016-04-26 11:27:01 -04:00
Toshio Kuratomi
008bde91a8 Update submodule refs 2016-04-26 07:24:27 -07:00
Rob
bc859eec7e Add shared functionality to return list of security group IDs from list of names (#15054)
* Add shared functionality to return list of security group IDs from list of security group names - this functionality can be used by nearly all ec2 modules

* Improved doc string for get_ec2_security_group_ids_from_names function
2016-04-26 09:17:36 -04:00
Chris Houseknecht
2790929e73 Fix bugs from API version 1.20 testing. (#15586) 2016-04-25 16:07:24 -04:00
Nathaniel Case
250b975704 Clarify exception handling in net modules (#15507)
* Clarify exception handling in EOS

Also modify to EOS to standardize modules. It makes vimdiff a lot less angry

* Move IOS exception handling into Cli

* Move IOS-XR exception handling into Cli

* Move JUNOS exception handling into Cli

* Move NXOS exception handling into Cli

And reorganize to make it match the other modules

* Move OpenSwitch exception handling into Cli

More speculative restructuring here
2016-04-25 16:04:19 -04:00
James Cammarata
50792f46a5 Submodule pointer update 2016-04-25 15:58:44 -04:00
Jonathan Davila
1999e71658 Added basic auth argument spec to utils (#15585) 2016-04-25 14:55:39 -04:00
Matt Davis
8bf1c53b21 winrm connection tweaks for pywinrm (#15584)
added warnings for invalid kwargs
sniff supported authtypes (for new pywinrm)
use default authtypes (for old pywinrm)
error on unsupported authtype
allow no username/password to be specified (kerb SSO)
tested w/ old and new pywinrm
hacky CLIXML parsing of stderr
2016-04-25 14:20:27 -04:00
René Moser
4e0013d161 playbook, include: fix Unexpected Exception: 'NoneType' object has no attribute 'strip' (#15574)
If `include:` statement is used without argument, we get a traceback.
2016-04-25 13:40:49 -04:00
Olivier GROSJEANNE
4647e8b74e HTTPError can also function as a non-exceptional file-like return value (#14915)
* HTTPError can also function as a non-exceptional file-like return value (the same thing that urlopen() returns)

* HTTPError - adding response to info dictionnary

* HTTPError - adding response to info dictionnary

* HTTPError - adding body response to info dictionnary
2016-04-25 13:21:45 -04:00
Jonathan Davila
f296d74329 Documentation fragment. To be used with modules that use basic auth. (#15582)
Supplies a doc fragment for:
- api_username
- api_password
- api_url
- validate_certs
2016-04-25 12:54:11 -04:00
Toshio Kuratomi
2fd7f194c8 Convert byte strings to unicode strings in our task results (#15581)
Fixes #15367
2016-04-25 12:35:25 -04:00
Robin Roth
f7c589b049 get ssh_keys without using distribution info (#15301)
* use list of possible directories directly instead of checking distribution info
* this could fail if someone has keys in one of the other directories, but there could also be custom ssh key directories, which
  are not checked at all
* this is work towards separating Facts from Distribution in facts.py
2016-04-25 12:15:35 -04:00
Darragh Bailey
be17ba67b2 Prevent race in key setup for accelerate daemon (#15299)
Ensure that initial setup in creating the key directory for ansible
accelerate mode keys, and generation/storage of the key for a
particular host are completed in a multiprocess safe manner.

Creating directories/files and then assigning permissions and contents
to them means that paths may exist and satisfy the os.path.exists()
method in python for other processes before they are usable.

Use a combination of locking around operations with use of unique named
files and an OS file system move to ensure that the conditions of
checking whether a file or directory exists, where it is potentially
created by another thread, will only succeed when the file has both the
correct contents and permissions.

Fixes #13850
2016-04-25 12:13:42 -04:00
Matt Davis
2becd79e5f Merge pull request #15314 from nitzmahone/win_reboot
add win_reboot action
2016-04-25 09:13:18 -07:00
Peter Sprygada
2f411c9aa9 fix default REST ports for http and https in openswitch (#15580)
properly uses the right default ports for http (80) and https (443)
2016-04-25 11:42:28 -04:00
Tegan Snyder
bf0da4aa3c add centrify dzdo escalation (#15219)
add dzdo context, and test
2016-04-25 11:24:26 -04:00
Adam Hamsik
2424d57868 Add sas_address and sas_device_handle to ansible disk device facts (#15201) 2016-04-25 11:22:46 -04:00
James Cammarata
1211a0fa12 Fixing the way we iterate over child states for tasks
Previously we were first checking the fail/run state of the child
state for tasks/rescue/always portions of the block. Instead we are now
always recursively iterating over the child state and then evaluating
whether the child state is failed or complete before changing the failed/
run state within the current block.

Fixes #14324
2016-04-25 11:13:44 -04:00
Brian Coca
0f9eaedfa9 added missing alias to docker doc fragment 2016-04-25 10:20:59 -04:00
Toshio Kuratomi
87d2345cf5 Merge pull request #15562 from abadger/ziploader-minor
Quite a few individually minor changes to ziploader
2016-04-25 06:59:22 -07:00
Toshio Kuratomi
bdd73e31dc Have test-module clean up the local temp dir when it exits
Get test-module's debugger switch to do something useful with ziploader modules
2016-04-24 20:44:42 -07:00
Toshio Kuratomi
3ffd55ce7f Don't include "ansible" in the module output as there are a few files in the upper directory (args and the module) 2016-04-24 20:42:14 -07:00
Toshio Kuratomi
3c135ef3f2 Push debug files into a subdirectory to keep things cleaner.
We now have the ansible module directory, ansible_module_*.py script
file and the args file.  Makes sense to push them all into a separate
subdir.
2016-04-24 20:42:14 -07:00
Toshio Kuratomi
e9553c975f Add debug usage to comments in the ziploader wrapper and don't strip comments if ANSIBLE_KEEP_REMOTE_FILES=1 2016-04-24 20:42:13 -07:00
Peter Sprygada
03a77e025d Merge pull request #15569 from privateip/local_action_junos_template
updates action plugin junos_template to guess file format
2016-04-24 13:13:34 -04:00
Peter Sprygada
a1a732e24d updates action plugin junos_template to guess file format
This update will attempt to guess the file format based on the template
extension if the format argument isnt set.  It will also set the commit
comment to the task name if the comment isnt' explicitly defined.
2016-04-24 11:41:00 -04:00
Peter Sprygada
ffd42118d9 Revert "add new action plugin junos_config" 2016-04-24 10:34:29 -04:00
Peter Sprygada
cea6d858bc Merge pull request #15566 from privateip/junos
adds config_format to junos shared module
2016-04-24 08:57:08 -04:00
Peter Sprygada
c4bd1c5a33 Merge pull request #15553 from privateip/local_action_junos_config
add new action plugin junos_config
2016-04-24 08:25:30 -04:00
Peter Sprygada
c87300f9e7 adds check on config_format kwarg in junos
This adds a check to validate the arugment for config_format kwarg in
get_config.  If the specified format is not a valid option, the shared
module will call fail_json
2016-04-24 08:20:14 -04:00
Peter Sprygada
61baf41edc Merge pull request #5 from dgarros/pyez
Add options to get_config to accept format (text, set or xml)
2016-04-24 08:18:10 -04:00
Peter Sprygada
2c90472609 Merge pull request #15410 from privateip/junos
adds support for netconf to junos shared module
2016-04-24 06:57:18 -04:00
Toshio Kuratomi
44e21f7062 Allow AnsibleModules to be instantiated more than once in a module
Fix SELINUX monkeypatch in test_basic
2016-04-23 14:04:45 -07:00
chouseknecht
dc9b784432
Update per PR comments. 2016-04-23 12:47:16 -04:00
chouseknecht
8dc04770b6 Fix syntax error 2016-04-23 12:46:47 -04:00
chouseknecht
48a2165310 Adding docker_common util module. 2016-04-23 12:46:47 -04:00
Toshio Kuratomi
d7189a442e ziploader currently needs absolute imports to know whether to include another module 2016-04-23 07:25:21 -07:00
Yannig Perre
72f17f3ff3 New get_all_subclasses function in basic modules and use it in fact modules. 2016-04-23 07:24:26 -07:00
Yannig Perre
eb18767f91 Visit all network class not just direct sub classes.
Fix for https://github.com/ansible/ansible/issues/15446
2016-04-23 07:24:26 -07:00
Toshio Kuratomi
09605ce806 Fix facts for the FieldAttribute list change in 30a38f9 2016-04-22 16:31:53 -07:00
Peter Sprygada
edbdf0d955 add new action plugin junos_config
This adds a new action plugin for junos for working with the junos configuration
file on the remote device
2016-04-22 15:48:51 -04:00
Peter Sprygada
32329b493d adds support for netconf to junos shared module
Netconf support is provided using the junos-eznc library and the shared
module depends on junos-eznc to be installed on the local Ansible host.  This
commit also adds changes to the netcfg library to handle receiving messages
over netconf.

To use netconf, specify transport=netconf for junos module.  Be sure that
netconf has been enabled on the remote device.
2016-04-22 15:28:53 -04:00
James Cammarata
30a38f94ce Create a special class of list FieldAttribute for splitting on commas
Which we're use on a case-by-case basis if we find people were actually
using comma-separated strings for list values outside of hosts. Support
for doing so is now deprecated and users should instead use the full
YAML syntax for lists of values.

Fixes #15291
2016-04-22 14:21:14 -04:00
Toshio Kuratomi
fcd6d7010d Fixup perms dont rely on privileged user named root (#15482)
* Don't rely on username to check for root privileges

The SSH username isn't a reliable way to check if we've got root privileges on
the remote system (think "toor" on FreeBSD). Because of this check, Ansible
previously tried to use the fallback solutions for granting file access (ACLs,
world-readable files) even on systems where it had root privileges when the
remote username didn't match the literal string "root".

Instead of running checks on the username, just try using `chmod` in any case
and fall back to the previous "non-root" solution when that fails.

* Fail if we are root and changing ownership failed

Since this code is security sensitive we document exactly the expected
permissions of the temporary files once this function has run.  That way
if a flaw is found in one end-result we know more precisely what scenarios
are affected and which are not.
2016-04-22 08:40:34 -07:00
jctanner
76f73dc81f Change the raw module's detection of environment settings. (#15535)
The task_vars datastructure always contains an environment key,
so use the _task.environment property to look for a non-empty
list instead.
2016-04-21 22:58:07 -04:00
chouseknecht
a79e9182e1
Set the name of the user_agent in each mangement client. 2016-04-21 17:51:28 -04:00
Kei Nohguchi
9d5b4fe212 openswitch.py: Use new ops.dc declarative Config(DC) module (#15489)
Instead of using the old OpenSwitch runconfig, we'll use
Mir's new ops.dc declarative config for the DC interaction
with OpenSwitch.  This gives us the clearer separation between
ansible and the OpenSwitch, as well as the performance
improvement done inside the ops.dc module itself.

Squashed the original Mir's change into single commit.

Tested-by: Kei Nohguchi <kei@nohguchi.com>
2016-04-21 17:23:43 -04:00
Brian Coca
a76531ca3a submodule ref update 2016-04-21 16:30:27 -04:00
chouseknecht
af5e4abf66
Rename azure inventory script. Fix bug preventing AD user login via environment vars. 2016-04-21 14:34:08 -04:00
James Cammarata
772d659929 Updating CHANGELOG and extras submodule pointer for new kubernetes module 2016-04-21 13:23:32 -04:00
Toshio Kuratomi
bac47f6281 Update submodule refs 2016-04-21 07:42:08 -07:00
Chris Houseknecht
ba74f5f3e5 Adding docker doc frag (#15494) 2016-04-20 13:56:19 -04:00
Brian Coca
a5d79a39d5 Ensure action plugins remove tmp dirs created (#15501)
fixes #14917
2016-04-20 13:39:12 -04:00
Matt Davis
67e6bd18e4 Merge pull request #15488 from jctanner/AMC-32
WARN if the play or the task attempts to pass environment to the raw module
2016-04-20 10:03:17 -07:00
Toshio Kuratomi
6520312a65 Update submodule refs 2016-04-20 09:17:19 -07:00
Brian Coca
b1c3d2aacb removed unused section regex, corrected group one 2016-04-20 11:52:50 -04:00
Toshio Kuratomi
5fc90058e4 Make ziploader handle python packages as well as python modules 2016-04-19 20:10:51 -07:00
James Tanner
095ec760ac Provide a warning if the play or the task attempts to pass environment to the raw module.
Addresses ansible-modules-core/issues/32
2016-04-19 22:41:46 -04:00
James Cammarata
f32592f092 Merge pull request #14400 from d3matt/FIX/paramiko_lecture
paramiko transport appears to hang if it gets a sudo lecture
2016-04-19 13:31:17 -04:00
Toshio Kuratomi
ee18af48ef Merge pull request #15385 from bjne/mysql_unix_socket
mysql_*: enable mysql connection via unix socket
2016-04-19 10:09:12 -07:00
James Cammarata
a0dea1ac35 Fix var precedence bug introduced in ff9f5d7d
Fixes #14067
2016-04-19 12:40:31 -04:00
Toshio Kuratomi
7b5d2d3bec Make sure that args are interpreted as utf8 on python3 2016-04-19 09:37:17 -07:00
Toshio Kuratomi
e386a51cf8 Trnasform file name to bytes before opening it to avoid unicode errors if python tries to encode it implicitly 2016-04-19 08:33:01 -07:00
Toshio Kuratomi
0a31c24938 Merge pull request #15419 from nitzmahone/module_debug_arg_override
add _load_params debug overrides for module args/file passed on cmdline
2016-04-19 07:49:05 -07:00
Toshio Kuratomi
596f6e0894 Update core submodule ref again for another git fix 2016-04-19 07:44:26 -07:00
Toshio Kuratomi
0e63f09d5a Fix for apt module test failures 2016-04-19 07:36:46 -07:00
Brian Coca
33761efd19 Merge pull request #15417 from bcoca/copy_vaulted
Copy vaulted
2016-04-19 10:22:30 -04:00
Toshio Kuratomi
c8cb5e1042 Update submodule refs 2016-04-19 07:01:50 -07:00
Matt Davis
822f904aa6 Merge pull request #14813 from mattclay/lxd-plugin
Add lxd connection plugin.
2016-04-19 02:06:31 -07:00
James Cammarata
0e2f1b423d Merge pull request #15455 from chemikadze/devel
Fix duplicate host with different uuid created after add_host
2016-04-19 02:50:27 -04:00
James Cammarata
6eefc11c39 Make the loop variable (item by default) settable per task
Required for include+with* tasks which may include files that also
have tasks containing a with* loop.

Fixes #12736
2016-04-19 01:42:40 -04:00
Toshio Kuratomi
d2a7be142e A couple fixes for ziploader:
* Move zipcache temp dir creation into the locked section otherwise it
  races with other workers.
* Catch IOError and turn it into an AnsibleError.  IOErrors can hang
  multiprocessng.
2016-04-18 11:51:45 -07:00
nitzmahone
5b336832af add _load_params debug overrides for module args/file passed on cmdline
Updated python module wrapper explode method to drop 'args' file next to module.
Both execute() and excommunicate() debug methods now pass the module args via file to enable debuggers that are picky about stdin.
Updated unit tests to use a context manager for masking/restoring default streams and argv.
2016-04-18 11:06:46 -07:00
James Cammarata
ed35e8bce2 Don't override the http status code when successful in urls.py 2016-04-18 13:20:24 -04:00
Toshio Kuratomi
7833b5bec4 Merge pull request #15420 from robinro/distribution_version_tests
Distribution version tests
2016-04-18 10:05:55 -07:00
Chris Houseknecht
f28a0ca4bb Update Azure doc fragment (#15450)
* Add default attribute to all option doc strings.

* Fix fragment file name.
2016-04-18 11:05:30 -04:00
Brian Coca
621b98668f fixed boto.ec2 import
alternative to #15224 and fixes #11755
2016-04-18 10:34:44 -04:00
Nikolay Sokolov
d8867d7ce3 Fix duplicate host with different uuid created after add_host
If add_host is performed with hostname existing in inventory, but
not yet accessed and put in inventory cache, additional host with
same hostname and different uuid is created, causing patterns to
misbehave.
2016-04-18 00:10:09 -07:00
Ritesh Khadgaray
3608829b1b vmware.py: allow for better search functionality (#15053)
- search entity by path
 - search vm based on folder
 - search for a vm based on given id ( uuid/name/dns_name/ip/inventory_path)
 - search for a cluster by name, in a given datacenter (optionally)
 - search for objects of a given type in a folder

Note: instance uuid is unique to a VM
2016-04-17 19:10:24 +02:00
chouseknecht
ea07afe67b
Add missing AD user params. 2016-04-17 01:43:39 -04:00
Chris Houseknecht
9e6988c7b5 Merge pull request #15359 from chouseknecht/azure_common
Adding common utils module for new Azure modules.
2016-04-16 04:17:56 -04:00
chouseknecht
98d8da1e67 Adding Azure module doc fragments. 2016-04-16 01:19:59 -04:00
chouseknecht
47620737fb Adding common utils module for new Azure modules. 2016-04-16 01:13:19 -04:00
Matt Clay
5fc76df18b Add lxd connection plugin. 2016-04-15 19:10:57 -07:00
Matt Martz
a985bf6a31 Don't pass context to urlopen, instead add it to the handlers. Fixes https://github.com/ansible/ansible-modules-core/issues/3437 2016-04-15 16:10:54 -05:00
Robin Roth
37188ea336 cleanup tests
* use nose test generator
* more comments
* move facts import inside the skipped function, fix python3 warning
2016-04-15 17:14:14 +02:00
Robin Roth
2b104fe6ad fix tests for SLES and CoreOS
* include #15230
2016-04-15 17:13:59 +02:00
Brian Coca
7062e086d4 made paging marker configurable as boto differs 2016-04-15 10:37:32 -04:00
nitzmahone
e75077fb23 bump submodule refs 2016-04-14 15:57:45 -07:00
Peter Sprygada
9111efc975 adds two new regex filters for use in playbooks (#14696)
The first filter is regex_search which adds the ability to do a regex
search on a fact.  The filter supports returning either all capture groups
or a set of capture groups (either by index or named).

Example usage of regex_search filter

debug: msg="{{ out.stdout[0] | regex_search('image version. (?P<test>\d+).(\d+)', '\\g<test>', '\\2' ) }}"

The second filter is regex_findall with adds the capability to do a
regex findall on a fact or variable and return all occurances of a pattern.

debug: msg="{{ out.stdout[0] | regex_findall('vlan (\d+)' }}"

The filter supports two addtional keyword arguments, ignorecase=[true, false]
and multiline=[true, false]
2016-04-14 14:54:03 -04:00
Brian Coca
5940d3d45b fixes to vault/copy
rm _del_ as it might leak memory
renamed to tmp file cleanup
added exception handling when traversing file list, even if one fails try rest
added cleanup to finally to ensure removal in most cases
2016-04-14 14:12:48 -04:00
Cambell
cdf6e3e4bf feature/copy-vault-dataloader: Add method get_real_file(file_path) to dataloader
- get_real_file will decrypt vault encrypted files and return a path to
  a temporary file.

- cleanup_real_file will remove a temporary file created previously with
  get_real_file
2016-04-14 14:12:48 -04:00
Patrick Ogenstad
6c5ea685a2 Allow timeout to be configurable (#14973) 2016-04-14 09:35:07 -04:00
Toshio Kuratomi
78365e206f Merge pull request #15059 from willthames/remove_boto_ec2_requirement
Remove need for unnecessary boto.ec2 import
2016-04-13 19:37:56 -07:00
Toshio Kuratomi
2163a24a12 Fix when debug commands are run on the wrapper and the wrapper as a file in the current directory 2016-04-13 14:20:01 -07:00
Brian Coca
a5a6bcfbbf updated capabilities to new way of module ref 2016-04-13 14:54:34 -04:00
Brian Coca
b63238ff2c removed unused code for signal handling 2016-04-13 14:54:34 -04:00
Michael Scherer
74c83a91ed Add caps facts, fix #10360 (#15292) 2016-04-13 14:13:45 -04:00
Wolfgang Karall
7a9b8e43da get_mount_facts -- find bind mounts and add info to options field (#12036)
* get_mount_facts -- find bind mounts and add info to options field

* get_mount_facts -- only run findmnt if get_bin_path() finds the binary
2016-04-13 14:05:50 -04:00
Toshio Kuratomi
208ad36ce4 Merge pull request #15344 from abadger/ziploader
Ziploader "recursive imports" and caching
2016-04-13 10:27:01 -07:00
Jonathon Klobucar
7bee994e1c Fix for serial when percent amount is less than one host (#15396)
Ansible when there was a percentage that was calculated to be less than
1.0 would run all hosts as the value for a rolling update.

The error is due to the fact that Python will round a
float that is under 1.0 to 0, which will trigger the case of
0 hosts. The 0 host case tells ansible to run all hosts.

The fix will see if the percentage calculation after int
conversion is 0 and will else to 1 host.
2016-04-13 10:49:38 -04:00
Toshio Kuratomi
afc7ec431a Update submodule refs 2016-04-12 13:55:12 -07:00
Toshio Kuratomi
7d174910c3 Make the ziploader wrapper work with PY3 2016-04-12 11:39:22 -07:00
Toshio Kuratomi
0031e08f7d excommunicate fix 2016-04-12 09:12:58 -07:00
Toshio Kuratomi
55bb24fb7d Reenable unicode=>byte conversion for module parameters to fix integration tests 2016-04-12 08:01:07 -07:00
Toshio Kuratomi
75546678d9 Fix unittests 2016-04-12 08:01:07 -07:00
Toshio Kuratomi
452034564c python-2.4's -m is severely limited.
Extract the module and invoke it as a script to work around python-2.4's
lack of features.
2016-04-12 08:01:07 -07:00
Toshio Kuratomi
b571ecdfec Move module arg passing from the environment to stdin (from the wrapper to the module) 2016-04-12 08:01:07 -07:00
Toshio Kuratomi
dcc5dfdf81 Controller-side module caching.
This makes our recursive, ast.parse performance measures as fast as
pre-ziploader baseline.

Since this unittest isn't testing that the returned module data is
correct we don't need to worry about os.rename not having any module
data.  Should devise a separate test for the module and caching code
2016-04-12 08:01:07 -07:00
Toshio Kuratomi
b5717ef696 First whack at a recursive and ast based ziploader. I'm afraid this one may be too slow. 2016-04-12 08:01:07 -07:00
Toshio Kuratomi
b4b058794e Correct the worker.run documentation 2016-04-12 08:01:07 -07:00
Toshio Kuratomi
c929556226 Fix encoding string to show up in wrapper 2016-04-12 08:01:07 -07:00
Toshio Kuratomi
6bb0e35f85 Update submodule refs 2016-04-12 08:00:20 -07:00
Chris Houseknecht
432bfe5a4f Merge pull request #15364 from gregsidelinger/galaxy-ingore-certs-fix
Fix issue with ansible-galaxy and --ignore-certs
2016-04-12 10:32:02 -04:00
James Cammarata
8ef564176b Handle includes which may have been created in the flow of the playbook
Since 2.0 made all includes dynamic, it is now possible to create and
include a file in the course of executing a playbook. However, with the
introduction of implicit static includes this can cause problems if an
include is thought to be static but does not yet exist. For now, we're
handling missing implicit static includes as a potential dynamic include
but also adding a deprecation message to show includes like this will
need to be marked as `static: no` in the future.

Fixes #15342
2016-04-12 09:33:58 -04:00
Nathaniel Case
7290b6282d Update IOS, IOSXR, JUNOS, & OpenSwitch for environment vars. 2016-04-12 08:55:15 -04:00
Nathaniel Case
dbc49ad95b First implementation of 'fallback' parameter
Implemented & documented for EOS & NXOS
2016-04-12 08:55:15 -04:00
James Cammarata
2e55b3567b Also fix intermittent ssh error using pty's for paramiko
Related to #13876
2016-04-12 08:35:48 -04:00
Bjørnar Ness
d868cdc7b8 enable mysql connection via unix socket 2016-04-12 14:16:18 +02:00
Toshio Kuratomi
0ced20951f Use /var/tmp is user set remote_tmp below /var/tmp.
We want them to be able to influence this choice in case they want to
keep files out of /tmp (perhaps to conserve RAM if that is a tmpfs).
2016-04-11 21:03:13 -07:00
James Cammarata
44877b7c7e Don't use -tt for ssh connections when sudoable=False
Due to an apparent race condition while using pty's on a heavily loaded
system, rarely a request to create a temp directory returns an empty
string rather than the newly created path, causing an error. Disabling
forced pty's appears to resolve the issue, so this patch modifies the
mkdtemp remote call not use -tt as we're not escalating privileges and
thus no pty is required.

Fixes #13876
2016-04-11 23:22:13 -04:00
Toshio Kuratomi
6a97d6386f Always use system /tmp if system=True.
Otherwise unexpected errors can happen when the user sets remote_tmp.

Fixes #15372
2016-04-11 20:00:10 -07:00
Toshio Kuratomi
b27c424fa1 Fixes to the documentation build (#15356)
* Could only have one alias before.  Subsequent aliases overrode the
  previous ones.  Now multiple aliases work.
* Fix BLACKLISTED_MODULES.   Previously, modules were listed in the
  generated documentation despite being blacklisted
* Deprecated modules form extras were showing the (E) tag and not the
  (D) tag. Reversed that now (Probably not necessary to also show the
  E tag).
* Sort the deprecated modules alphabetically in the Category docs as
  well as the list of all modules
* Optimization: Previously rendered the modules to rst twice once in all
  group and once in individual categories.  Fixed to only render them
  once.
* Add fireball to blacklist and remove async_status (as people need to
  use that).
2016-04-11 17:11:55 -07:00
nitzmahone
336b1ae84b add win_reboot action
also includes WinRM connection plugin change to support connection reset
2016-04-11 14:48:39 -07:00
Jesper Geertsen Jonsson
bd0066d621 Adds support for converting a MAC address to an integer.
Example:
---
- hosts: local
  tasks:
    - set_fact: mac_str="52:54:00:00:00:00"
    - set_fact: base_mac="{{ mac_str | macaddr('int') }}"
    - debug: msg="{{ (base_mac|int + 257) | macaddr('linux') }}" # 52:54:00:00:01:01
2016-04-11 20:46:45 +02:00