Commit graph

6448 commits

Author SHA1 Message Date
Christoph Dittmann
267199fdd5 Update debug messages and comments
The comment was taken literally from lib/plugins/strategy/linear.py and
makes no sense in free.py where we have no noop tasks.

Also update the debug messages.
2015-12-02 11:17:24 +01:00
Christoph Dittmann
c6e400fbea Fix issue #13370
all_blocks is referenced after the loop over included_files, so it needs
to be initialized before this loop, not inside.
2015-12-02 11:17:24 +01:00
Christoph Dittmann
9a6ae1d62a Let PlayIterator.add_tasks accept empty task lists
PlayIterator.add_tasks raised an error when trying to add an empty task
list.  This was the root cause of ansible issue #13370.
2015-12-02 11:17:24 +01:00
Brian Coca
b92cb93539 unconditionally set vars on init to avoid issues with var precedence 2015-12-01 21:24:46 -08:00
Peter Sprygada
2491afc8b6 fixes a syntax issue with module_utils/eapi.py
This patch fixes an issue with the common args dict in the eapi shared
module.  This patch is required for the eapi shared module to be properly
imported and is therefore should be applied to all instances.
2015-12-01 23:34:59 -05:00
Brian Coca
8c630406c9 Merge pull request #13357 from privateip/feature_ssh_shared_module
initial add of ssh shared module.
2015-12-01 19:15:03 -08:00
Brian Coca
923b5467e3 Merge pull request #13354 from privateip/feature_eapi
adds device common argument to shared module
2015-12-01 19:14:07 -08:00
Brian Coca
574d7be8d5 Merge pull request #13358 from privateip/feature_ios_shared_module
Feature ios shared module
2015-12-01 19:04:24 -08:00
Peter Sprygada
93cd7a2a5f adds module create function for eapi.py shared module
This commit changes the way modules create an instance of AnsibleModule to
now use a common function, eapi_module.  This function will now automatically
append the common argument spec to the module argument_spec.  Module
arguments can override common module arguments
2015-12-01 20:00:41 -05:00
Peter Sprygada
8638e0ccf8 initial add of the ios shared module
This adds shared module support for building modules that connect to Cisco
IOS devices.  It builds on the module_utils/ssh.py shared module.
2015-12-01 19:55:41 -05:00
Brian Coca
3e01516783 fixed signature for init on callbacks
also removed passing display to base class which already handles this
2015-12-01 14:06:54 -08:00
nitzmahone
c94509f273 allow shell plugin to affect remote module filename
Fix for 13368, added get_remote_filename to shell plugins, powershell version appends .ps1 if necessary, base shell plugin no-ops
2015-12-01 13:39:02 -08:00
Abhijit Menon-Sen
f488de8599 Make sudo+requiretty and ANSIBLE_PIPELINING work together
Pipelining is a *significant* performance benefit, because each task can
be completed with a single SSH connection (vs. one ssh connection at the
start to mkdir, plus one sftp and one ssh per task).

Pipelining is disabled by default in Ansible because it conflicts with
the use of sudo if 'Defaults requiretty' is set in /etc/sudoers (as it
is on Red Hat) and su (which always requires a tty).

We can (and already do) make sudo/su happy by using "ssh -t" to allocate
a tty, but then the python interpreter goes into interactive mode and is
unhappy with module source being written to its stdin, per the following
comment from connections/ssh.py:

        # we can only use tty when we are not pipelining the modules.
        # piping data into /usr/bin/python inside a tty automatically
        # invokes the python interactive-mode but the modules are not
        # compatible with the interactive-mode ("unexpected indent"
        # mainly because of empty lines)

Instead of the (current) drastic solution of turning off pipelining when
we use a tty, we can instead use a tty but suppress the behaviour of the
Python interpreter to switch to interactive mode. The easiest way to do
this is to make its stdin *not* be a tty, e.g. with cat|python.

This works, but there's a problem: ssh will ignore -t if its input isn't
really a tty. So we could open a pseudo-tty and use that as ssh's stdin,
but if we then write Python source into it, it's all echoed back to us
(because we're a tty). So we have to use -tt to force tty allocation; in
that case, however, ssh puts the tty into "raw" mode (~ICANON), so there
is no good way for the process on the other end to detect EOF on stdin.
So if we do:

    echo -e "print('hello world')\n"|ssh -tt someho.st "cat|python"

…it hangs forever, because cat keeps on reading input even after we've
closed our pipe into ssh's stdin. We can get around this by writing a
special __EOF__ marker after writing in_data, and doing this:

    echo -e "print('hello world')\n__EOF__\n"|ssh -tt someho.st "sed -ne '/__EOF__/q' -e p|python"

This works fine, but in fact I use a clever python one-liner by mgedmin
to achieve the same effect without depending on sed (at the expense of a
much longer command line, alas; Python really isn't one-liner-friendly).

We also enable pipelining by default as a consequence.
2015-12-01 23:32:20 +05:30
Toshio Kuratomi
50553bc2ba _connect no longer takes a port argument 2015-12-01 09:12:25 -08:00
Brian Coca
f1fcab4610 ignore password flags in become conflict check
since all the --ask pass options end up triggering the same code
and are functionally equivalent, ignore them when it comes to checking
privilege escalation conflicts. This allows using -K when --become-method=su
and so on.
2015-12-01 08:18:31 -08:00
Brian Coca
a6f6a80caa avoid inheritance issues with default=dict declaration at class level
this should avoid the issue of subsequent plays not prompting for a var
prompted for in a previous play.
2015-12-01 08:18:31 -08:00
Toshio Kuratomi
30094912eb boto is expecting that we pass it unicode strings.
The secret_key parameter especially can contain non-ascii characters and
will throw an error if such a string is passed as a byte str.

Potential fix for #13303
2015-12-01 07:03:57 -08:00
Arata Notsu
6d6d4f0c8e BOOLEAN should contain boolean literals
It is natural that an argument_spec with choises=BOOLEAN accepts
boolean literal (True, False) though the current implementation
allows only string or int.
2015-12-01 23:51:39 +09:00
Toshio Kuratomi
ba4e571029 Update submodule refs to go along with the StandardError change in ec2 moudles 2015-11-30 19:05:33 -08:00
Toshio Kuratomi
19d5759771 raise AnsibleAWSError instead of StandardError.
* StandardError doesn't exist in python3
* because it is the root of builtin expections, we can't catch it
  separate from the builtin exceptions
* It doesn't tell us anything about the error being thrown as it's too
  generic
2015-11-30 19:05:33 -08:00
James Cammarata
dc0fae1af7 Also make sure remote_user is defaulted correctly for delegated hosts
Fixes #13323
2015-11-30 16:15:14 -05:00
Toshio Kuratomi
e2ddc2f6ab Call the function :-)
Fixes #13330
2015-11-30 12:34:20 -08:00
James Cammarata
cc36eedf76 Ensure port is (re)set for delegated-to hosts
Fixes #13265
2015-11-30 14:40:23 -05:00
Brian Coca
b5f2c3def2 fixed typo 2015-11-30 09:20:59 -08:00
Brian Coca
eefb4931dd allow for bad stdout return from make temp dir command
fixes #13359
2015-11-30 09:19:16 -08:00
Brian Coca
005b17afec corrected become_methods class variable in winrm
This should now correctly react when using become with winrm
fixes #13331
2015-11-30 08:35:08 -08:00
James Cammarata
80db6bacc4 Make sure run_once tasks properly set variables for all active hosts
Fixes #13267
2015-11-30 11:27:05 -05:00
James Cammarata
fbc9553bd4 Use text_type instead of unicode 2015-11-30 10:33:36 -05:00
James Cammarata
c6a30f7000 Make sure the uuid in vars is string 2015-11-30 10:26:12 -05:00
James Cammarata
f926e81782 Re-implement lookup wantlist
Fixes #13285
2015-11-29 23:45:54 -05:00
James Cammarata
dfa576b037 Merge pull request #13307 from Yannig/devel_fix_big_include_vars
Fix for https://github.com/ansible/ansible/issues/13221
2015-11-29 23:14:03 -05:00
Peter Sprygada
c087160652 initial add of ssh shared module.
This ssh shared module is used for building modules that require an
interactive shell environment such as those required for connecting
to network devices
2015-11-29 21:48:52 -05:00
James Cammarata
6671d78f95 Tweak location of stats callback execution and properly relocate stats output code 2015-11-28 14:03:21 -05:00
James Cammarata
ea23159be4 Merge pull request #13348 from emonty/bug/iterate-on-none
Put in trap for args being None
2015-11-28 13:44:09 -05:00
Monty Taylor
d20e67d708 Put in trap for args being None
_normalize_old_style_args can return None. If it does, the loop
"for args in args" blows up.
2015-11-28 13:38:11 -05:00
James Cammarata
800811a15f Trigger on_stats just once, not once for each play
Fixes #13271
2015-11-28 13:37:43 -05:00
James Cammarata
a7f7f8bd29 Merge pull request #13297 from amenonsen/ssh-escalation
Explicitly accept become_success in awaiting_prompt state
2015-11-28 10:03:00 -05:00
James Cammarata
5b6162a166 Re-adding role_name/role_uuid variables 2015-11-28 09:08:24 -05:00
James Cammarata
8d9835c40b Merge pull request #13342 from Yannig/devel_fix_bomb_shell
Devel fix bomb shell
2015-11-28 09:02:12 -05:00
Yannig Perré
5227c6bb52 Do not copy variable_manager each time. Instead, keep host and local variable_manager sync.
Fix https://github.com/ansible/ansible/issues/13221
2015-11-28 14:58:33 +01:00
Yannig Perré
2fc7c8b460 More restrictive test against variable name to allow setting variable starting with _. 2015-11-28 10:35:06 +01:00
Brian Coca
fa358d9d61 avoids prompting for vars during syntax check
fixes #13319
2015-11-27 11:41:00 -08:00
Yannig Perré
2c54fb1339 Switch parameters validation after parsing in order to be more consistent between old and new style. 2015-11-26 13:33:58 +01:00
Abhijit Menon-Sen
f20e2630b0 Explicitly accept become_success in awaiting_prompt state
If we request escalation with a password, we start in expecting_prompt
state. If the escalation then succeeds without the password, i.e., the
become_success response arrives, we must explicitly move into the next
state (awaiting_escalation, which immediately goes into ready_to_send),
so that we no longer try to apply the timeout.

Otherwise, we would leak the success notification and eventually
timeout. But if the module response did arrive before the timeout
expired, the "process has already exited" test would do the right
thing by accident (which is why it didn't fail more often).

Fixes #13289
2015-11-26 06:06:01 +05:30
Toshio Kuratomi
1b743436b9 Do not double transform to unicode 2015-11-25 07:48:52 -08:00
Chrrrles Paul
157230c3e8 Merge pull request #13257 from chrrrles/utf8
fixing error with using non-ascii values for ask-sudo-password
2015-11-25 11:52:17 +09:00
Charles Paul
1e5a205389 fixing errors with utf-8 values
removing utf-8 stanza

changing cast to binary_type instead

using to_unicode
2015-11-25 11:47:25 +09:00
Brian Coca
71fe49ee3a Merge pull request #13247 from bcoca/fetch_fixes
fixes to fetch action module
2015-11-24 10:55:23 -08:00
Brian Coca
7244b5ae49 added missing : 2015-11-25 10:52:42 -08:00
Brian Coca
0ec60ac09b added missing events to base class 2015-11-25 10:49:03 -08:00
James Cammarata
70de8bc96f Fix ssh state issues by simply assuming it's never connected 2015-11-24 12:00:37 -05:00
James Cammarata
65747285a4 Properly check for prompting state when re-using ssh connection
Fixes #13278
2015-11-24 09:09:54 -05:00
James Cammarata
96fcfe45d0 Merge pull request #13264 from Yannig/devel_debug_var_list_or_dict
Allow debug var parameter to accept a list or dict.
2015-11-23 16:47:45 -05:00
Yannig Perré
5fa49a9ad8 Use to_unicode instead of str() 2015-11-23 22:04:55 +01:00
James Cammarata
679488fdb5 Merge pull request #13239 from sysreq0/devel
We should give pipes.quote() a string every time
2015-11-23 14:27:26 -05:00
James Cammarata
53e86f3130 Merge pull request #13261 from cchurch/with_items_reuse_connection
Modify task executor to reuse connections inside a loop.
2015-11-23 13:57:12 -05:00
James Cammarata
e06b107d2d Template (and include vars) PlaybookInclude paths
Fixes #13249
2015-11-23 11:54:06 -05:00
Chris Church
272778f732 Modify task executor to reuse connection inside a loop. Fix WinRM connection to set _connected properly and display when remote shell is opened/closed. Add integration test using raw + with_items. 2015-11-23 11:53:05 -05:00
Toshio Kuratomi
adf2d53fa2 Update submodule refs 2015-11-23 08:41:19 -08:00
Yannig Perré
0480b44f50 Allow debug var parameter to accept a list or dict. Fix https://github.com/ansible/ansible/issues/13252 2015-11-23 16:58:24 +01:00
Brian Coca
478c6c756a marked spot that should send per item reulsts 2015-11-22 14:44:51 -08:00
Brian Coca
fb96748d7c fixes to fetch action module
* now only runs remote checksum when needed (fixes #12290)
 * unified return points to simplify program flow
2015-11-22 09:52:34 -08:00
Toshio Kuratomi
2631a8e6e4 Update extras to fix docs build 2015-11-20 14:14:12 -08:00
Toshio Kuratomi
8fd15ae2a3 Merge pull request #13217 from ansible/more-strict-plugin-lookup
Fix non-module plugins picking up files that did not end in .py.
2015-11-20 13:50:45 -08:00
Toshio Kuratomi
77c83fd520 Commit submodule refs to the devel HEAD 2015-11-20 12:46:22 -08:00
Toshio Kuratomi
664c7980a2 Update submodule refs 2015-11-20 12:42:44 -08:00
Sebastien Couture
087dbc1ed5 We should give pipes.quote() a string every time 2015-11-20 12:58:50 -05:00
Toshio Kuratomi
591c81e95f Docker cp sets file ownership to root:root so we can't use it.
Fixes #13219
2015-11-20 07:45:00 -08:00
Toshio Kuratomi
d75e707af5 Simplify code a little 2015-11-19 09:55:06 -08:00
Toshio Kuratomi
72558f7ecd Merge pull request #13074 from joernheissler/patch-13073
Use ansible_host in synchronize module
2015-11-19 09:51:43 -08:00
Toshio Kuratomi
c86120cea6 Fix non-module plugins picking up files that did not end in .py.
This was caused by accessing the cache using the passed in mod_type
rather than the suffix that we calculate with knowledge of whether this
is a module or non-module plugin.
2015-11-19 09:39:37 -08:00
James Cammarata
c97c101bd3 Merge pull request #13209 from nitzmahone/winrm_put_file
fast winrm put_file without size restrictions
2015-11-19 09:58:06 -05:00
James Cammarata
8a0d2e0ef2 Submodule pointer update 2015-11-19 09:08:49 -05:00
James Cammarata
91500f8f5f Fix include param precedence in variable manager 2015-11-19 09:01:51 -05:00
James Cammarata
78e4f176e6 Return skipped/failed async results directly
Fixes #13205
2015-11-19 08:30:00 -05:00
James Cammarata
3b16ad973c Merge pull request #13201 from ma82/patch-1
Fix DataLoader's docstring
2015-11-19 08:13:02 -05:00
Marius Gedminas
66347c9449 Fix NameError when using loops
vars_copy disappeared in 3d1255d190.

Fixes #13213.
2015-11-19 09:21:06 +02:00
nitzmahone
db83c0e7cd winrm error handling tweaks 2015-11-18 23:09:16 -08:00
James Cammarata
3d1255d190 Don't update job vars too early when getting loop items in TaskExecutor
Fixes #13113
2015-11-18 19:12:38 -05:00
Brian Coca
f8ed99e5e4 Revert "success should not include skipped"
This reverts commit 300ee227a2.
2015-11-19 11:12:18 -08:00
nitzmahone
549163170f fast winrm put_file without size restrictions 2015-11-18 10:33:45 -08:00
Mick Bass
9761250a4b Allow tree-ish to be used for galaxy role version
Ensure that ansible-galaxy version can be a branch, a tag, or any tree-ish
supported by git including specific commit IDs.  For git scm roles, adds an
explicit git checkout of the specified role_version prior to the git archive.
This means that we'll always archive from HEAD of whatever role_version is
checked out. role_version can be a branch, a tag, or any <tree-ish> supported
by git including specific commit IDs.  These changes also ensure
ansible-galaxy works for scm clones when specified version differs from
repository default branch.
2015-11-18 20:47:15 +10:00
Matteo Acerbi
0127d32652 Fix DataLoader's docstring
DataLoader.__init__ doesn't take an argument named vault_password
2015-11-18 11:20:34 +01:00
James Cammarata
9b9fb51d9d Template the final_environment value in _compute_environment_string()
Fixes #13123
2015-11-17 15:39:03 -05:00
Toshio Kuratomi
782aa9a7fd Update submodule refs 2015-11-17 12:09:46 -08:00
James Cammarata
180159b01d Adding vars back in and trying to add a little more speed by avoiding copies 2015-11-17 14:44:46 -05:00
James Cammarata
25807f5404 Don't modify things we've put on the queue
Fixes #12937
2015-11-17 14:22:52 -05:00
Brian Coca
d35f615af8 added more debug info for command results 2015-11-18 11:18:03 -08:00
Brian Coca
aa55db69fe Merge pull request #12687 from nitzmahone/pywinrm_arg_passthru
Force SSL transport for pywinrm updates, get host+group vars
2015-11-17 11:14:19 -08:00
James Cammarata
f10d2c57c8 Restoring templating of hostvars returned by __getitem__ 2015-11-17 10:19:56 -05:00
James Cammarata
9f31c073fe Fixing a few bugs in the HostVars performance areas
* Also refresh inventory in the HostVars manager process when things
  are changed via add_host/group_by
* Raise j2undefined rather than return it
2015-11-17 09:15:10 -05:00
James Cammarata
984729016e Fix tag filtering on included files and add more debugging
Previously, we were filtering the task list on tags for each host
that was including the file, based on the idea that the variables
had to include the host information. However, the top level task
filtering is play-context only, which should also apply to the
included tasks. Tags cannot and should not be based on hostvars.
2015-11-16 17:15:52 -05:00
James Cammarata
5cbeab5a3c Performance improvements for HostVars and some bugfixes 2015-11-16 17:15:52 -05:00
Dann Bohn
7f2cae5405 add REPLACER_SELINUX back into module_common 2015-11-16 16:35:55 -05:00
Brian Coca
355fa4797a Merge pull request #13186 from nitzmahone/add_host_cache_fix
fix for dynamic (add_host) hosts not available in hostvars
2015-11-16 12:01:00 -08:00
Brian Coca
6a2559be02 Merge pull request #13184 from nitzmahone/hostvars_undefined_fix
hostvars should return j2 undefined as instance, not type
2015-11-16 11:59:20 -08:00
Toshio Kuratomi
fc7e2912f2 zone connection plugin bugfixes and pipelining and sudo become methods enabled!
Thanks to peinheber for helping test and debug this!
2015-11-16 11:14:13 -08:00
nitzmahone
349e072a74 fix for dynamic (add_host) hosts not available in hostvars
Looks like there are two pattern caches that need to be cleared for this to work- added the second one.
Added integration tests for add_host to prevent future regressions.
2015-11-16 10:53:10 -08:00
nitzmahone
3bb1f7a561 hostvars should return j2 undefined as instance, not type
Looks like someone forgot to create an instance of undefined here- we were returning the undefined type object, which broke all the undefined checks.

Added an integration test around add_host that will catch this (separate PR to follow)
2015-11-16 09:58:23 -08:00
Brian Coca
db27541a0e Merge pull request #13053 from Etherdaemon/fix_13010_boto3_aws_profile
Fixes #13010 by updating boto3 methods
2015-11-16 09:46:26 -08:00
Brian Coca
89646d4253 no need to be executable 2015-11-16 14:40:35 -08:00
Jonathan Davila
1b76a9cef2 Patch to remove dependency on boto when only using boto3
Updated with explicit check for HAS_BOTO3
2015-11-16 09:21:26 -05:00
Brian Coca
2083a2dffa Merge pull request #13174 from sebi-hgdata/sebi/consul_kv_issue
Consul kv lookup super invocation fix
2015-11-15 14:37:51 -08:00
Brian Coca
83f7942dcf removed print entries, corrected display calls to match latest devel 2015-11-16 11:35:10 -08:00
Brian Coca
78be81b96d Merge pull request #12510 from jcftang/devel
Initial add of logentries callback plugin
2015-11-15 11:28:02 -08:00
Brian Coca
f1db99caa7 updated with latest changes to default 2015-11-15 10:09:24 -08:00
Brian Coca
eeedaf2cbc fixed var name typo 2015-11-15 08:43:42 -08:00
Brian Coca
e174247734 evaluate includes for skipped tags
cannot evaluate for include tags as underlying tasks might have them, but skips override so this should be a performance boost
2015-11-15 07:51:36 -08:00
Sebi Calbaza
1f052d5ce6 fixed super invocation 2015-11-15 13:48:40 +02:00
Brian Coca
300ee227a2 success should not include skipped
fixes #13161
2015-11-14 14:39:42 -08:00
Jimmy Tang
19ba54c9fd Don't be fatal on import errors so plays don't fail if plugin doesn't have required dependencies 2015-11-14 20:02:03 +00:00
Jimmy Tang
125370ab48 Run when whitelisted 2015-11-14 19:46:00 +00:00
Jimmy Tang
5f2f5e2b59 Add boilerplate and fix initialisation to match what 2.0 expects 2015-11-14 08:54:41 +00:00
Jimmy Tang
c02ceb8f12 Remove threading and queues. Added license information and cleaned up callback. 2015-11-14 08:40:16 +00:00
Jimmy Tang
85277c8aae Initial add of logentries callback plugin
This callback plugin will generate json objects to be sent to the
logentries service for auditing/debugging purposes.

To use:

Add this to your ansible.cfg file in the defaults block

    [defaults]
    callback_plugins = ./callback_plugins
    callback_stdout = logentries
    callback_whitelist = logentries

Copy the callback plugin into the callback_plugings directory

Either set the environment variables

    export LOGENTRIES_API=data.logentries.com
    export LOGENTRIES_PORT=10000
    export LOGENTRIES_ANSIBLE_TOKEN=dd21fc88-f00a-43ff-b977-e3a4233c53af

Or create a logentries.ini config file that sites next to the plugin with the following contents

    [logentries]
    api = data.logentries.com
    port = 10000
    tls_port = 20000
    use_tls = no
    token = dd21fc88-f00a-43ff-b977-e3a4233c53af
2015-11-14 08:40:16 +00:00
James Cammarata
07b588f6c0 Version bump for new beta 2.0.0-0.5.beta3 2015-11-13 16:48:25 -05:00
James Cammarata
2b25b7974c Remove unnecessary sleep from result process 2015-11-13 16:45:45 -05:00
Brian Coca
634e10e5b8 Merge pull request #13156 from amenonsen/broken-timeout
If ssh died, it's an error, not a timeout
2015-11-13 10:45:21 -08:00
Abhijit Menon-Sen
26ea9c4351 If ssh died, it's an error, not a timeout 2015-11-13 20:10:08 +05:30
David M. Lee
5bd096208c Increase the escalation prompt timeout
It was set to match the SSH connect timeout. Unfortunately, they would
race when ssh fails to connect, and the connect timeout usually failed.
This led to some misleading error messages.

Fixes #12916
2015-11-13 08:02:37 -06:00
James Cammarata
31b1abf580 Merge pull request #13146 from nitzmahone/gce_error_messaging
fix gce module error reporting
2015-11-13 08:46:51 -05:00
nitzmahone
4163655099 fix gce module error reporting
Error reporting was broken for GCE modules- pprint didn't work with exceptions, so you'd always get "Unexpected response: {}" instead of the real error.
2015-11-12 16:30:46 -08:00
Toshio Kuratomi
958fb29b78 Merge pull request #12881 from Scypho/devel
fix for issue #11885 - allowing json in lookup template calls
2015-11-12 15:39:35 -08:00
James Cammarata
13750f68ee Reduce spinning while waiting on queues 2015-11-12 14:41:09 -05:00
Daniel Menet
0918416b83 substitute tilde and env vars before storing C.CACHE_PLUGIN_CONNECTION as instance attribute 2015-11-12 16:52:02 +01:00
Toshio Kuratomi
7fd8b86a10 Fix documentation build problems 2015-11-11 12:39:06 -08:00
Toshio Kuratomi
d38ac6a394 Update submodule ref for another new module 2015-11-11 12:33:32 -08:00
Toshio Kuratomi
7807e99bca A bunch of shipit's merged 2015-11-11 12:19:34 -08:00
Toshio Kuratomi
8aa2cbd647 Fix traceback because we're using display from another object that no
longer has it.
2015-11-11 12:19:00 -08:00
James Cammarata
b2b0fa8d13 Changed do/until failed color
Fixes #13130
2015-11-11 14:43:15 -05:00
James Cammarata
94c20c9ac6 Cleanup failed/changed logic in TaskExecutor
Fixes #12980
2015-11-11 14:23:37 -05:00
Toshio Kuratomi
62979efa14 Finish up plugin porting to global display
Also remove display = display which does nothing
2015-11-11 10:44:23 -08:00
Toshio Kuratomi
2bd695ed42 Port cache plugins to global display 2015-11-11 10:44:22 -08:00
Toshio Kuratomi
b05d0b8c9c Port lookup plugins to global display. 2015-11-11 10:44:22 -08:00
Toshio Kuratomi
4c7128da17 Port action plugins to global display 2015-11-11 10:44:22 -08:00
Toshio Kuratomi
186e034515 Move the rest of executor code to global display 2015-11-11 10:44:22 -08:00
Toshio Kuratomi
7ecfa072da Move the rest of the playbook code to use global display 2015-11-11 10:44:22 -08:00
Toshio Kuratomi
aa4f213cb5 Move connection plugins to using global display 2015-11-11 10:44:22 -08:00
Toshio Kuratomi
318bfbb207 Migrate cli and dependencies to use global display 2015-11-11 10:44:22 -08:00
Brian Coca
1b7d3f2898 updated submodule refs 2015-11-12 09:41:51 -08:00
Brian Coca
99f45f2e19 pass task args without filtering, copy module needs to explcitly support
remote_src or it will remove the src file
2015-11-12 09:40:43 -08:00
Toshio Kuratomi
c7b69127ec Remove dead code 2015-11-11 08:12:21 -08:00
Toshio Kuratomi
e45ce871a7 Fix for traceback when neither name nor pkg are in the module params 2015-11-11 07:32:21 -08:00
Toshio Kuratomi
4737305837 Remove dead code as this was moved to another class 2015-11-10 12:18:20 -08:00
Brian Coca
be22a670e5 addes deprecated information to ansible-doc display
fixes #13118
2015-11-11 11:15:22 -08:00
Brian Coca
1b349fdf34 Merge pull request #13112 from privateip/eapi
add initial support for Arista eAPI
2015-11-10 10:31:26 -08:00
James Cammarata
566144461f Remove internal use of display and use the top-level import 2015-11-10 12:02:29 -05:00
James Cammarata
0fc187893d Catch import warnings in a common location for both get() and all()
Potential solution for #12979
2015-11-10 11:25:07 -05:00
James Cammarata
9f0c2cfda5 Merge pull request #13114 from mgedmin/fix-plugin-loader
Check sys.modules before loading modules
2015-11-10 11:04:35 -05:00
Marius Gedminas
54eae4a793 Check sys.modules before loading modules
Code for a plugin is usually loaded by a PluginLoader(), and henceforth
available from self._module_cache, which prevents duplicate loading.
However there are situations (e.g. where one action plugin imports code
from another one) where the plugin module might be already imported (and
resident in sys.modules), but not present in the PluginLoader's
_module_cache, which causes imp.load_source() to effectively reload the
module, overwriting global class declarations and causing subtle latent
bugs.

Fixes #13110.
Fixes #12979.
2015-11-10 17:57:43 +02:00
James Cammarata
a99f2fd52f Save delegated vars in result for use in callback methods
Fixes #13014
2015-11-10 10:14:30 -05:00
Peter Sprygada
2e98f7f429 add initial support for Arista eAPI
This commit adds the shared module support for Arisat EOS devices
running eAPI.  The shared module builds on top of module_utils/urls.py.
2015-11-10 07:59:59 -06:00
James Cammarata
e56fd9e95d Make sure pattern cache components are converted to unicode 2015-11-10 08:28:45 -05:00
James Cammarata
0b999c602a Properly figure subset and restrictions into host cache pattern
Fixes #13111
2015-11-10 08:23:51 -05:00
James Cammarata
d8fb5efa90 Merge pull request #13102 from Yannig/devel_cache_enhancement
New method template_no_cache for template object.
2015-11-10 02:23:42 -05:00
Yannig Perré
0c360d17cb New parameter for template method.
We do not compute hash when we know that the result does not need to be cached (like with_items loop).
It also result in a small speed improvement.
2015-11-10 07:19:19 +01:00
Etherdaemon
27398131cf Fixes #13010 by updating boto3 methods to update boto3_conn to check for profile_name and if detected, remove from params and set a new variable of profile which is passed into Session separately 2015-11-10 15:22:07 +10:00
James Cammarata
09994c18f3 Correct logic around determining environment variable existence
Fixes #13105
2015-11-09 21:04:24 -05:00
James Cammarata
c753ae6e22 Fixing up host pattern caching to avoid bugs
* Always cache and return unique list objects, so that if the list
  is changed later it does not impact the cached results
* Take additional parameters and the type of the pattern into account
  when building the hash string
2015-11-09 20:55:13 -05:00
James Cammarata
e8f83dcba3 Revert "Temporarily disable template caching"
This reverts commit 4d1757ce64.
2015-11-09 20:41:59 -05:00
James Cammarata
4d1757ce64 Temporarily disable template caching 2015-11-09 17:09:13 -05:00
Toshio Kuratomi
995db275f8 Update submodule refs 2015-11-09 13:48:34 -08:00
Toshio Kuratomi
db5d3f03a9 Fix first_found not finding files in roles (only templates) 2015-11-09 13:47:17 -08:00
James Cammarata
ccbcfcddfc Move where we add environment and make it conditional on not existing
Also displays a warning now, because users should not be using that variable
name as it causes a collision with the internal variable of the same name.
2015-11-09 16:28:54 -05:00
Brian Coca
37ae243587 made get_file_lines rely on get_file_content which deals with many error
conditions that the former did not.
2015-11-10 13:22:45 -08:00
ghislainbourgeois
eb850d7e5b Fix get_dns_facts on inexistent resolv.conf 2015-11-09 15:02:03 -05:00
James Cammarata
e36b4e2a13 Merge pull request #13072 from Yannig/devel_cache_optimization
Cache optimization
2015-11-09 14:54:06 -05:00
James Cammarata
76ae577519 Ensure environment is inherited properly (task->block/include->play) 2015-11-09 14:51:07 -05:00
James Cammarata
937584cd52 Ensure 'environment' is set in the magic variables
Fixes #13033
2015-11-09 14:50:39 -05:00
James Cammarata
7e04947599 Be more selective about what variables we cache during templating
Fixes #13087
2015-11-09 14:07:48 -05:00
Toshio Kuratomi
1a04f354f3 For with_first_found loops, set undefined variables to fall through rather than failing the task 2015-11-09 10:51:54 -08:00
Brian Coca
240acb1924 Merge pull request #13092 from privateip/nxapi
initial shared module support for nxapi
2015-11-09 08:43:30 -08:00
Peter Sprygada
f88273eb87 changes the nxapi argument spec to require url_password 2015-11-09 09:45:26 -05:00
Peter Sprygada
d3d36eb766 fixes conditional statement for py24 compatibility 2015-11-09 09:36:17 -05:00
Peter Sprygada
64e139adb1 add initial support for Cisco NXAPI
This commit adds the shared module support for Cisco NXAPI.  The shared
module builds on top of the urls shared module.  The urls module provides
the http/s transport.  This module only supports the JSON request message
format.
2015-11-09 09:18:38 -05:00
Rene Moser
1d59caed07 cloudstack: change order of tags handling, fixes update of tag value does not work 2015-11-08 20:27:01 +01:00
Rene Moser
3410a855b0 cloudstack: use jop polling in tag handling, fixes outdated tags returned.
In some cases the async job did not finish fast enough, causing returning an unexpeded result.
2015-11-08 20:23:06 +01:00
Joern Heissler
647b92a79b Use ansible_host in synchronize module
Fixes #13073
2015-11-08 13:15:16 +01:00
Yannig Perré
12a6fb9633 Small speed improvement with huge inventory (100+ hosts). 2015-11-07 19:32:10 +01:00
James Cammarata
dd4ca66e1e Make sure hostvars cache is recreated during serialization 2015-11-06 22:21:50 -05:00
James Cammarata
5040abaaf2 Merge branch 'devel_cache_for_do_template_call' of https://github.com/Yannig/ansible into Yannig-devel_cache_for_do_template_call 2015-11-06 22:04:52 -05:00
Brian Coca
9a25e16140 set corrected force default 2015-11-06 19:06:58 -05:00
Toshio Kuratomi
47f187b221 Update submodule refs 2015-11-06 10:30:42 -08:00
James Cammarata
59b67a2f68 Reset workers list when recreating processes
Also renames some things to be more accurate
2015-11-06 12:10:15 -05:00
Brian Coca
5b84bd6b5d Merge pull request #13056 from alxgu/sles_sap_family
Add SLES_SAP as a Suse family
2015-11-06 08:58:31 -05:00
Brian Coca
226c7f4c7b Revert "added setting of ansible_ssh_user to current user as backwards compatibilty issue"
scope was wrong, this var should not be 'reset' here.

This reverts commit c271c0eb04.
2015-11-06 08:31:56 -05:00
Brian Coca
9c24f88eca updated forks comment 2015-11-06 08:31:56 -05:00
Rene Moser
768f2fe6d4 template: fix regression bug in template in case force=false
Fixes regression bug, previously reported in #12844 fixed with
4b20884719 re-introduced with
c64ac90560
2015-11-06 11:24:39 +01:00
Alexander Gubin
215fc12234 Add SLES_SAP as a Suse family 2015-11-06 09:42:39 +01:00
Brian Coca
5c7d717f31 made ansibledoc more consistent with term sizes, it now uses display class column calculations
cleared up snippet display
2015-11-05 17:42:14 -05:00
James Cammarata
1027abd596 Cleaning up bugs related to perf improvement changes 2015-11-05 16:42:12 -05:00
James Cammarata
f10022dbd2 Fix use of add_tqm_variables 2015-11-05 16:30:03 -05:00
James Cammarata
efbc6054a4 Add variable compression option 2015-11-05 16:22:37 -05:00
James Cammarata
63c47fb271 Fixing up performance 2015-11-05 16:22:37 -05:00
Brian Coca
c64ac90560 fixed check mode change response in template
fixes #13049
2015-11-05 15:55:19 -05:00
Brian Coca
483c25a609 Revert "switched host patterns to use sets, simplified logic which now uses buitins"
need this to be lists, for order and other considerations
This reverts commit 8e2f0b3f2c.
2015-11-05 15:41:17 -05:00
Brian Coca
88ba46aee0 Revert "fixed append to add"
good change on top of bad
This reverts commit 699f344e17.
2015-11-05 15:40:52 -05:00
Brian Coca
699f344e17 fixed append to add 2015-11-05 15:24:20 -05:00
Brian Coca
8e2f0b3f2c switched host patterns to use sets, simplified logic which now uses buitins 2015-11-05 15:02:06 -05:00
Brian Coca
883f451158 fixed snippet display, short_desc is a string, not a list 2015-11-05 14:32:18 -05:00
Brian Coca
95604573ee improved the message when there is no module path override 2015-11-05 14:32:18 -05:00
Brian Coca
f4912dd88a added callback fallback to v1 methods for backwards compat with existing callbacks 2015-11-05 13:04:50 -05:00
Brian Coca
e2c56efca6 Merge pull request #12867 from bcoca/callback_whitelist_tweak
make callbacks declare needing whitelisting
2015-11-05 12:58:05 -05:00
Toshio Kuratomi
4f6d4c6bf6 Set task_action when the action does not need to be templated
Fixes #13042
2015-11-05 08:38:21 -08:00
Brian Coca
9753de35a7 Merge pull request #13038 from bcoca/min_forks_to_play
use minimal number of forks
2015-11-05 11:22:15 -05:00
Toshio Kuratomi
586cbb9fda Update core submodule ref 2015-11-04 19:44:42 -08:00
Toshio Kuratomi
483491ddfb template the task_action before checking whether to optimize with_item loops for it.
Fixes the second problem discovered in #12976
2015-11-04 19:41:55 -08:00
Toshio Kuratomi
9e758d3d97 Do not optimize with_items loop if the items are not strings
The code isn't sophisticated enough to understand lists and dicts yet.
This mirrors how 1.9.x handled non-string items so its not a regression.

One portion of a fix for #12976
2015-11-04 18:48:41 -08:00
Brian Coca
931eb16e55 clearer selection of min value
cleanup workers at each run to avoid stragglers
2015-11-04 17:28:08 -05:00
Yannig Perre
ccbdd6229a Use static vars when computing host vars known to be static (inventory_hostname, inventory_dir etc.). 2015-11-04 22:16:14 +01:00
Yannig Perre
e0aa3ff232 Cache against hosts pattern (fix a part of problem describe in https://github.com/ansible/ansible/issues/13023). 2015-11-04 22:15:02 +01:00
Brian Coca
b44f1428d0 use minimal number of forks taking serial, forks and play patterns into account 2015-11-04 15:16:20 -05:00
Brian Coca
3c35655b52 removed serial as it is not avialable for fork control
fixes #13037
2015-11-04 14:04:47 -05:00
Brian Coca
0abeff4511 better limiting of forks to lowest actual restriction 2015-11-04 12:47:10 -05:00
nitzmahone
113c4350e3 Force SSL transport for pywinrm updates, get host+group vars
I PR'd a change to pywinrm to allow server certs to be ignored; but it's only on the SSL transport (which we were previously ignoring). For this to work more generally, we're also now pulling the named ansible_winrm_* args from the merged set of host/group vars, not just host_vars.
2015-11-04 09:31:43 -08:00
Lars Larsson
3289670a04 treat forks config parameter as max value instead of always creating that number of workers 2015-11-04 17:13:26 +01:00
Will Thames
91b6004149 Allow blank lines and comments/spaces in galaxy spec files
Fixes #10641 again. (Regression)
Added test to discourage future such regression.
2015-11-04 15:36:20 +10:00
Toshio Kuratomi
07d0d2720c Update submodule refs 2015-11-03 14:13:16 -08:00
Toshio Kuratomi
9ce3adbeb1 remove assigned but unused variables in module_utils.
These were mostly saving exceptions but not using them.  Getting rid of
those will help with eventually running modules via either python2.4 or
python3.x.
2015-11-03 09:53:18 -08:00
Toshio Kuratomi
c08648999d Remove some more unused stdlib deps. 2015-11-03 09:53:18 -08:00
Toshio Kuratomi
658ea053ea Cleanup timer callback plugin's overwriting of modules it imported 2015-11-03 09:53:18 -08:00
Eric Johnson
dfad7c64fb Allow PATCH to list of valid HTTP methods 2015-11-03 17:38:52 +00:00
Brian Coca
8d3da20302 fixed bsd service_mgr_facts using removed check_init fucntion 2015-11-03 11:43:50 -05:00
Yannig Perré
30f827d92d Fix python3 test. 2015-11-03 11:52:09 +01:00
Abhijit Menon-Sen
7caefa5cd9 Fix typo 2015-11-03 10:57:48 +05:30
Toshio Kuratomi
a7d1a39b81 Update core submodule ref 2015-11-02 17:38:28 -08:00
Toshio Kuratomi
2df0022a3e Update submodule refs 2015-11-02 17:12:16 -08:00
Brian Coca
eb04650ffb Merge pull request #12162 from bcoca/service_mgr_facts
fact gathering service_mgr info
2015-11-02 15:34:43 -05:00
Brian Coca
a1a5dadef6 remove uneeded module 2015-11-02 15:36:11 -05:00
Yannig Perré
130139dc80 Fix unicode issue introduced by previous commit. 2015-11-02 21:32:49 +01:00
Toshio Kuratomi
3219744d32 One more stdlib import in module_utils 2015-11-02 12:25:18 -08:00
Brian Coca
d194e2c788 check_systemd is not inline but a private fact function now 2015-11-02 15:23:47 -05:00
Brian Coca
e9efd008ed moved distutils import to mac, darn solaris would complain in certain cases 2015-11-02 15:23:47 -05:00
Brian Coca
99d775a0c1 fact gathering service_mgr info
also added dragonfly facts support
2015-11-02 15:23:47 -05:00
Yannig Perré
4a8d1703d4 New patch against hostvars.py. With this patch, Ansible run lose 50% of time.
Little rewrite of previous patch to use sha1 signature.
Use fail_on_undefined to compute sha1 signature.
2015-11-02 21:04:20 +01:00
Toshio Kuratomi
1bc75374dc Add imports for stdlib modules that are used.
This is cleanup that will aid us when we get ziploader implemented for 2.1
2015-11-02 12:02:26 -08:00
Toshio Kuratomi
107d025d8a Update extras submodule ref for doc fixes 2015-11-02 11:39:57 -08:00
Toshio Kuratomi
99561e88d4 Update submodule refs 2015-11-02 10:56:39 -08:00
Brian Coca
79bf66336b switched clean_data from hardcoded delimiters to actual currently set jinja2 environment delimiters 2015-11-02 09:00:56 -05:00
Yannig Perré
805f768dab Clear cache when updating template variables. 2015-11-02 07:57:44 +01:00
Brian Coca
467c29e3db show task path on 2 vs 2015-11-01 17:43:11 -05:00
Yannig Perré
87a9485b2f Cache for _do_template call. May result in nice speed improvement (4-5 times faster). 2015-11-01 22:30:55 +01:00
Rene Moser
c09a34bb10 cloudstack: clean up unneeded ";" 2015-11-01 17:13:46 +01:00
Brian Coca
f528ad1848 added xbps pkg mgr to facts 2015-10-31 22:03:12 -04:00
Brian Coca
13bf62d0e6 remove deprecation for :, add ; functionality (its deprecated but it should work) 2015-10-31 16:35:40 -04:00
Brian Coca
d341ba14a5 fixed rekey password handling 2015-10-31 14:13:03 -04:00
Brian Coca
00bc74404a vault noe preserves permissions on edit and rekey and sets a restricitve default umask for all other cases 2015-10-31 14:13:03 -04:00
Brian Coca
7368030651 removed action plugin as service facts and separate modules don't work yet and this forces gathering facts 2015-10-30 17:56:05 -04:00
Brian Coca
f5b095f6c8 properly sanitize registered vars 2015-10-30 16:42:06 -04:00
Brian Coca
b6c92dacb5 removed key striping as they are read up the chain 2015-10-30 14:03:37 -04:00
Brian Coca
57d3245d0d remove commented out prints 2015-10-30 14:02:41 -04:00
Brian Coca
7ba4f5ee12 removed no_log redundant code 2015-10-30 14:01:47 -04:00
Brian Coca
b97887ba41 simplified invocation removal, added no_log awareness 2015-10-30 10:17:19 -04:00
James Cammarata
c61499168e Merge pull request #12962 from bcoca/pull_fixes
fixes options for ansible pull
2015-10-30 09:46:09 -04:00
James Cammarata
56e5e72aaa Make handlers obey run_once (or BYPASS_HOST_LOOP)
Fixes #12972
2015-10-30 09:44:35 -04:00
James Cammarata
a5bd92ca4b Merge branch 'devel_fix_debug_var' of https://github.com/Yannig/ansible into Yannig-devel_fix_debug_var 2015-10-30 08:37:03 -04:00
Brian Coca
237f8c9df7 removed debug print 2015-10-29 20:34:55 -04:00
James Cammarata
479cbfc63c Don't immediately fail on PlayContext setup
As we may end up skipping the task due to conditionals.

Fixes #12774
2015-10-29 19:23:42 -04:00
Brian Coca
9f148fc046 removed requirement of destination and set documented default 2015-10-29 16:28:46 -04:00
Brian Coca
40d22be2ef fixes options for ansible pull
* remove requirement for host patterns, use the defaults
 * require destination directory (None in cwd is not a good default)
 * fixed usage messages
 * updated default inventory to use , and not deprecated :
2015-10-29 16:28:46 -04:00
Brian Coca
b73941b95f updated submodule refs 2015-10-29 16:06:33 -04:00
Toshio Kuratomi
508bffef02 Update extras submodule ref 2015-10-29 10:20:55 -07:00
Brian Coca
b8bc15fe02 switched to backticks to allow for non bourne shells to work 2015-10-29 12:45:53 -04:00
Yannig Perré
1febf7cb88 Fix for issue #12952: this code interfere with debug+var and seems to be unnecessary. 2015-10-28 22:09:13 +01:00
James Cammarata
5d92b00d9c Cleanup some include logic
* Properly mark hosts with failures in includes as failed
* Don't send callbacks until we're sure we're done, and also fix how
  we increment stats so failures don't show up as ok's
* Fix a bug in the include file logic where a failed include could lead
  to an infinite loop in the task iteration logic

Fixes #12933
2015-10-28 14:02:24 -04:00
Toshio Kuratomi
56b310b18d Update submodule refs 2015-10-28 09:04:52 -07:00
James Cammarata
299054852a Allow tags to be specified in included file params
Fixes #12940
2015-10-28 10:14:20 -04:00
Brian Coca
b2fc5142eb moved sudo -S and -n into configurable flags as they might be absent in much older systems
if password is supplied exsiting -n would get remove from flags
2015-10-28 02:06:25 -04:00
Toshio Kuratomi
e3e2db1119 Improve the warning message about duplicate yaml dict keys 2015-10-27 14:20:36 -07:00
James Cammarata
87269599a0 Also consider the full role name when searching for --start-at-task 2015-10-27 16:31:23 -04:00
Toshio Kuratomi
acbea65b1d Update core submodule ref to fix doc build 2015-10-27 12:52:41 -07:00
Toshio Kuratomi
2c5da0923a Update submodule refs 2015-10-27 12:50:24 -07:00
Toshio Kuratomi
7334389de6 Merge pull request #12930 from ansible/dict-key-overwrite-warning
Break apart a looped dependency to show a warning when parsing playbooks
2015-10-27 12:44:01 -07:00
Toshio Kuratomi
4203850d1a Break apart a looped dependency to show a warning when parsing playbooks
Display a warning when a dict key is overwritten by pyyaml
Fixes #12888
2015-10-27 12:39:42 -07:00
James Cammarata
3fc2209ca0 Fixing retry/until logic and default value for retries
Fixes #12928
Fixes #12929
2015-10-27 15:37:48 -04:00
James Cammarata
57fe0d6aed Merge pull request #12911 from bcoca/manpage_fixes
Manpage fixes
2015-10-27 14:48:38 -04:00
James Cammarata
1dc23ea779 Merge pull request #12866 from bcoca/more_inheritence
More inheritence
2015-10-27 14:46:42 -04:00
James Cammarata
cace91df56 Allow hostvars cache to be invalidated so hostvars contain all hosts after add_host
Fixes #12925
2015-10-27 14:12:17 -04:00
James Cammarata
2825c188bd Merge pull request #12901 from bcoca/sanitize_results
sanatize results
2015-10-27 08:42:34 -04:00
Jason O'Donnell
9dfa3719be Fixing typo 2015-10-26 17:13:49 -04:00
Jason O'Donnell
ac9b35cc2b Found another typo 2015-10-26 17:04:28 -04:00
Jason O'Donnell
80433c2a2d Fxing typo 2015-10-26 17:01:30 -04:00
Toshio Kuratomi
de54f26376 Update submodule refs 2015-10-26 13:13:11 -07:00
Brian Coca
c271c0eb04 added setting of ansible_ssh_user to current user as backwards compatibilty issue 2015-10-26 16:10:13 -04:00
Brian Coca
4486e136ea Merge pull request #12899 from bcoca/vault_fixes
simplified vault password functions
2015-10-26 14:14:17 -04:00
Brian Coca
5b33b0ddfd Merge pull request #12896 from bcoca/ssh_current_user_config
don't set user to current user
2015-10-26 13:26:43 -04:00
James Cammarata
677a2f95e5 Make sure Base attributes are copied cleanly
Fixes #12882
2015-10-26 12:09:58 -04:00
Toshio Kuratomi
8f77dd1cf2 Update submodule refs 2015-10-26 08:37:37 -07:00
Brian Coca
f3a0adcfa5 added info about using -i 'hostname,' to usage/help 2015-10-26 11:03:15 -04:00
Bernhard Lichtinger
00ccd2ee6e Fix for SLES 11.4, which has now also an /etc/os-release file. 2015-10-26 14:22:21 +01:00
Brian Coca
7ebfe72015 added missing string_types 2015-10-24 15:49:30 -04:00
Brian Coca
8ce864db6f sanatize results 2015-10-24 15:23:12 -04:00
Brian Coca
368f4448dc simplified vault password functions
also fixes #12864
2015-10-24 15:06:43 -04:00
Toshio Kuratomi
92dd563a75 Fix invocation from bad merge and note where it would need to go to keep
it out of registered vars as well.
2015-10-24 07:29:42 -07:00
Brian Coca
f78c82b9ee don't set user to current user
also remove condition to bypass setting user if user matches current user
this enables forcing user when set to the same user as current user and ignoring .ssh/config
while keeping .ssh/config with current user if nothing is specified.
2015-10-23 23:15:45 -04:00
Brian Coca
25e3fe04a8 finalized changed to use abridtged_result instead of result
removed no longer defined no_log
2015-10-23 23:10:57 -04:00
Toshio Kuratomi
b109b83809 Update submodule refs 2015-10-23 14:34:40 -07:00
Toshio Kuratomi
ca32d5bacc Potential fix for #12816 2015-10-23 13:38:44 -07:00
James Cammarata
3eea4e23d5 Manually add plugin directories when running the adhoc command
Fixes #12891
2015-10-23 16:33:51 -04:00
Toshio Kuratomi
3812ec8d1d Implement invocation hiding for all callbacks if the verbosity is low 2015-10-23 11:11:34 -07:00
Brian Coca
275764d4a5 avoid showing invokation when no_log is set or verbosity is low 2015-10-23 14:06:20 -04:00
James Cammarata
63ea614b4c Version bump for 2.0.0-0.4.beta2 2015-10-23 13:34:30 -04:00
Toshio Kuratomi
99c6f77e59 Fix callback 2015-10-23 09:15:22 -07:00
Jens Peter Schroer
ecae636160 allowing json in lookup template calls 2015-10-23 14:21:46 +02:00
James Cammarata
4fd4f3374a Merge pull request #12879 from larsks/bug/12876
allow include: directive to work during exception processing
2015-10-22 22:15:32 -04:00
Lars Kellogg-Stedman
914f68f9af allow include: directive to work during exception processing
prior to this commit, an attempt to use the `include:` directive would
fail in a `rescue:` or `always:` block if there were failures in the
main block task list.

Resolves #12876.
2015-10-22 22:12:20 -04:00
Toshio Kuratomi
ce2b18174e Merge pull request #12878 from ansible/invocation-fix
Invocation fix
2015-10-22 16:17:40 -07:00
Toshio Kuratomi
2e87c1f74e Two fixes to action plugins
* Fix the task_vars parameter to not default to a mutable type (dict)
* Implement invocation in the base class's run() method have each action
  module call the run() method's implemention in the base class.
* Return values from the action plugins' run() method takes the return
  value from the base class run() method into account so that invocation
  makes its way to the output.

Fixes #12869
2015-10-22 16:07:26 -07:00
Brian Coca
5017a96948 Revert "make callbacks declare needing whitelisting"
another premature merge
This reverts commit df8ff85787.
2015-10-22 16:34:51 -04:00
James Cammarata
86de1429e5 Cleaning up FIXMEs 2015-10-22 16:03:50 -04:00
Toshio Kuratomi
1e50d31cdc Update submodule refs 2015-10-22 10:14:31 -07:00
Brian Coca
df8ff85787 make callbacks declare needing whitelisting
this will allow for custom or v1 callbacks locally loaded to automatically be triggered as they were in 1.x
2015-10-22 12:30:23 -04:00
Toshio Kuratomi
75cff7129c Fix for invocation not being added to output.
We want invocation to be omitted when we are running async, not when we
aren't running async.
2015-10-22 09:03:35 -07:00
Toshio Kuratomi
6b6d03290a Restore the automatic addition of invocation to the output
Revert "Remove auto-added invocation return value as it is not used by v2 and could leak sensitive data."

This reverts commit 6ce6b20268.

Remove the note that invocation was removed as we've now restored it.

Revert "keyword not in ubuntu 14.04"

This reverts commit 5c01622457.

Revert "remove invocation keyword check"

This reverts commit 5177cb3f74.
2015-10-22 08:53:37 -07:00
James Cammarata
498c27d09a Re-adding role_names magic variable
Fixes #12863
2015-10-22 11:06:47 -04:00
Brian Coca
c267c23020 make callbacks declare needing whitelisting
this will allow for custom or v1 callbacks locally loaded to automatically be triggered as they were in 1.x
2015-10-22 08:27:32 -04:00
Brian Coca
54e821ca94 added deprecation warning to comma separated role spec 2015-10-22 08:10:51 -04:00
Brian Coca
09899b7c43 Merge pull request #12783 from larsks/bug/12782
correct value of remote_user for local connections
2015-10-22 08:10:07 -04:00
Brian Coca
9886829e40 Merge pull request #12861 from willthames/galaxy_spec_in_meta_main_fix
Allow meta/main.yml to include roles through spec file
2015-10-22 08:01:02 -04:00
Brian Coca
d861e7dd5d moved several directives so they are not settable at play, block, role and task levels 2015-10-22 07:51:22 -04:00
Brian Coca
fc3a44485b skip errors on conditional if task is include
fixes #12843
2015-10-22 07:50:43 -04:00
Will Thames
002972c6cf Allow meta/main.yml to include roles through spec file
ansible-playbook now works when run with a playbook
that includes a role that includes another role
specified using csv format

Updated one of the roles used in the tests to fix
broken tests - `make test_galaxy` now works

Fixes #11486. Also addresses the problem alluded to in #10620.
2015-10-22 13:30:42 +10:00
Brian Coca
08c9e70307 made display part of variable manager and corrected reference to it
fixes #12859
2015-10-21 22:29:27 -04:00
James Cammarata
2b3c5aa41e Support cmd param in Tasks by assigning it to _raw_params
Fixes #12856
2015-10-21 15:47:09 -04:00
James Cammarata
0e447e3f41 Merge branch 'devel' of https://github.com/mathieumd/ansible into mathieumd-devel 2015-10-21 13:59:51 -04:00
James Cammarata
4b20884719 Return correct changed flag when using check mode with template and force=no
Fixes #12844
2015-10-21 13:51:39 -04:00
Brian Coca
04aa7701d1 fix prompt, static methods don't get 'self'
fixes #12833
2015-10-21 12:06:29 -04:00
Toshio Kuratomi
42ce3de8d0 Merge pull request #12853 from ansible/winrm-return-bytes
In v2, exec_command should return bytes and the caller will take responsibility for converting to unicode
2015-10-21 08:42:54 -07:00
Toshio Kuratomi
3d57a202b5 And another fix for docs 2015-10-21 08:40:30 -07:00
Toshio Kuratomi
9dc9a606f6 Correct docs build 2015-10-21 08:36:21 -07:00
Toshio Kuratomi
632d356d22 Update submodule refs 2015-10-21 08:31:58 -07:00
Toshio Kuratomi
6e5055e786 Update the use of no_log values to cover everything that heuristic_log_sanitize does.
Fixes #12792
2015-10-21 08:15:46 -07:00
James Cammarata
ec56b29ba4 Fix setting of interpreter values for delegated hosts
Fixes #12772
2015-10-21 11:05:45 -04:00
Toshio Kuratomi
c845181dc1 In v2, exec_command should return bytes and the caller will take responsibility for converting to unicode 2015-10-21 07:59:46 -07:00
gduke
744679601f Remove mutable default arguments. 2015-10-20 22:13:23 -07:00
Toshio Kuratomi
10e2fc6f60 Update submodule ref 2015-10-20 15:37:50 -07:00
Toshio Kuratomi
1126ce34e3 Merge pull request #12846 from ansible/nolog-for-return-value
Hide values in json returns which were given in parameters marked no_log.
2015-10-20 15:28:16 -07:00
Toshio Kuratomi
c2d188baff Hide values in json returns which were given in parameters marked no_log. 2015-10-20 12:42:36 -07:00
James Cammarata
3ddda2f460 Merge pull request #12842 from mcsalgado/include_with_items
Revert back to copying self._task.args
2015-10-20 15:33:34 -04:00
Brian Coca
1ecad5aed2 now galaxy correctly detects empty requirements file
also allow for 'scm' and 'src' not to be populated in requirements entries
2015-10-20 14:39:22 -04:00
Victor Salgado
c5c5f3bf7a Revert back to copying self._task.args 2015-10-20 16:21:25 -02:00
Victor Salgado
0e671baa33 Fix typo 2015-10-20 16:18:01 -02:00
James Cammarata
b46ce47a84 Don't use local transport for delegated hosts if the inventory_hostname isn't local
For some situations like Vagrant, the remote_addr may be a localhost addr, but ssh
is still desired. This corrects the assumption that any localhost remote_addr should
be using the local connection by checking the inventory_hostname value as well.

Fixes #12817
2015-10-20 14:04:39 -04:00
Toshio Kuratomi
99e7bb35c1 Simplify UnsafeProxy as we don't need to use it for byte strings, only text 2015-10-20 10:57:23 -07:00
James Cammarata
3c87c44af5 Fixing bug in includes caused by 892d9b8
Fixes #12837
2015-10-20 13:49:52 -04:00
Toshio Kuratomi
31ebafcbdd Update submodule refs 2015-10-20 09:22:58 -07:00
Toshio Kuratomi
f34b55ac2b Add python3-compat boilerplate to all .py files in lib/ansible 2015-10-19 18:36:19 -07:00
Brian Coca
de3ca57a33 avoid relative shlex import
fixes #12777
2015-10-19 19:55:22 -04:00
James Cammarata
e5b6d802bf Removing some cruft related to _local_action value on Task, which was removed
Fixes #12819
2015-10-19 16:52:27 -04:00
Mathieu
260a3e5ce7 Fixes #11055 - Set locale via LC_ALL 2015-10-19 21:25:30 +02:00
Toshio Kuratomi
923fc9fb15 Cleanup pyflakes warning (real error) 2015-10-19 12:01:01 -07:00
Toshio Kuratomi
7aa9f6754a Cleanup more pyflakes warnings (2 real problems) 2015-10-19 12:01:01 -07:00
James Cammarata
1fa975d81a Simplify group_by by removing BYPASS_HOST_LOOP from the action
Fixes #12825
2015-10-19 14:57:07 -04:00
Toshio Kuratomi
0888d78b84 Cleanup some pyflakes warning (1 real error) 2015-10-19 11:42:46 -07:00
Toshio Kuratomi
c6d44738ad Clean up some more pyflakes warnings 2015-10-19 11:35:10 -07:00
Toshio Kuratomi
3da8bab3ff Cleanup pyflakes warning (real error) 2015-10-19 11:29:51 -07:00
Toshio Kuratomi
a526eae543 Clean up a few more pyflakes warnings 2015-10-19 11:20:21 -07:00
Toshio Kuratomi
a17ae6f07e Clean up pyflakes warnings in inventory 2015-10-19 11:13:56 -07:00
James Cammarata
892d9b8dfb Move post_validate for tasks after checking for an include
Simplifies logic and prevents us from accidentally post_validating
an include that would otherwise be skipped due to tags causing a
problem because of potentially missing variables.

Fixes #12793
2015-10-19 13:42:17 -04:00
James Cammarata
1cfd941179 Adding a v2 callback for task includes 2015-10-19 13:42:17 -04:00
Toshio Kuratomi
dc33d30c6d Update submodule refs 2015-10-19 10:25:36 -07:00
Toshio Kuratomi
b67e51ea06 Information on when to use to_str() and what a native string is 2015-10-19 09:28:43 -07:00
Toshio Kuratomi
39d9bc3564 Update submodule refs 2015-10-19 09:09:07 -07:00
Toshio Kuratomi
6ce6b20268 Remove auto-added invocation return value as it is not used by v2 and could leak sensitive data. 2015-10-19 09:08:25 -07:00
Brian Coca
1280e2296c changed warning to debug and expanded info on what is really happening, it was a bit misleading 2015-10-18 11:00:50 -04:00
Brian Coca
2d1d21228a updated skippy to match default output 2015-10-18 11:00:50 -04:00
James Cammarata
0bbe9d5bd0 Make hostvars json/yaml serializable in filters
Fixes #12615
2015-10-18 10:09:05 -04:00
James Cammarata
a88c59f451 Reset basedir for plays that are not from a PlaybookInclude
Fixes #12524 (again)
2015-10-17 12:44:28 -04:00
James Cammarata
0aa018337a Fixing logic in json cache plugin get()
Fixes #12722
2015-10-17 11:50:14 -04:00
James Cammarata
5f617c601b Remove obsolute tag evaluation in free strategy
Fixes #12784
2015-10-17 11:29:39 -04:00
Brian Coca
6c8cf8acb7 now profile_tasks callback handles handlers correctly
fixes #12762
2015-10-16 18:01:27 -04:00
James Cammarata
1ab0e0e228 Disable RuntimeWarnings during all() plugin loading
Fixes #12778
2015-10-16 15:34:49 -04:00
Brian Coca
71ffb86c30 don't let cowsay issues stop execution
fixes #12773
2015-10-16 15:20:59 -04:00
Brian Coca
6d87bd405d Merge pull request #12765 from bcoca/lookup_inventory_hostname
implemented inventory_hostname lookup in v2
2015-10-16 15:05:23 -04:00
Toshio Kuratomi
a567f28657 Update submodules for docs fixes# Please enter the commit message for your changes. Lines starting 2015-10-16 11:12:21 -07:00
Toshio Kuratomi
5d8ab9b01b Update module refs 2015-10-16 10:05:57 -07:00
Toshio Kuratomi
b23a083776 Make vault use a mapping of cipher name to classes instead of formatting the name for safety. 2015-10-16 10:05:27 -07:00
Toshio Kuratomi
baa309309d Bundle a new version of python-six for compatibility along with some code to make it easy for distributions to override the bunndled copy if they have a new enough version. 2015-10-16 08:21:28 -07:00
Lars Kellogg-Stedman
aa0b7536c9 correct value of remote_user for local connections
When using 'local' connections, privilege escalation would fail if
ansible_ssh_user was in the current context to the same value as
become_user.

This commit ensures that for 'local' connections we reset remote_user to
the local username.

This fixes #12782.
2015-10-16 11:17:58 -04:00
Toshio Kuratomi
28c933ce5e properly fail_json when we don't have ssl on a non-redhat distro 2015-10-16 08:06:32 -07:00
Marius Gedminas
98958ec990 Simplify join expression 2015-10-16 17:39:27 +03:00
Marius Gedminas
56184a3d8c Python 3: avoid %-formatting of byte strings
This is needed for Python 3.4 compatibility; Python 3.5 can use
`b'%s\n' bytestring` again.
2015-10-16 17:18:35 +03:00
Brian Coca
9b088a1e40 implemented inventory_hostname lookup in v2 2015-10-15 13:11:42 -04:00
Brian Coca
aee6de5a76 group_names should not include implied 'all', fixes #12763 2015-10-15 11:46:43 -04:00
James Cammarata
dce58a78c9 Make random cowsay truly random
Also adds a cowsay whitelist config option, because there are some
truly NSFW stencils that come with cowsay by default.
2015-10-15 10:52:53 -04:00
Marius Gedminas
4fb6f62f1b Fix Unexpected Exception: global name 'os' is not defined
I inadvertently introduced it in
ca826508d9 and didn't notice, because
there are no unit tests for playbook_executor.py.  Sorry!

(The "from ansible.errors import *" was used *only* to get the 'os'
module, which makes go "what?")
2015-10-15 10:41:00 +03:00
Marius Gedminas
ab569cea22 Move to_str alias into ansible.utils.unicode
@abadger suggested on IRC that it's useful enough to go into
ansible.utils.unicode.
2015-10-15 10:27:38 +03:00
Marius Gedminas
ca826508d9 Python 3: fix AnsibleError formatting
If you convert the error string to bytes and embed it inside another
error string, you get

  Prefix:

  b'Embedded\nerror\nstring'

which is not what we want.

But we also don't want Unicode in error messages causing unexpected
UnicodeEncodeErrors when on Python 2.

So let's convert the error message into the native string type (bytes on
Python 2, unicode on Python 3).
2015-10-15 09:38:14 +03:00
Toshio Kuratomi
5617f6aad4 Update synchronize to use the correct host when delegating
Fixes #12752
2015-10-14 18:57:10 -07:00
Toshio Kuratomi
85abd61001 Add some more info to docstring 2015-10-14 18:57:10 -07:00
James Cammarata
d923d05a33 Reworking the way all() works in plugin_loader
* Don't throw away the full path of the module code being loaded,
  as this can cause conflicts when files of the same name are being
  instantiated
* Generalize the module loading code

Fixes #12738
2015-10-14 17:53:28 -04:00
James Cammarata
45b803efb4 Properly use test_loader from SharedPluginLoaderObj 2015-10-14 17:53:28 -04:00
Toshio Kuratomi
c8ad55103e Update extras modules ref to fix docs 2015-10-14 08:44:37 -07:00
Toshio Kuratomi
e00eeba9c3 Update submodule refs 2015-10-14 08:06:55 -07:00
James Cammarata
91b0b4d40c Check is_directory() before not is_file() in inventory basedir
Fixes #12742
2015-10-14 11:03:10 -04:00
Brian Coca
c57200925f made syslog import optional as intel's edison custom compiles python w/o it 2015-10-14 09:12:02 -04:00
James Cammarata
ee559e03f7 Merge pull request #12725 from mgedmin/py3k
Python 3: there's no basestring
2015-10-13 16:52:46 -04:00
James Cammarata
e6d3c6745f Revert to using local file/dir tests in inventory instead of loader's
Fixes #12719
2015-10-13 12:04:01 -04:00
Brian Coca
c637d60a8d fixed deprecation message 2015-10-13 11:40:21 -04:00
Brian Coca
f5227d494b added missing cachefile and changed str(e) to to_bytes(e) 2015-10-13 11:15:10 -04:00
Marius Gedminas
9ba6c087d3 Python 3: there's no basestring 2015-10-13 09:56:12 +03:00
Marius Gedminas
f03da5be42 Python 3: there's no iteritems() 2015-10-13 09:47:16 +03:00
James Cammarata
2d77c643e4 Merge pull request #12723 from mgedmin/py3k
Make ansible.vars.unsafe_proxy Python 3 friendly
2015-10-13 02:45:55 -04:00
Marius Gedminas
e511d6d458 Make UnsafeProxy work on Python 3
Instead of str and unicode we have to deal with bytes and str.
2015-10-13 09:41:08 +03:00
Marius Gedminas
af6a316d9b Remove unused import
Fixes ImportError: No module named '__builtin__' on Python 3.
2015-10-13 09:37:48 +03:00
James Cammarata
426187489f Add variable for format parameter 2015-10-13 02:33:18 -04:00
Toshio Kuratomi
8277747a04 Fix password lookup when password file exists and the password is not encrypted 2015-10-12 15:52:03 -07:00
James Cammarata
cd2cb178ae Totally rework the way UnsafeProxy does things 2015-10-12 18:13:09 -04:00
Toshio Kuratomi
15d7f53846 AnsibleModules.log() fix for python3
Also add unittests for AnsibleModules.log()

Fixes #12586
2015-10-12 13:30:27 -07:00
Toshio Kuratomi
b49e0995cb Fix typo 2015-10-12 13:29:04 -07:00
Toshio Kuratomi
b58d7470d4 Cleanup logic and be more paranoid about passwords with spaces 2015-10-12 12:55:33 -07:00
James Cammarata
5c5806d669 Fixing bugs related to jfonfile cache plugin
* corrupt/invalid file causes tracebacks
* incorrect initialization of display/_display in BaseCacheModule class
* tweaking the way errors in get() on jsonfile caches work, to raise
  a proper AnsibleError in that situation so the playbook/task is stopped

Fixes #12708
2015-10-12 13:06:41 -04:00
Toshio Kuratomi
b441bcb678 Fix display when run through a testing framework that overrides stderr/stdout 2015-10-12 10:06:13 -07:00
James Cammarata
d15fcf05f0 Fix bug in the way temp vars were created for templating vars_files
Fixes #12711
2015-10-12 12:17:45 -04:00
Brian Coca
f5f3bf06e4 Merge pull request #12550 from redrampage/remove-pw-salt-deletion
Removed deletion of salt by 'password' lookup
2015-10-12 11:33:19 -04:00
James Cammarata
73661d1761 Merge branch 'devel' of https://github.com/ansible/ansible into devel 2015-10-12 11:30:03 -04:00
Charles Paul
3d533cb423 fixing calls to fail_json 2015-10-12 08:50:18 -05:00
Brian Coca
50372eecc9 Merge pull request #12455 from privateip/devel
added methods for retrieving vapp and vm
2015-10-12 09:37:47 -04:00
James Cammarata
82e76e42e5 Tweak to the way serial percentages are handled 2015-10-12 09:00:43 -04:00
James Cammarata
63e288354e Fix bug in way omitted values were set 2015-10-12 09:00:27 -04:00
James Cammarata
4c85ae0712 Merge branch 'serial_should_be_string' of https://github.com/klshxsh/ansible into klshxsh-serial_should_be_string 2015-10-12 08:28:07 -04:00
klshxsh
ac00c9ced7 changed 'string' to 'percent' for _serial
Note that this allows both integers (e.g. 3) and percentages (e.g. "30%")
Also changed default back to 0 rather than '0'
2015-10-12 12:41:00 +01:00
James Cammarata
eb60ce1b6e Merge pull request #12703 from keitwb/inventory_file_var
Adding the inventory_file var back
2015-10-11 16:04:34 -04:00
James Cammarata
71a1a3c903 Submodule pointer update 2015-10-10 22:31:54 -04:00
Ben Keith
1f82971283 Adding the inventory_file var back 2015-10-10 21:54:28 -04:00
Toshio Kuratomi
45a161b0a1 Merge pull request #12429 from edmstudio/devel
Update synchronize module plugin to work on OS X
2015-10-09 16:05:46 -07:00
Petr Mifek
6e035a3e94 Move nested function test for ipv6 to top level in synchronize module. 2015-10-10 00:01:22 +02:00
Brian Coca
45788fbfad <homer>doh!</homer> 2015-10-09 16:58:01 -04:00
Brian Coca
d24532757c remove fix for local_action/connection local that is now not needed 2015-10-09 16:53:17 -04:00
klshxsh
4a5e52b2d2 The serial keyword can be specified as a percentage, e.g '30%' or a number e.g. '3'; therefore it needs to be a string to allow both types 2015-10-09 21:34:37 +01:00
Brian Coca
b9d54e9a01 corrects previous fix to deal with missing item key in results dict 2015-10-09 13:01:32 -04:00
Brian Coca
abf2e13955 Revert "Track local_action internally to prevent it from being overridden"
This reverts commit 49ca0eb797.
2015-10-09 13:01:32 -04:00
Brian Coca
101c8785ec removed changes to make local action equate connection=local and brought it back to equate delegate_to=localhost 2015-10-09 13:01:32 -04:00
Brian Coca
bcb173996b Merge pull request #12695 from matburt/fix_cache_plugins_for_v2
Fix an issue where cache plugins weren't updated in certain scenarios
2015-10-09 11:39:58 -04:00
Brian Coca
fbf4cafab5 on skipped you 'might' not have an item, changed to getattr to avoid keyerror
fixes #12683
2015-10-09 11:28:11 -04:00
Matthew Jones
7da478a4f4 Fix an issue where cache plugins weren't updated
The first call to persisting facts would work due to the assignment of a
MutableMapping calling __setitem__ but subsequent module fact data would
not be propogated to the fact cache plugins because update() doesn't
invoke __setitem__.  This changes the behavior a little bit and ensures
set() is called on cache plugins.
2015-10-09 11:16:41 -04:00
Brian Coca
ec02b255c3 Merge pull request #12689 from soarpenguin/bugfix
Remove some warning of undefined name and fix classmethod syntax error.
2015-10-09 11:09:50 -04:00
James Cammarata
770032648a Show -> localhost for local_action tasks 2015-10-09 10:53:53 -04:00
James Cammarata
f415d39dfd Merge pull request #12690 from stelligent/devel
Use AWS_DEFAULT_REGION env var if none specified
2015-10-09 10:02:48 -04:00
James Cammarata
cfa62e7a2a Submodule pointer update 2015-10-09 09:50:16 -04:00
James Cammarata
868819f9fa Make sure shlex split is returning properly encoded strings
Fixes #12676
2015-10-09 09:49:27 -04:00
Shayne Clausson
55b3f9e4e5 Use AWS_DEFAULT_REGION env var if none specified 2015-10-09 10:27:36 +02:00
soarpenguin
b11ea17385 fix classmethod syntax error. 2015-10-09 12:46:31 +08:00
soarpenguin
5efa4d29e3 fix some warning of undefined name. 2015-10-09 12:43:42 +08:00
James Cammarata
59d655c543 Double echo temp directory name to handle spaces and ~ expansion both
Fixes #12667
2015-10-08 16:22:38 -04:00
Toshio Kuratomi
d1b98ec776 Correct typo 2015-10-08 08:44:25 -07:00
Toshio Kuratomi
2f5e817007 Do not mix byte str with unicode type 2015-10-08 08:31:12 -07:00
Toshio Kuratomi
01ba2e94c0 Wait until later to convert to byte strings for output
Also some pre-emptive python3 compat and a code simplification
2015-10-08 08:22:17 -07:00
Brian Coca
76feba00c4 avoid callbacks during syntax check and listing
fixes #12682
2015-10-08 10:15:48 -04:00
Brian Coca
4463ced8ba simpler safe output 2015-10-08 10:15:48 -04:00
James Cammarata
de792ba3c2 Improve handling of unicode errors
Fixes #12669
2015-10-08 10:04:15 -04:00
James Cammarata
5a0f5f1254 Load vars for localhost when created implicitly
Fixes #12666
2015-10-08 09:26:20 -04:00
Brian Coca
d8769c93c7 updated ec2 region description to add missing other env var 2015-10-07 16:41:58 -04:00
Brian Coca
c77733e64e added docs for commonly used region parameter in some ec2 modules 2015-10-07 15:52:06 -04:00
Brian Coca
638bc14566 now deps is always a list 2015-10-07 15:41:11 -04:00
George Sudarkoff
fa332e1342 Fail if the vault password script returns non-zero. 2015-10-07 10:32:50 -07:00
Brian Coca
dac3684fd1 changed task color to dark gray to keep it from being confused with ignore/skip 2015-10-07 12:12:35 -04:00
Brian Coca
c459dd4e18 Merge pull request #12663 from Juraci/task-path
Displays the absolute path of a given task when verbosity is above level 3
2015-10-07 12:09:21 -04:00
James Cammarata
dbae110f6f Merge pull request #12660 from apollo13/fix_galaxy_init
Show a nice error if the role name is missing.
2015-10-07 10:31:47 -04:00
Juraci
e52950a939 Displaying task_path on task start when verbosity is more than 3 2015-10-07 10:11:50 -03:00
Juraci
254d6be520 Adding get_path method to Task class 2015-10-07 10:10:57 -03:00
Florian Apolloner
354383874f Show a nice error if the role name is missing. 2015-10-07 11:37:23 +02:00
=
345ce424c6 Explictly set the version of strict mode to use for powershell modules. 2015-10-07 06:24:37 +01:00
James Cammarata
9e364c2eb5 Don't modify results in callbacks
Fixes #12654
2015-10-06 21:43:43 -04:00
James Cammarata
8107c4efc7 Fixing a bug in galaxy parsing of text spec file lines 2015-10-06 21:25:28 -04:00
James Cammarata
7a815b7296 Force connection to local when localhost is delegated to 2015-10-06 20:37:57 -04:00
Toshio Kuratomi
97e8d25eb4 Fix for encoding errors when a command returns non-utf8 encoded values 2015-10-06 14:10:25 -07:00
Toshio Kuratomi
4f6f2c21e8 range vs xrange doesn't matter here and six.moves.range isn't available in six-1.3.0 (rhel7) 2015-10-06 12:19:03 -07:00
James Cammarata
5ae74f7d38 Version bump for 2.0.0-0.3.beta1 2015-10-06 08:19:20 -04:00
James Cammarata
d9b79b1bbc Also template the role name when loading roles
Fixes #12602
2015-10-06 03:33:08 -04:00
James Cammarata
9c9897805f More ansible-galaxy fixes for the old spec file format 2015-10-06 01:54:48 -04:00
James Cammarata
fb822a4305 Merge pull request #12637 from rcleere/rekey_fix
Fix ansible-vault rekey
2015-10-05 23:33:32 -04:00
James Cammarata
3b8eaf6128 Cleaning up some ansible-galaxy stuff 2015-10-05 22:59:08 -04:00
Ryan Cleere
0400ab8c0f Fix ansible-vault rekey 2015-10-05 16:41:34 -05:00
James Cammarata
d91b3c6b9d Make sure magic variables are available when templating vars_files
Also does some reorganization/cleanup on the magic vars/delegated
variable generation portions of VariableManager to make the above
possible.

Fixes #12633
2015-10-05 16:32:58 -04:00
James Cammarata
284bd118a0 Properly switch to the default transport when delegating from localhost 2015-10-05 16:32:58 -04:00
Brian Coca
6f88f79de9 removed dupe install code, now trap errors forom role.install 2015-10-05 13:04:12 -04:00
Brian Coca
f73329401b galaxy updates
better error reporting on fetching errors
use scm if it exists over src
unified functions in requirements
simplified logic
added verbose to tests
cleanup code refs, unused options and dead code
moved get_opt to base class
fixes #11920
fixes #12612
fixes #10454
2015-10-05 11:43:08 -04:00
Brian Coca
a3ed9fc131 updated to 'fixed' get_url so docs build again 2015-10-05 09:07:54 -04:00
Brian Coca
f3d0468726 updated submodule refs 2015-10-05 08:59:10 -04:00
James Cammarata
323012be2e Pop tags out of playbook include params
Fixes #12605
2015-10-05 08:41:34 -04:00
Toshio Kuratomi
10a4a4e986 Quote any file paths that we have to use with dd to copy.
This is because we pass the whole dd command string into the shell
that's running on the contained environment rather than running it
directly from python via subprocess without a shell.
2015-10-03 18:07:27 -07:00
Toshio Kuratomi
b83988d9fb Port libvirt_lxc connection plugin to v2 2015-10-03 17:42:49 -07:00
Toshio Kuratomi
567deb5ac2 Add explicit substitution of relative paths on the remote host just in case the connection programs do something unexpected. 2015-10-03 17:33:57 -07:00
Brian Coca
8528b20702 fixed usage text 2015-10-03 12:02:51 -04:00
Brian Coca
04a2b221b9 removed conflicting short options 2015-10-03 10:05:23 -04:00
James Cammarata
38528c8ef3 Show more info in the minimal callback for unreachable hosts
Fixes #12621
2015-10-03 01:41:57 -04:00
Toshio Kuratomi
613e87db6c FIx typo arg_path (not plural) 2015-10-02 19:55:32 -07:00
Brian Coca
4ba5ebd1c8 Merge pull request #12538 from yesbox/url_lookup_plugin_httperror_fix
Fix url lookup plugin HTTPError message not being reachable
2015-10-02 21:30:16 -04:00
Peter Sprygada
ab3239ecd7 added methods for retrieving vapp and vm 2015-10-02 18:01:35 -04:00
Toshio Kuratomi
10750214ea Since Connection.execute_command() returns bytes, deal with the repurcussions here. 2015-10-02 12:39:36 -07:00
Brian Coca
e2ae3215f6 corrected no_log for items and skipped tasks
corrected output from default callback
added new tests for no_log loops
updated makefile test to check for both positive and negative occurrences of no_log
2015-10-02 14:35:33 -04:00
James Cammarata
c28758d2a8 Merge branch 'ssh-args' of https://github.com/amenonsen/ansible into amenonsen-ssh-args 2015-10-02 13:38:00 -04:00
James Cammarata
82faba619e Also add args_path param to powershell shell plugin 2015-10-02 13:25:26 -04:00
James Cammarata
30d481ac57 Fix old-style (non-python) module support 2015-10-02 12:58:35 -04:00
Toshio Kuratomi
e40e08d799 Update core sumodule ref to fix docs 2015-10-02 09:22:43 -07:00
Abhijit Menon-Sen
b127221f50 Pass default None to getattr, remove repeated call 2015-10-02 21:26:25 +05:30
Abhijit Menon-Sen
96c4dc273a Set explicit default for ANSIBLE_SSH_ARGS
The earlier code behaved exactly as though this default had been set,
but it was actually handled as a(n unnecessary) special case inside the
connection plugin, rather than set as an explicit default.

If the default is overriden either in ansible.cfg or the environment,
the new code will continue to work (in fact, it won't know or care,
since it just uses the value set in the PlayContext).

This is submitted as a separate commit for easier review to address
backwards-compatibility concerns.
2015-10-02 21:26:25 +05:30
Abhijit Menon-Sen
1981bf2b95 Aggregate ssh arguments in PlayContext instead of the connection plugin
Using set_host_overrides() in the connection plugin to access the ssh
argument variables from the inventory didn't see group_vars/host_vars
settings, as noted earlier. Instead, we can set the correct values in
the PlayContext, which has access to all command-line options, task
settings, and variables.

The only downside of doing so is that the source of the settings is no
longer available in ssh.py, and therefore can't be logged. But the code
is simpler, and it actually works.

This change was suggested by @jimi-c in response to the FIXME in the
earlier commit.
2015-10-02 21:26:25 +05:30
Abhijit Menon-Sen
3ad9b4cba6 Rework additional ssh argument handling
Now we have the following ways to set additional arguments:

1. [ssh_connection]ssh_args in ansible.cfg: global setting, prepended to
   every command line for ssh/scp/sftp. Overrides default ControlPersist
   settings.
2. ansible_ssh_common_args inventory variable. Appended to every command
   line for ssh/scp/sftp. Used in addition to ssh_args, if set above, or
   the default settings.
3. ansible_{sftp,scp,ssh}_extra_args inventory variables. Appended to
   every command line for the relevant binary only. Used in addition to
   #1 and #2, if set above, or the default settings.
3. Using the --ssh-common-args or --{sftp,scp,ssh}-extra-args command
   line options (which are overriden by #2 and #3 above).

This preserves backwards compatibility (for ssh_args in ansible.cfg),
but also permits global settings (e.g. ProxyCommand via _common_args) or
ssh-specific options (e.g. -R via ssh_extra_args).

Fixes #12576
2015-10-02 21:26:25 +05:30
Toshio Kuratomi
f13d5201b8 Update module refs 2015-10-02 08:34:05 -07:00
Brian Coca
4c9f58a152 added no_log censoring to item output
should be last commit that fixes #12214
2015-10-02 09:11:41 -04:00
Brian Coca
ba4afcbbb6 added no_log to results
normalized outputs to use display class
cleaned up unused imports
2015-10-02 09:11:41 -04:00
Brian Coca
c27bd4fab0 {sudo,su}_user does not imply become 2015-10-02 09:11:41 -04:00
James Cammarata
57372906aa Pull host/group vars when adding hosts/groups
Fixes #12582
2015-10-02 02:47:09 -04:00
James Cammarata
aa3687d736 Fix syntax error for octal in encrypt methods 2015-10-02 02:27:57 -04:00
James Cammarata
538568305a Submodule pointer update for accelerate module fixes 2015-10-02 00:50:02 -04:00
James Cammarata
8ef78b1cf8 Fixing accelerated connection plugin 2015-10-02 00:50:02 -04:00
Brian Coca
3705d54485 fixed error reporting on splitter 2015-10-01 19:03:04 -04:00
Brian Coca
de2f62bd9e fixed error reporting for unkown become user 2015-10-01 18:58:16 -04:00
Brian Coca
6d6bfbc3d2 added missing import for pwd, was being obscured by exception catching and fallback 2015-10-01 18:56:30 -04:00
Brian Coca
a680ef66dd fixed vault password file script execution 2015-10-01 18:49:51 -04:00
Brian Coca
6b842d9c49 fixed incorrect data passing on certain events 2015-10-01 18:49:51 -04:00
Brian Coca
2463922306 fixed error reporting when missing redis import 2015-10-01 18:49:51 -04:00
Brian Coca
6e96188085 added missing entry for dealing with bcc 2015-10-01 18:49:51 -04:00
Brian Coca
6ec5abf1c3 fixed some pyflakes 2015-10-01 14:14:20 -04:00
Abhijit Menon-Sen
49b35ad5dd Remove mysterious old cruft
The two lines were added in 2673eb0a and modified in 60e1a1f8, but foo
is completely unused. Removing it doesn't break anything: out it goes!
2015-10-01 20:32:08 +05:30
Brian Coca
fe0e4f27ad Merge pull request #12584 from amenonsen/fixups
Remove an unwanted FIXME annotation
ok, confirmed we don't want to support it
2015-10-01 10:24:58 -04:00
Brian Coca
6c190aa8a4 updated ansible-doc to ignore more stuff that has been added to the module repos 2015-10-01 10:17:41 -04:00
Brian Coca
1a56a5c442 created debug method, renamed debug attribute to _debug 2015-10-01 10:17:41 -04:00
James Cammarata
deff045aa9 Fix bug caused by options not having start_at_task when used through adhoc
Fixes #12590
2015-10-01 10:09:58 -04:00
Toshio Kuratomi
a0920c06e1 Pull submodule refs to fix docs builds 2015-09-30 19:57:55 -07:00
Toshio Kuratomi
4dae7eeca1 Update submodule refs 2015-09-30 19:41:56 -07:00
Toshio Kuratomi
56fa9a5098 Port to v2 API 2015-09-30 19:39:07 -07:00
Toshio Kuratomi
d35c9a30fb Minor refactorings 2015-09-30 19:39:06 -07:00
Toshio Kuratomi
888bcd65a8 Create error messages instead of tracebacks. 2015-09-30 19:39:06 -07:00
Abhijit Menon-Sen
93515468c4 Remove an unwanted FIXME annotation
<crab> jimi|ansible: do you think it should be possible to add both
       foo:22 and foo:23 to the inventory?
<jimi|ansible> no

…so we don't want an invitation to FIXME.
2015-10-01 06:56:29 +05:30
Toshio Kuratomi
4cfcf5d61b Merge pull request #12568 from mgedmin/py3k
Python 3: fix most tests for ansible.module_utils.basic
2015-09-30 12:47:29 -07:00
Trond Hindenes
94cfbe7ee9 Get-AnsibleParam 2015-09-30 21:02:12 +02:00
James Cammarata
dcb8caf9e8 Remember if we already skipped tasks via --start-at-task
Fixes #12482
2015-09-30 14:12:38 -04:00
chouseknecht
57adf11262 Fix metadata description for galaxy_tags. 2015-09-30 13:36:28 -04:00
chouseknecht
f4690e3bfe Changing tag to galaxy_tag. 2015-09-30 13:36:23 -04:00
chouseknecht
8360a1b3f2 Replace categories with tags.
Also added --ignore-certs option for use with install and search commands. Helpful when
overriding server and server has self signed cert.
2015-09-30 13:36:17 -04:00
Abhijit Menon-Sen
0bb34fd076 Make «ansible-vault view» not write plaintext to a tempfile
CLI already provides a pager() method that feeds $PAGER on stdin, so we
just feed that the plaintext from the vault file. We can also eliminate
the redundant and now-unused shell_pager_command method in VaultEditor.
2015-09-30 22:13:36 +05:30
Brian Coca
bf06e36382 updated async to pass along no_log setting 2015-09-30 11:52:27 -04:00
Marius Gedminas
cc1e1648f5 Tweak comment style 2015-09-30 18:46:50 +03:00
Marius Gedminas
213029a21e Python 3: don't convert unicode to unicode 2015-09-30 18:46:49 +03:00
Marius Gedminas
c7be004c19 Python 3 has no dict.iteritems()
(Reminder: cannot use six here, module_utils get shipped to remote
machines that may not have six installed -- besides six doens't support
Python 2.4.)
2015-09-30 18:46:49 +03:00
Marius Gedminas
9f3e5ceb14 Make sure 'basestring', 'bytes' and 'unicode' are defined
Python 3 doesn't have 'basestring' and 'unicode'.

Python 2.4 doesn't have 'bytes'
2015-09-30 18:40:47 +03:00
Brian Coca
ddafed4403 Merge pull request #12528 from bcoca/task_logging
task logging revamp
2015-09-30 11:38:34 -04:00
Brian Coca
7b64126c9d pushed up openvz detection for cases of 'stacked' virtualization 2015-09-30 11:27:50 -04:00
Linus Unnebäck
45f9800754 facts: correctly detect docker inside a xen host 2015-09-30 17:08:21 +02:00
James Cammarata
3bd71d0619 Use delegated_to field for play context remote_addr, if none other exists
Fixes #12527
2015-09-30 09:27:29 -04:00
James Cammarata
40bdf09998 Merge pull request #12561 from srvg/anotherdirpy
Inject existing groups at InventoryDir initialization
2015-09-30 08:18:34 -04:00
James Cammarata
6fcd292c5e Merge pull request #12569 from amenonsen/fixes
Bring groups handling in ini.py up-to-date (trivial fix)
2015-09-30 08:16:14 -04:00
James Cammarata
dfa33d0f23 Tweak variable manager use in role includes to avoid test failures 2015-09-30 08:05:55 -04:00
Abhijit Menon-Sen
50d75f8d6d Bring groups handling in ini.py up-to-date
Since c8f2483d, ini.py expects to always be passed in a pre-created list
of groups, and can no longer deal sensibly with an empty list; this just
makes that expectation clear.
2015-09-30 15:13:37 +05:30
James Cammarata
a89412ecb1 Fail all hosts if a run_once task fails
Fixes #12563
2015-09-29 15:10:00 -04:00
James Cammarata
7173f587ed Allow delegate_to on a role again
Fixes #12560
2015-09-29 15:07:32 -04:00
James Cammarata
a3e913da62 Don't assume handlers exist in the same role (if any)
Fixes #12536
2015-09-29 14:52:43 -04:00
Serge van Ginderachter
7461ba9998 Inject existing groups at InventoryDir initialization
This fixes a corner case where ini files live in a subdir
of the main inventory directory.

Reproducing the original error:

mkdir -p inventory/ini
cat > inventory/ini/hosts << EOF
[www]
www1
EOF

$ ansible -i inventory/ all -m ping
ERROR! 'all'

(or without the [www] group, it would complain about 'ungrouped')
2015-09-29 18:16:05 +02:00
James Cammarata
79e364d98b Properly template role dependency names
Fixes #12505
2015-09-29 09:55:57 -04:00
Marius Gedminas
5edd6d9be4 Python 3: there's no basestring
Fixes another failing test.

(I don't want to do a global search/replace for 'basestring' because I
want to have unit tests covering each occurrence.  When I run out of
existing failing tests, I'll try to write new ones.)
2015-09-29 09:01:57 +03:00
Toshio Kuratomi
95ede22a1e Add a comment about the docker connection and usage by non-root users 2015-09-28 22:50:06 -07:00
Toshio Kuratomi
0e110d23f8 Misc cleanups and some fixes for docker connection plugin
* Remove extraneous imports
* Fix some error handling
* Enable pipelining
* Disable su since it doesn't work
* Add error message when installed docker is not recent enough to
  support this plugin
* Move nested functions to class level
* Make transport a class attribute
* Make exec_command, put_file and fetch_file more robust
2015-09-28 22:35:52 -07:00
Toshio Kuratomi
1d119a1f46 Cleanup some extraneous imports 2015-09-28 22:35:52 -07:00
James Cammarata
ffdba96668 Save the included directory for playbook includes for use as the basedir
Fixes #12524
2015-09-29 00:28:45 -04:00
Konstantin Manna
4226e49bc6 bugfix: statement had no effect => statement now has assumed effect 2015-09-28 23:33:48 -04:00
Konstantin Manna
1ccfeafa76 bugfix: use correct close calls 2015-09-28 23:33:32 -04:00
Brian Coca
c1ad96e5cf removed fixme as it is already implemented below. 2015-09-28 23:32:57 -04:00
RedRampage
922b5c8109 Removed deletion of salt by 'password' lookup
Removed deletion of salt param from lookup file by 'password' lookup_filter.
Old behaviour leads to constant changed status when two tasks uses same lookup,
one with 'encrypt' parameter, and other without.

For example:

    tasks:
      - name: Create user
        user:
          password: "{{ lookup('password', inventory_dir + '/creds/user/pass' ncrypt=sha512_crypt) }}"
          ...
    # Lookup file 'creds/user/pass' now contain password with salt
      - name: Create htpasswd
        htpasswd:
          password: "{{ lookup('password', inventory_dir + '/creds/user/pass') }}"
          ...
    # Salt gets deleted from lookup file 'creds/user/pass'
    # Next run of "Create user" task will create it again and will have 'changed' status
2015-09-28 23:28:01 +03:00
Toshio Kuratomi
12a2585e84 chroot plugin minor touchups:
* Disable su as it's not currently working 100% (and was disabled in v1).
* Move BUFSIZE out of the class to match other conenction plugins
* _connect shouldn't return self.
2015-09-28 13:16:56 -07:00
Toshio Kuratomi
7a4266e9c5 One more try -- the error message should reference the become method
requested via play context
2015-09-28 11:28:33 -07:00
Toshio Kuratomi
696cf32d63 Correct name of variable 2015-09-28 11:28:33 -07:00
Brian Coca
8d024c3747 Merge pull request #12472 from resmo/for_ansible
cloudstack: improvements and tests
2015-09-28 14:27:22 -04:00
Toshio Kuratomi
0dfa1fb43a Correct call to method typo 2015-09-28 11:24:00 -07:00
Toshio Kuratomi
d827325644 Re-order the methods in ssh.py so that methods needed for implementation are near and just above the relevant public methods.
Standard with the rest of the code base.
2015-09-28 10:34:02 -07:00
Toshio Kuratomi
37844a5c1b Update submodule refs 2015-09-28 09:47:16 -07:00
Toshio Kuratomi
c811668a4d Merge pull request #12546 from amenonsen/ssh-cleanups
A couple of ssh cleanups
2015-09-28 09:46:24 -07:00
Toshio Kuratomi
05af4c8e91 Merge pull request #12471 from amenonsen/pipelining
Make pipelining a connection variable
2015-09-28 09:02:43 -07:00
Abhijit Menon-Sen
38c7422da5 Move ControlPersist/Path checking into a separate method
This is also peripheral to what _build_command needs, can be improved
and tested independently, and so makes more sense in a separate method.

This commit doesn't change any functionality (and I've verified that it
works with the various combinations: control_path set in ansible.cfg,
ssh_args adding or not adding ControlMaster/ControlPersist, etc.).
2015-09-28 21:11:56 +05:30
Toshio Kuratomi
c3a05b1181 Update to fix one more doc error 2015-09-28 08:38:24 -07:00
Abhijit Menon-Sen
f33d541964 Move sshpass checking into a separate method
Checking for sshpass is peripheral to the calling code, so it's easier
to follow when the details are moved into a method.
2015-09-28 20:58:30 +05:30
Abhijit Menon-Sen
565c6f1ae7 Make ansible_pipelining a connection variable
SSH pipelining can be a significant performance improvement, but it will
not work if sudoers is configured to requiretty. With this change, one
could have pipelining enabled in ansible.cfg, but use sudo to turn off
requiretty in a separate play (or task) where pipelining is disabled:

    - hosts: foo
      vars:
          ansible_pipelining: no
      tasks:
        - lineinfile: dest=/etc/sudoers line='Defaults requiretty' state=absent
          sudo_user: root

(Note that sudoers has a complicated syntax, so the above lineinfile
invocation may be too simplistic for production use; but the point is
that a separate play can do something to disable requiretty.)
2015-09-28 20:55:14 +05:30
Toshio Kuratomi
fd267989fb Fix docs build 2015-09-28 08:23:12 -07:00
Toshio Kuratomi
69ebb899a7 Update submodule refs 2015-09-28 07:52:04 -07:00
James Cammarata
c860775b5d Another fix for --limit in adhoc 2015-09-28 10:39:33 -04:00
James Cammarata
babf47decb Clean up some bugs related to --limit on adhoc commands 2015-09-28 09:02:24 -04:00
James Cammarata
621575681a Merge pull request #12542 from amenonsen/qfix
Clarify why we add -q only for ssh
2015-09-28 08:18:31 -04:00
Abhijit Menon-Sen
2ce219b5af Clarify why we add -q only for ssh 2015-09-28 16:00:23 +05:30
Marius Gedminas
9b39af8e9a Python 3: the StringIO module is gone
Fixes 17 failing tests on Python 3.4, restoring the 8 failures we had
last Friday.
2015-09-28 09:28:53 +03:00
Jesper Geertsen Jonsson
353b549eb0 Fix HTTPError message not being reachable 2015-09-27 18:01:19 +00:00
James Cammarata
4cd810a674 Only append -q option for ssh if we're using ssh 2015-09-26 21:27:38 -04:00
James Cammarata
46984a067c Don't wrap vars from include_vars with UnsafeProxy 2015-09-26 15:16:46 -04:00
James Cammarata
abfeb104df Merge pull request #12529 from soarpenguin/bug-fix
fix no self pointer out of class.
2015-09-26 14:18:58 -04:00
Toshio Kuratomi
342bc97322 Port chroot conection plugin to the latest v2 connection API.
Also get pipelining working for people who look to chroot as an example
for their own connection plugins

Note: In the latest v2 API, action handles become but chroot doesn't
reliably handle become.  Maybe we need to add a has_become attribute
that the action can display an appropriate error.
2015-09-26 10:00:28 -07:00
Toshio Kuratomi
056a020357 Do not fail if /proc/uptime is not present
This can happen in chroot environments that don't have all of /proc
available
2015-09-26 10:00:28 -07:00
Toshio Kuratomi
ae66d01a33 Document how a command is executed on the remote machine
Helps connection plugin implementors understand how to structure
exec_command()
2015-09-26 10:00:28 -07:00
James Cammarata
6dd38c2a10 Fix parent attribute lookup to be default
Fixes #12526
2015-09-26 11:28:29 -04:00
James Cammarata
a1c38a3fda Adding delegate_to to Blocks 2015-09-26 11:28:01 -04:00
Brian Coca
bb6141ec41 renamed managed_syslog to no_target_syslog 2015-09-26 08:22:32 -04:00
Abhijit Menon-Sen
8251ab2e37 Update outdated comment
Since #12165 was merged, hostnames are properly validated.
2015-09-26 17:32:13 +05:30
Abhijit Menon-Sen
6ff4d40d74 Update outdated comment
We now use "sudo -n" instead of "sudo -k && sudo …"
2015-09-26 17:28:22 +05:30
soarpenguin
1ea66e234f fix logic judgment error. 2015-09-26 15:15:53 +08:00
soarpenguin
2caa52a981 fix no self pointer out of class. 2015-09-26 14:09:56 +08:00
Brian Coca
37a918438b task logging revamp
* allow global no_log setting, no need to set at play or task level, but can be overriden by them
 * allow turning off syslog only on task execution from target host (manage_syslog), overlaps with no_log functionality
 * created log function for task modules to use, now we can remove all syslog references, will use systemd journal if present
 * added debug flag to modules, so they can make it call new log function conditionally
 * added debug logging in module's run_command
2015-09-25 23:57:28 -04:00
James Cammarata
60e1a1f8eb Fix bug in nested lookup where pop is called indiscriminately 2015-09-25 17:16:56 -04:00
Brian Coca
191ae0831d fixed syntax error 2015-09-25 17:15:26 -04:00
Brian Coca
48412c13b2 fixed copy n paste typo on future code 2015-09-25 17:08:03 -04:00
James Cammarata
bb1101498d Clean up typo from cdc6c52 2015-09-25 16:58:27 -04:00
James Cammarata
cdc6c5208e Clean string data run through the template engine
Also strip UnsafeProxy off of low level srings and objects to ensure
they don't cause issues later down the road

Fixes #12513
2015-09-25 16:49:31 -04:00
James Cammarata
ae9b34b1d9 Fix for equality checking in Host to make sure things are like types 2015-09-25 16:49:31 -04:00
Toshio Kuratomi
fa9ea32a86 Fix test of whether a result has a failed host 2015-09-25 12:09:27 -07:00
Brian Coca
1c49e3b842 draft shared service code for modules, part of spliting service module 2015-09-25 11:26:21 -04:00
Toshio Kuratomi
41756be4d3 Update core module ref 2015-09-25 07:49:32 -07:00
Toshio Kuratomi
dcdcd9e9c5 Move is_executable to the toplevel of basic.py so we can utilize it from other code 2015-09-25 07:48:57 -07:00
James Cammarata
ccddda1ebc Merge pull request #12502 from mgedmin/py3k
Python 3: make test_variable_manager_precedence pass
2015-09-25 03:05:02 -04:00
James Cammarata
eb8d7dcd14 Make sure formatted strings don't bomb on tuples
Fixes #12501
2015-09-25 03:01:42 -04:00
James Cammarata
31d5f88a1d Use the task loop to calculate multiple delegated hosts
Due to the way we're now calculating delegate_to, if that value is based
on a loop variable ('item') we need to calculate all of the possible
delegated_to variables for that loop.

Fixes #12499
2015-09-25 01:41:09 -04:00
Toshio Kuratomi
a1428d6bed Remove tmp as a parameter to the connection plugins
There doesn't appear to be anything that actually uses tmp_path in the
connection plugins so we don't need to pass that in to exec_command.
That change also means that we don't need to pass tmp_path around in
many places in the action plugins any more.  there may be more cleanup
that can be done there as well (the action plugin's public run() method
takes tmp as a keyword arg but that may not be necessary).

As a sideeffect of this patch, some potential problems with chmod and
the patch, assemble, copy, and template modules has been fixed (those
modules called _remote_chmod() with the wrong order for their
parameters.  Removing the tmp parameter fixed them.)
2015-09-24 13:33:57 -07:00
James Cammarata
95b371dd60 Use AnsibleFileNotFound instead of AnsibleParsingError when YAML files are not found
And update portions of code to expect the proper error.

Fixes #12512
2015-09-24 16:27:25 -04:00
Toshio Kuratomi
0250beb68a Remove compress option from paramiko connection for now
It's not available on older versions of paramiko such as shipped in RHEL6
2015-09-24 13:18:00 -07:00
James Cammarata
12df9f2e31 Make hostvars more dynamic again to improve performance with large inventories
Fixes #12477
2015-09-24 13:53:44 -04:00
Abhijit Menon-Sen
82b33c381f We don't need even a token timeout here; just poll once
The process is already gone, so there's not going to be any new data
showing up on its stderr; we only want to make sure that we haven't
missed something that was already written. So polling once is enough.
2015-09-24 12:10:16 -04:00
Abhijit Menon-Sen
6e82df451a Clarify select() handling for ssh connections
This change is motivated by an ssh oddity: when ControlPersist is
enabled, the first (i.e. master) connection goes into the background; we
see EOF on its stdout and the process exits, but we never see EOF on its
stderr. So if we ran a command like this:

    ANSIBLE_SSH_PIPELINING=1 ansible -T 30 -vvv somehost -u someuser -m command -a whoami

We would first do select([stdout,stderr], timeout) and read the command
module output, then select([stdout,stderr], timeout) again and read EOF
on stdout, then select([stderr], timeout) AGAIN (though the process has
exited), and select() would wait for the full timeout before returning
rfd=[], and then we would exit. The use of a very short timeout in the
code masked the underlying problem (that we don't see EOF on stderr).

It's always preferable to call select() with a long timeout so that the
process doesn't use any CPU until one of the events it's interested in
happens (and then select will return independent of elapsed time).

(A long timeout value means "if nothing happens, sleep for up to <x>";
omitting the timeout value means "if nothing happens, sleep forever";
specifying a zero timeout means "don't sleep at all", i.e. poll for
events and return immediately.)

This commit uses a long timeout, but explicitly detects the condition
where we've seen EOF on stdout and the process has exited, but we have
not seen EOF on stderr. If and only if that happens, it reruns select()
with a short timeout (in practice it could just exit at that point, but
I chose to be extra cautious). As a result, we end up calling select()
far less often, and use less CPU while waiting, but don't sleep for a
long time waiting for something that will never happen.

Note that we don't omit the timeout to select() altogether because if
we're waiting for an escalation prompt, we DO want to give up with an
error after some time. We also don't set exceptfds, because we're not
actually acting on any notifications of exceptional conditions.
2015-09-24 12:10:16 -04:00
Toshio Kuratomi
03127dcfae remove the stdin return value from connection plugin exec_command() methods
The value was useless -- unused by the callers and always hardcoded to
the empty string.
2015-09-24 08:57:19 -07:00
James Cammarata
9d47eabfa4 Merge pull request #12506 from hyperized/devel
Add Weekday (0-6) as a number and add weeknumber (00-52)
2015-09-24 11:44:39 -04:00
Toshio Kuratomi
24b9e2e6d1 Update extras submodule ref 2015-09-24 07:18:23 -07:00
Gerben Geijteman
4c20964475 Add Weekday (0-6) as a number and add weeknumber (00-52) 2015-09-24 15:05:44 +02:00
Marius Gedminas
56f2a25bff Python 3: there's no 'unicode' 2015-09-24 12:53:48 +03:00
Marius Gedminas
6d4618f46f Python 3: there's no dict.iteritems() 2015-09-24 12:50:00 +03:00
Marius Gedminas
0624797375 Bugfix: if you define a custom __eq__, you must define a __hash__ too
Also, on Python 3 the stock object.__hash__ raises an error ("unhashable
type"), and we have code that uses Host instances as dict keys.
2015-09-24 12:46:06 +03:00
Marius Gedminas
a2bc6b4b26 Bugfix: if you define __eq__, you should define __ne__ too 2015-09-24 12:43:33 +03:00
Marius Gedminas
5d29a2eabd Python 3: shlex.split() wants unicode
On Python 2, shlex.split() raises if you pass it a unicode object with
non-ASCII characters in it.  The Ansible codebase copes by explicitly
converting the string using to_bytes() before passing it to
shlex.split().

On Python 3, shlex.split() raises ('bytes' object has no attribute 'read')
if you pass a bytes object.  Oops.

This commit introduces a new wrapper function, shlex_split, that
transparently performs the to_bytes/to_unicode conversions only on
Python 2.

Currently I've only converted one call site (the one that was causing a
unit test to fail on Python 3).  If this approach is deemed suitable,
I'll convert them all.
2015-09-24 12:36:05 +03:00
Toshio Kuratomi
5d3d9cfe0d Convert to byte strings to avoid UnicodeErrors
Fixes #12488
2015-09-23 15:24:17 -07:00
Brian Coca
de18bcb95f correct typo on error reporting
fixes #12495
2015-09-23 10:11:52 -04:00
Abhijit Menon-Sen
40f608a377 A bit more debugging output
We used to display input chunks earlier anyway, so this isn't making
things more verbose.
2015-09-23 22:35:14 +05:30
Abhijit Menon-Sen
9700d9c04f Fix typo in checking select results
It's possible for more than one fd to be set, so 'elif' is obviously not
the right thing to use.
2015-09-23 22:32:15 +05:30
James Cammarata
1164e83477 Remove unnecessary calls to save inventory restrictions since 81bf88b 2015-09-23 12:18:09 -04:00
Toshio Kuratomi
89a78ba16e Update submodule refs 2015-09-23 08:40:59 -07:00
James Cammarata
9e734df0ec Conditionally poll longer if we're still waiting for an auth prompt 2015-09-23 11:20:11 -04:00
Toshio Kuratomi
5f0f5363b6 Merge pull request #12487 from mgedmin/py3k
Fix one more failing test on Python 3
2015-09-23 08:18:17 -07:00
James Cammarata
2898e000a0 Don't use the connection timeout for the select poll timeout 2015-09-23 11:13:12 -04:00
Abhijit Menon-Sen
587054db2a Send initial data before calling select whenever possible
Without this, we could execute «ssh -q ...» and call select(), which
would timeout after the default 10s, and only then send initial data.
(This is a relic of the earlier change where we always ran ssh with
-vvv, so the situation where it would sit quietly never happened in
practice; but this would have been the right thing to do even then.)
2015-09-23 20:09:50 +05:30
James Cammarata
c9a004227e Improve error catching from malformed playbook data
Fixes #12478
2015-09-23 08:56:36 -04:00
James Cammarata
e8e1d9f6fb Apply --limit to inventory in adhoc commands
Fixes #12473
2015-09-23 08:28:38 -04:00
Marius Gedminas
95e655eb67 Python 3: there's no basestring
Fixes one failing test.

The long series of module_utils/basic.py fixes were all because
module_utils/basic is imported in ansible/inventory/script.py.
2015-09-23 10:04:26 +03:00
Marius Gedminas
2c4982b58d Python 3: there's no itertools.imap
Because the builtin map() acts like an iterator already.
2015-09-23 10:04:26 +03:00
Marius Gedminas
6708d56a21 Python 3: avoid long integer literals
Even Python 2.4 automatically promotes int to long.
2015-09-23 10:04:25 +03:00
Marius Gedminas
f5d4935197 Python 3: treat python as a function in module_utils/basic.py
NB: we can't use 'from __future__ import print_function', but luckily
print(one_thing) works fine on both Python 2 and Python 3 without that.
2015-09-23 10:04:25 +03:00
Marius Gedminas
e71a986e16 Python 3: avoid octal constants in module_utils/basic.py 2015-09-23 10:04:25 +03:00
Marius Gedminas
d2bec7f81f Python 3: avoid "except ..., e:" in module_utils/basic.py
Make the code compatible with Pythons 2.4 through 3.5 by using
sys.exc_info()[1] instead.

This is necessary but not sufficient for Python 3 compatibility.
2015-09-23 10:04:25 +03:00
James Cammarata
65630d2ce1 Fixing one more bug related to staticmethods in LookupBase 2015-09-23 02:33:32 -04:00
James Cammarata
cbbb270761 Cleanup bug from moving base lookup methods to staticmethods 2015-09-23 02:26:19 -04:00
Abhijit Menon-Sen
ac98fe9e89 Implement ssh connection handling as a state machine
The event loop (even after it was brought into one place in _run in the
previous commit) was hard to follow. The states and transitions weren't
clear or documented, and the privilege escalation code was non-blocking
while the rest was blocking.

Now we have a state machine with four states: awaiting_prompt,
awaiting_escalation, ready_to_send (initial data), and awaiting_exit.
The actions in each state and the transitions between then are clearly
documented.

The check_incorrect_password() method no longer checks for empty strings
(since they will always match), and check_become_success() uses equality
rather than a substring match to avoid thinking an echoed command is an
indication of successful escalation. Also adds a check_missing_password
connection method to detect the error from sudo -n/doas -n.
2015-09-23 01:55:00 -04:00
Abhijit Menon-Sen
840a32bc08 Reorganise ssh.py to cleanly separate responsibilities
The main exec_command/put_file/fetch_file methods now _build_command and
call _run to handle input from/output to the ssh process. The purpose is
to bring connection handling together in one place so that the locking
doesn't have to be split across functions.

Note that this doesn't change the privilege escalation and connection IO
code at all—just puts it all into one function.

Most of the changes are just moving code from one place to another (e.g.
from _connect to _build_command, from _exec_command and _communicate to
_run), but there are some other notable changes:

1. We test for the existence of sshpass the first time we need to use
   password authentication, and remember the result.
2. We set _persistent in _build_command if we're using ControlPersist,
   for later use in close(). (The detection could be smarter.)
3. Some apparently inadvertent inconsistencies between put_file and
   fetch_file (e.g. argument quoting, sftp -b use) have been removed.

Also reorders functions into a logical sequence, removes unused imports
and functions, etc.

Aside: the high-level EXEC/PUT/FETCH description should really be logged
from ConnectionBase, while individual subclasses log transport-specific
details.
2015-09-23 01:55:00 -04:00
James Cammarata
95c6fe88e4 Fix handling of conditional vars_files which contain variables
Fixes #12484
2015-09-23 01:26:24 -04:00
Toshio Kuratomi
c83f51b7f2 Some LookupBase cleanups:
* Make LookupBase an abc with required methods (run()) marked as an
  abstractmethod
* Mark methods that don't use self as @staticmethod
* Document how to implement the run method of a lookup plugin.
2015-09-22 16:19:36 -07:00
Toshio Kuratomi
049952fa50 Update submodule refs. 2015-09-22 14:01:53 -07:00
James Cammarata
1e7fd2196d Fixing synchronize + delegate_to user bug
Fixes #12464
2015-09-22 16:06:52 -04:00
James Cammarata
3ffc2783c4 Don't bomb out on handlers with undefined variables in their names 2015-09-22 12:42:02 -04:00
Toshio Kuratomi
4b0d52d2cb Merge pull request #12420 from ansible/win_prefix_modules
Fix for user defined modules not overriding modules from core.
2015-09-22 09:16:38 -07:00
James Cammarata
1076155d8d When failing because of vars_files templating, try and bubble up the file/line info 2015-09-22 12:13:55 -04:00
Toshio Kuratomi
18e2ee16ef Fix for user defined modules not overriding modules from core.
This fix takes into account that powershell modules are somewhat
different than regular modules and have to be kept separate.
2015-09-22 09:07:37 -07:00
Toshio Kuratomi
f61fb9787d Update submodule refs 2015-09-22 08:59:10 -07:00
Rene Moser
b43939dfd6 cloudstack: make tags handling idempotence
Credits to @jeffersongirao, who provided the patch.
2015-09-22 16:12:35 +02:00
James Cammarata
c30e464388 Additional tweaks to callback output for delegate_to 2015-09-22 09:25:38 -04:00
James Cammarata
513619867a Show delegated-to host in callback message
Fixes #12465
2015-09-22 08:45:04 -04:00
Rene Moser
efd122c2f0 cloudstack: add returns_to_int return handling into utils
It is not uncommon that the API returns string for int values e.g. ports in listFirewallRules or listPortForwardings,
2015-09-22 14:44:08 +02:00
Rene Moser
c9a3801a25 cloudstack: common argument_spec and requried_together to utils 2015-09-22 14:36:43 +02:00
James Cammarata
f563b22446 Merge pull request #12461 from mgedmin/py3k
Python 3: there's no basestring
2015-09-22 03:11:43 -04:00
James Cammarata
d2949f5449 Merge pull request #12463 from mgedmin/fix-ansible-doc
Fix option descriptions in ansible-doc output
2015-09-22 03:10:59 -04:00
James Cammarata
0fb4a6a67b Tweak to the way new host variables are created for delegated hosts 2015-09-22 03:03:21 -04:00
Marius Gedminas
339790adc4 Fix option descriptions in ansible-doc output
Fixes #12462.
2015-09-22 10:00:33 +03:00
James Cammarata
18adfc6d1a Set some default vars on hosts created for delegate_to connections 2015-09-22 02:35:01 -04:00
James Cammarata
a22f7b883d Restrict role param vars to tasks within that role
Fixes #12460
2015-09-22 02:14:18 -04:00
Marius Gedminas
fc0dcc3947 Python 3: there's no basestring
Fixes one failing test.

Now technically a filename can be a bytestring, even on Python 3.  I
hope this is unlikely for Ansible.
2015-09-22 08:42:33 +03:00
James Cammarata
ecf7d8c9ee Fix relative path bug in copy action
Without rebreaking #12055

Fixes #ansible-modules-core/2098
2015-09-22 01:31:03 -04:00
James Cammarata
53794b692c Merge pull request #12457 from ansible/warn-if-core-modules-not-present
Detect if core modules aren't installed and warn if that is the  case
2015-09-21 21:15:54 -04:00
Toshio Kuratomi
627f9d73ba Detect if core modules aren't installed and warn if that is the case
Fixes #11206
2015-09-21 12:31:51 -07:00
Brian Coca
d27b73e7b5 fixed case in which boto3 is present but module is not using it yet 2015-09-21 15:16:07 -04:00
James Cammarata
cb7060c9fe Allow undefined var errors to bubble up when templating vars_files in certain conditions
Follow up to 8769f03c, which allows the undefined var error to be raised
if we're getting vars with a full context (play/host/task) and the host
has already gathered facts. In this way, vars_files containing variables
that fail to be templated are not silently ignored.
2015-09-21 11:57:37 -04:00
Brian Coca
f96255f7fd fixed typo 2015-09-21 10:10:21 -04:00
James Cammarata
86566e691a Merge pull request #12447 from mgedmin/py3k
Python 3: there is no 'basestring'
2015-09-21 09:39:17 -04:00
James Cammarata
8769f03c16 Also catch AnsibleUndefinedVariable errors when templating vars_files names
Fixes #12449
2015-09-21 09:35:06 -04:00
Toshio Kuratomi
2a614c1c0f Close module file once we're done reading from it 2015-09-21 01:46:29 -07:00
Marius Gedminas
9cdb6ebae3 Python 3: there is no 'basestring'
This fixes a failing unit test.

In actual use (which is still quite far), I'm not sure if bytes ->
unicode conversion should be done here (in which case the code will fail
with an AttributeError: 'bytes' object has no attribute 'readlines'), or
inside self._connection.exec_command() (in which case my change is
correct).
2015-09-21 08:48:59 +03:00
Victor Salgado
20bbd66e85 Use dict.get() 2015-09-20 22:54:02 -03:00
James Cammarata
65bf14cbb0 Merge pull request #12431 from hslee16/devel
Stops using _groups_list to check for host when using 'add_host'
2015-09-20 18:17:02 -04:00
James Cammarata
88e1aa94fa Add play context vars to list of variables before post validation
Fixes #12437
2015-09-19 21:51:24 -04:00
James Cammarata
05f6e76407 Template handler names before checking to see if they need to run
Fixes #12427
2015-09-18 18:54:48 -04:00
James Cammarata
72769d1899 Merge pull request #12432 from mgedmin/py3k
Python 3: there's no xrange
2015-09-18 15:33:08 -04:00
James Cammarata
37f2cbc429 Merge pull request #12436 from amenonsen/ranges
Support «hosts: foo[1:]» and add tests for split/apply_subscript
2015-09-18 15:32:15 -04:00
James Cammarata
1f5584aa5b Refactoring delegate_to code
Now, instead of relying on hostvars on the executor side, we compile
the vars for the delegated to host in a special internal variable and
have the PlayContext object look for things there when applying task/
var overrides, which is much cleaner and takes advantage of the code
already dealing with all of the magic variable variations.

Fixes #12127
Fixes #12079
2015-09-18 15:25:10 -04:00
James Cammarata
fa69e8ebb8 Fixing some bugs in _compute_delegate() in TaskExecutor
* Clearing interpreter settings from variables, so those set for the
  original host aren't incorrectly applied to the delegated to host
* Fixed incorrect string for remote user in delegated hosts hostvars
* Properly looking for multiple possiblities in the delegated-to hosts
  hostvars (ansible_ssh_host vs. ansible_host)
2015-09-18 15:25:10 -04:00
Peter Sprygada
e45b71d6cd added new module object to vca 2015-09-18 13:45:37 -04:00
Abhijit Menon-Sen
2fcdb37e7b Support «hosts: groupname[1:]» notation (~= 'the rest of the group') 2015-09-18 22:28:34 +05:30
Brian Coca
aca83b15e5 Merge pull request #12425 from privateip/devel
initial add of vca common module
2015-09-18 11:24:54 -04:00
Brian Coca
11707576a3 fix for AIX network facts
fixes #12434
2015-09-18 10:43:53 -04:00
Brian Coca
d7b61db6dc made boto3 non mandatory 2015-09-18 08:05:33 -04:00
Toshio Kuratomi
fdb1c14004 Update the submodule pointers 2015-09-18 04:49:30 -07:00
Petr Mifek
27f779a7cc Small clean up and refactor of the rsync target ipv6 observing formatter for synchronize action. 2015-09-18 11:46:33 +02:00
Marius Gedminas
baf9320369 Python 3: there's no xrange
Use six.moves.range instead (aliased to xrange on Python 2, aliased to
range on Python 3).

Also I couldn't resist replacing the elaborate chr/ord/randrange dance
with the simpler random.choice(string.ascii_lowercase) that was already
used elsewhere in the Ansible codebase.
2015-09-18 08:52:26 +03:00
Alex Lee
cf289191e5 return None if group does not exist in inventory groups 2015-09-17 15:58:10 -07:00
Petr Mifek
6f3f4dff7a Change synchronize module plugin to be backwards compatible with RSync 2.6.9 with regard to handling IPv6 addresses. 2015-09-17 23:19:11 +02:00
James Cammarata
cc6627cdd6 Remove custom json encoder cleaner and strip proxy var stuff out before encoding
Fixes #12349
2015-09-17 16:04:47 -04:00
James Cammarata
c95d4ca05f Properly assign search path to environment.loader in template lookup
Same fix as was applied in f162990c to the action plugin

Fixes #12355
2015-09-17 14:47:20 -04:00
James Cammarata
bde5ed9672 Catch worker errors that may be subclassed on others that lead to incorrect exits 2015-09-17 14:46:53 -04:00
Peter Sprygada
8f43d222c0 initial add of vca common module 2015-09-17 14:41:53 -04:00
James Cammarata
053c41e79d Fix typo in ansible module_utils import from galaxy code 2015-09-17 14:25:48 -04:00