Commit Graph

395 Commits (0a311f66690b6103732a29e24185ba436bea70e0)

Author SHA1 Message Date
Brian Coca c50cf22d52 deal with null/none connections
fixes #23621
pushed 'connection resolution' to play_context
override fieldattribute getter
9 years ago
Toshio Kuratomi 1c05ed7951 Fix circular import with unsafe_proxy, template, and vars
template/__init__.py imported unsafe_proxy from vars which caused
vars/__init__.py to load.  vars/__init__.py needed template/__init__.py
which caused issues.  Loading unsafe_proxy from another location fixes
that.
9 years ago
Brian Coca 31045d58c6 added versions to dep notices (#24019)
* added versions to dep notices

* pep7

* string
9 years ago
Brian Coca e29dc49a49 moved to exceptions for basic skip/fails
better handling of checkmode and async
fix test to follow new flow control
9 years ago
Matt Davis 02ed223d49 template hostvars for set_host_overrides (#23839)
* fixes #23586
* temporary solution until connection-specific vars are handled by play_context
9 years ago
Brian Coca b4b96143fe also skip polling when async failed 9 years ago
Brian Coca 952e842720 less code 9 years ago
smaftoul 9812d211e7 typo: psuedo -> pseudo (#23177) 9 years ago
Toshio Kuratomi 2fff690caa Update module_utils.six to latest (#22855)
* Update module_utils.six to latest

We've been held back on the version of six we could use on the module
side to 1.4.x because of python-2.4 compatibility.  Now that our minimum
is Python-2.6, we can update to the latest version of six in
module_utils and get rid of the second copy in lib/ansible/compat.
9 years ago
Matt Martz 3164e8b561 E501 fixes (#22879) 9 years ago
Brian Coca dd8d699981 namespace facts (#18445)
* namespace facts

always namespace facts, make the polluting of 'main' conditional on config

* updated to 2.4

* Update intro_configuration.rst
9 years ago
Brian Coca 7ad6ce7ea1 moved network module magic from hardcoded to conf 9 years ago
Toshio Kuratomi 89bf14e467 Change warning message as advised by bcoca 9 years ago
Toshio Kuratomi 49db03c384 Fix for traceback when we encounter non-utf8 characters in diff
We can diff non-utf8 files (as part of copy, for instance) but when we
try to turn the bytes into text for display, the characters cause
a traceback.  Since diff output is only informational, we can replace
those problematic bytes with replacement characters.  We do not want to
do this to other fields because those fields may be used inside of the
playbook (for templating another variable or matching in a conditional).

Fixes #21803
Fixes #21804
9 years ago
Brian Coca 9ac697a155 simplified persistent connection quandry 9 years ago
James Cammarata 3d65482927 Stash post-validated fields of the task in the TaskResult
This allows us to have a snapshot of the fields, which we can restore
on the pre-fork side so as to avoid having to re-template fields.
9 years ago
Peter Sprygada 48b02336ab code clean of old code from network modules updates (#21469)
* removes unused code
* removes module_utils/local.py
* removes plugins/action/network.py
* removes action_handler from connection plugins
* removes code to use action_handler in task_executor
* updates action plugins to subclass from normal
9 years ago
Brian Coca e9b009510f added fixme note 9 years ago
Peter Sprygada 21157aa1bc loads action handler for a group of network modules (#21194)
* loads action handler based on module group prefix for network modules
9 years ago
Brian Coca c86a17b7a0 refactoring async
- centralized skipping
- also fixed module name broken by previous refactor
- let action modules handle async processing
- moved async into base action class's module exec
- action plugins can now run final action as async
- actually skip copy if base skips
- fixed normal for new paths
- ensure internal stat is never async
- default poll to 10 as per docs
- added hint for callback fix on poll
- restructured late tmp, now a pipeline query
- moving action handler to connection as networking does
- fixed network assumption invocation is always passed
- centralized key cleanup, normalized internal var
- _supress_tmpdir_delete now in _ansible_xxx and gets removed from results
- delay internal key removal till after we use em
- nicer tmp removing, using existing methods
- moved cleanup tmp flag to mking tmp func
9 years ago
Brian Coca e6f92bc3a9 reworded conditional skipping to not imply error
fixes #19068
9 years ago
Peter Sprygada ad99d52679 adds feature to allow connection to set action plugin (#18762)
Connection plugin can define default action plugin to use by providing
action_handler instance variable.  This will override the default
action plugin normal
9 years ago
Carlos E. Garcia 0b8011436d minor spelling changes 9 years ago
Brian Coca 4a325b5ea2 fixed issue with when/with error deferment
now it issues correct error (loop) when conditional depends on loop
compliment fixes #16222
9 years ago
James Cammarata 26ec2ecfce Adding a persistent connection utility 9 years ago
James Cammarata 57cf5e431c Catch loop eval errors and only raise them again if the task is not skipped
This should help on issues like #16222.
9 years ago
Brian Coca 432633e4c1 fix for check_mode/async interaction
fixes #18110
9 years ago
Brian Coca 9bdde13126 fixes to ansible_search_path
now gets basedir (no need to frontload as dwim already does that)
added comment about basedir to search_path usage to avoid dupes
9 years ago
Brian Coca 7d9d009189 avoid errors when dynamic role 9 years ago
James Cammarata 657506cddd Ensure the "attempts" key is set in the final result for do/until loops
Fixes #17258
9 years ago
Matt Davis e7819609ce swallow errors during async polling (#17760)
also use connection reset on exceptions if available (eg, prevent reuse of "stuck" WinRM connections due to reboot/NIC bounce/etc)
9 years ago
Brian Coca 943f4ebccf undefined var should fail 'label' setting (#17675) 9 years ago
James Cammarata 23651b657e Create a raw lookup for hostvars that does not template the data
When using hostvars to get extra connection-specific vars for connection
plugins, use this raw lookup to avoid prematurely templating all of the
hostvar data (triggering unnecessary lookups).

Fixes #17024
9 years ago
Brian Coca 4e60f23198 remove bare variable support from loops (#17519)
* remove bare variable support from loops

* Added new 'removed deprecated' section to changelg

also added removed items from this PR and others
9 years ago
Toshio Kuratomi 6117e1946e Check controlpersist (#17443)
* Add a new config option to cache the check for controlpersist on the
control machine.

Fixes #15844

* Remove the option and make the behavior the default

* Make the check for controlpersist cache its status per-ssh executable
9 years ago
John R Barker 8a3b520f70 Add missing space in loop variable reuse message (#17516) 9 years ago
James Cammarata d1a7e07ccc Fixing another logic issue related to include_role changes 9 years ago
Andrea Tartaglia dd71469bb7 Added option to change ssh executable path (#17377) 9 years ago
Toshio Kuratomi 4ed88512e4 Move uses of to_bytes, to_text, to_native to use the module_utils version (#17423)
We couldn't copy to_unicode, to_bytes, to_str into module_utils because
of licensing.  So once created it we had two sets of functions that did
the same things but had different implementations.  To remedy that, this
change removes the ansible.utils.unicode versions of those functions.
9 years ago
Brian Coca ff34f5548d Dynamic role include (#17401)
* dynamic role_include

* more fixes for dynamic include roles

* set play yfrom iterator when dynamic

* changes from jimi-c

* avoid modules that break ad hoc

TODO: should really be a config
9 years ago
Brian Coca f39799fbcd implemented loop pausing (#17289)
* implemented loop pausing

- added loop pause to changelog
- only pause between iterations, avoid 1st/last
- added example to docs

* fixed note placement

* else

* added docs for loop_control: label
9 years ago
James Cammarata cddf1cf98e Some further cleanup in the meta branch
* adds squashing to objects, which allows them to be squashed down
  to a final "view" before post_validate to avoid expensive evaluations
  of parent attributes
9 years ago
Andrew Gaffney f65a3ce547 Support for specifying item label in a loop (#17294) 9 years ago
Brian Coca bd9094c925 include_role (role revamp implementation) (#17232)
* attempt #11 to role_include

* fixes from jimi-c

* do not override load_data, move all to load

* removed debugging

* implemented tasks_from parameter, must break cache

* fixed issue with cache and tasks_from

* make resolution of from_tasks prioritize literal

* avoid role dependency dedupe when include_role

* fixed role deps and handlers are now loaded

* simplified code, enabled k=v parsing

used example from jimi-c

* load role defaults for task when include_role

* fixed issue with from_Tasks overriding all subdirs

* corrected priority order of main candidates

* made tasks_from a more generic interface to roles

* fix block inheritance and handler order

* allow vars: clause into included role

* pull vars already processed vs from raw data

* fix from jimi-c blocks i broke

* added back append for dynamic includes

* only allow for basename in from parameter

* fix for docs when no default

* fixed notes

* added include_role to changelog
9 years ago
Toshio Kuratomi 040a38171a Clean up task_executor for python3 (#17219)
ran task_executor through python-modernize and then made changes to the
code pointed out by it:

* Most places where we looped through dict.keys() changed to
      for key in dict:
  Using keys() in python2 creates a list() of keys.  For iterating, we
  can iterate over the dict itself and we'll be handed back each key.
  In python3, doing it this way does not create a new list and thus is
  more memory efficient.
* In one place, use:
      for key in list(dict.keys()):
  because we're deleting elements from the dictionary inside of the
  loop.  So we really do need to iterate over a separate list of the
  keys to avoid modifying the dictionary that we're iterating over.
  (Fixes Python3 bug)
* In one place, change the order of an if-elif-else tree so that the
  most frequent cases are evaluated first. (Optimization)
9 years ago
Brian Coca 5fe9d3c3d5 make parsed param private and explicit (#17104)
* make parsed param private and explicit

* fixed missed parsed
9 years ago
David Shrewsbury bf8c871801 Fix async logic when parsing fails (#17091)
We want to NOT consider the async task as failed if the result is
not parsed, which was the intent of:

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

However, the logic doesn't actually do that because we default
the 'parsed' value to True. It should default to False so that
we continue waiting, as intended.
9 years ago
James Cammarata e244895174 Avoid copying task parents in TaskExecutor
As Block.copy() is potentially expensive, avoid copying the parent
structure of tasks in TaskExecutor.
9 years ago
James Cammarata d2b3b2c03e Performance improvements 9 years ago
Brian Coca ce282e9373 correctly detect action
named matched only cause i set it to the same in my tests
fixes #14857
9 years ago
Toshio Kuratomi 38ccd11cce Fix from @jimi-c to use task_vars when polling async tasks. (#17003)
This is needed so that async_status can use ansible_python_interpreter
for the host being contacted.

Fixes #14101
9 years ago
Matt Davis 746ea64d30 fix for unspecified retries on until + test (#16963)
fixes #16907
9 years ago
Brian Coca ee815bc9a4 fxed typo 10 years ago
Brian Coca 3c39bb5633 fixed lookup search path (#16630)
* fixed lookup search path

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

* added missing os import

* renamed as per feedback

* fixed missing rename in first_found

* also fixed first_found

* fixed import to match new error class

* fixed getattr ref
10 years ago
Monty Taylor 229d8f6b21 Don't treat parsing problems as async task timeout (#16458)
* Don't treat parsing problems as async task timeout

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

* Add comment explaining not bailing out of loop

* Return different error when result is unparseable

* Remove extraneous else
10 years ago
Matt Clay 292785ff2b Parse async response in async action. (#16534)
* Parse async response in async action.
* Add async test for non-JSON data before module output.
* Fix existing async unit test.

Resolves #16156
10 years ago
James Cammarata 948682dbe2 Fix off-by-one error with retries
Fixes #16408
10 years ago
Toshio Kuratomi facea1ff0c Remove unneeded pass 10 years ago
nitzmahone ece1ed09d5 fix for psuedo-connection hostvars not propagating to connection
(mostly done by jimi-c, tested working)
10 years ago
Toshio Kuratomi b75895df9b Fix the error handling for loop squashing to restore the name argument into the task args 10 years ago
James Cammarata 6f6456dff5 Adding a deprecation message for accelerated mode 10 years ago
James Cammarata 4f0be29d65 Reworking retry/until logic to fix bugs
Prior to this patch, the retry/until logic would fail any task that
succeeded if it took all of the alloted retries to succeed. This patch
reworks the retry/until logic to make things more simple and clear.

Fixes #15697
10 years ago
Toshio Kuratomi b4e78caf25 Merge pull request #15825 from abadger/fix-squashing-traceback
If we can't squash for any reason, then simply do not optimize the items loop.
10 years ago
Toshio Kuratomi 292f0ed0d6 If we can't squash for any reason, then simply do not optimize the items loop.
Also add more squashing testcases

Fixes #15649
10 years ago
James Cammarata 0d7530e6da Change error about loop variable in use to a warning 10 years ago
Brian Coca fb7940fc50 check that variable first
before using string methods to check for magic interpreter var
10 years ago
Toshio Kuratomi 2fd7f194c8 Convert byte strings to unicode strings in our task results (#15581)
Fixes #15367
10 years ago
James Cammarata 6eefc11c39 Make the loop variable (item by default) settable per task
Required for include+with* tasks which may include files that also
have tasks containing a with* loop.

Fixes #12736
10 years ago
James Cammarata d358a22542 Modification to 347b282 to prevent running the lookup with empty terms
Fixes #15258
10 years ago
Brian Coca 5b11494437 python3 compatiblity
remove use of basestring
deal with configparser
10 years ago
Abhijit Menon-Sen 1b242ffb89 Merge pull request #15111 from xiaket/devel
complete the docstring. Fixed #14794
10 years ago
夏恺(Xia Kai) f9a9e5e1b9 complete the docstring. Fixed #14794
Signed-off-by: 夏恺(Xia Kai) <xiaket@gmail.com>
10 years ago
James Cammarata 09e5f0578a Don't always insert failed in the results (again) 10 years ago
James Cammarata ccf646665b Revert "Removing explicit setting of failed/failed_when"
This reverts commit 4e528e9535.
10 years ago
James Cammarata 4e528e9535 Removing explicit setting of failed/failed_when 10 years ago
nitzmahone dbff3a6bbc Fix blind override in failed_when
caused all task failures to be success
10 years ago
Brian Coca 9318727021 corrected changed_when handling 10 years ago
Brian Coca 7067bb32b8 make all conditionals lists
this brings them to equivalence with when:
fixes #13905
10 years ago
Brian Coca 71402abf21 only do squash when 'squashable field' present 10 years ago
Brian Coca 67d5b77898 added package to special 'squashable' fields
apt has it as alias, this should fix https://github.com/ansible/ansible-modules-core/issues/3145
10 years ago
Brian Coca 512d3dd621 with_ loops always should want a list 10 years ago
Brian Coca 34541b4e5e preserve no_log for async also 10 years ago
James Cammarata e02b98274b issue callbacks per item and retry fails
- now workers passes queue to task_executor so it can send back events per item and on retry attempt
- updated result class to pass along events to strategy
- base strategy updated to forward new events to callback
- callbacks now remove 'items' on final result but process them directly when invoked per item
- new callback method to deal with retry attempt messages (also now obeys nolog)
- updated tests to match new signature of task_executor

fixes #14558
fixes #14072
10 years ago
James Cammarata 6cf6130468 Fixing/cleaning up do/until logic in TaskExecutor
* Fixes bug where the task was not marked as failed if the number of
  retries were exceeded (#14461)
* Reorganizing logic to be a bit cleaner, and so retrie messages are
  shown before sleeping (which makes way more sense)

Fixes #14461
Fixes #14580
10 years ago
Brian Coca d54d9dabe9 added specific info to deprecation message
should now show actual variable that is undefined
fixes #14526
10 years ago
Brian Coca 347b28252a allow skipping tasks due to undefined var
mimic 1.x behaviour but give out big deprecation message, not only
for missing attribute but any undefined error.
10 years ago
James Cammarata 2adddac94c Catch exceptions during module execution so they don't fail the worker
Fixes #14120
10 years ago
Toshio Kuratomi 0e410bbc8a Squashing was occuring even though pkgs didn't have a template that would be affected by squash
This broke other uses of looping (looping for delegate_to in the
reported bug)

Fixes #13980
10 years ago
James Cammarata 1733d434d1 Fix with loop + delegate issues
* Don't re-use the existing connection if the remote_addr field of
  the play context has changed
* When overriding variables in PlayContext (from task/variables),
  don't set the same attribute based on a different variable name
  if we had already previously set it from another variable name

Fixes #13880
10 years ago
James Cammarata c42484a029 Minor cleanup when reassigning play context to reused connections
* Relocate the assignment of the host address to the remote_addr field
  in the play context, which was only done when the connection was created
  (it's now done after the post_validate() is called on the play context)
* Make the assignment of the play context to the connection an else, since
  it's not required if the connection is not reused
10 years ago
Karthik T c4cbeeffa8 Fixes #13763 Update connections _play_context on every iteration
If this isnt updated, the _connection is reused, and thus has an outdated _play_context
This results in outdated `success_key` and `prompt` causing issues if sudo is run in a loop
Refer to the issue #13763 for more debugging and details
10 years ago
Brian Coca d3deb24ead output color is now configurable 10 years ago
James Cammarata 3ec0104128 Fixing bugs in conditional testing with until and some integration runner tweaks 10 years ago
James Cammarata a3dcb910b8 Fixing bugs with {changed,failed}_when and until with registered vars
* Saving of the registered variable was occuring after the tests for
  changed/failed_when.
* Each of the above fields and until were being post_validated too early,
  so variables which were not defined at that time were causing task
  failures.

Fixes #13591
10 years ago
James Cammarata e546219426 Revert "Enable host_key checking at the strategy level"
This reverts commit 1a6d660d7e285cceec474952a33af4d8dffd0a8d.
10 years ago
James Cammarata e5c2c03dea Enable host_key checking at the strategy level
Implements a new method in the ssh connection plugin (fetch_and_store_key)
which is used to prefetch the key using ssh-keyscan.
10 years ago
Toshio Kuratomi 0434644d12 Transform exceptions into ansible messages via to_unicode instead of str to avoid tracebacks.
Fixes #13385
10 years ago
James Cammarata 65747285a4 Properly check for prompting state when re-using ssh connection
Fixes #13278
10 years ago
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. 10 years ago
Brian Coca 478c6c756a marked spot that should send per item reulsts 10 years ago
James Cammarata 78e4f176e6 Return skipped/failed async results directly
Fixes #13205
10 years ago
Marius Gedminas 66347c9449 Fix NameError when using loops
vars_copy disappeared in 3d1255d190.

Fixes #13213.
10 years ago
James Cammarata 3d1255d190 Don't update job vars too early when getting loop items in TaskExecutor
Fixes #13113
10 years ago
James Cammarata b2b0fa8d13 Changed do/until failed color
Fixes #13130
10 years ago
James Cammarata 94c20c9ac6 Cleanup failed/changed logic in TaskExecutor
Fixes #12980
10 years ago
Toshio Kuratomi 62979efa14 Finish up plugin porting to global display
Also remove display = display which does nothing
10 years ago
Toshio Kuratomi 186e034515 Move the rest of executor code to global display 10 years ago
Toshio Kuratomi e45ce871a7 Fix for traceback when neither name nor pkg are in the module params 10 years ago
James Cammarata a99f2fd52f Save delegated vars in result for use in callback methods
Fixes #13014
10 years ago
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.
10 years ago
Toshio Kuratomi 1a04f354f3 For with_first_found loops, set undefined variables to fall through rather than failing the task 10 years ago
James Cammarata 63c47fb271 Fixing up performance 10 years ago
Toshio Kuratomi 4f6d4c6bf6 Set task_action when the action does not need to be templated
Fixes #13042
10 years ago
Toshio Kuratomi 483491ddfb template the task_action before checking whether to optimize with_item loops for it.
Fixes the second problem discovered in #12976
10 years ago
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
10 years ago
James Cammarata a5bd92ca4b Merge branch 'devel_fix_debug_var' of https://github.com/Yannig/ansible into Yannig-devel_fix_debug_var 10 years ago
James Cammarata 479cbfc63c Don't immediately fail on PlayContext setup
As we may end up skipping the task due to conditionals.

Fixes #12774
10 years ago
Yannig Perré 1febf7cb88 Fix for issue #12952: this code interfere with debug+var and seems to be unnecessary. 10 years ago
James Cammarata 3fc2209ca0 Fixing retry/until logic and default value for retries
Fixes #12928
Fixes #12929
10 years ago
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.
10 years ago
James Cammarata 86de1429e5 Cleaning up FIXMEs 10 years ago
Brian Coca fc3a44485b skip errors on conditional if task is include
fixes #12843
10 years ago
James Cammarata ec56b29ba4 Fix setting of interpreter values for delegated hosts
Fixes #12772
10 years ago
Victor Salgado c5c5f3bf7a Revert back to copying self._task.args 10 years ago
Victor Salgado 0e671baa33 Fix typo 10 years ago
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
10 years ago
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. 10 years ago
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
10 years ago
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
10 years ago
Brian Coca ba4afcbbb6 added no_log to results
normalized outputs to use display class
cleaned up unused imports
10 years ago
James Cammarata 8ef78b1cf8 Fixing accelerated connection plugin 10 years ago
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
10 years ago
Brian Coca de18bcb95f correct typo on error reporting
fixes #12495
10 years ago
James Cammarata 88e1aa94fa Add play context vars to list of variables before post validation
Fixes #12437
10 years ago
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
10 years ago
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)
10 years ago
James Cammarata cc6627cdd6 Remove custom json encoder cleaner and strip proxy var stuff out before encoding
Fixes #12349
10 years ago
Abhijit Menon-Sen 575a8b8c77 Merge Host.ipv[46]_address into .address
The earlier distinction was never used; .ipv6_address was always a copy
of .ipv4_address, and the latter was always used to set the remote_addr
field in the PlayContext.

Also uses the canonical ansible_host/ansible_port names when setting the
address and port from variables.
10 years ago
James Cammarata a7e1113b26 Removing FIXME comment which is no longer required 10 years ago
James Cammarata 60c139e482 Fix logic for changed/failed_when + retry/until loops
Fixes #11809
10 years ago
James Cammarata 8e664ad226 Fix delegate_to localhost vs. 127.0.0.1 (and ::1) 10 years ago
James Cammarata 0c5bbe3c32 Use the original (un-templated) args for include params
Fixes #12314
10 years ago
James Cammarata be7bd392cb Fix unreachable host detection and have plays continue after unreachable failures
Fixes #12284
10 years ago
Brian Coca 0dbebfddaa Revert "remove closing connections after every task, this goes against conneciton caching and was not expected behaviuor nor inhertited from v1"
needed for winrm, disabled closing connections in ssh to avoid issues with that persistance, need to normalize all this in future

This reverts commit 23a22397bf.
10 years ago
James Cammarata 30399edada Use UnsafeProxy for lookup results too
Also fixes a couple of bugs that popped up when using the proxy class
10 years ago
Brian Coca 23a22397bf remove closing connections after every task, this goes against conneciton caching and was not expected behaviuor nor inhertited from v1 10 years ago
James Cammarata 8774ff5f57 Make sure PlayContext is copied when iterating in a with_ loop 10 years ago
Toshio Kuratomi 1ae28f606b Refactor to replace filter and lambda with a generator expression 10 years ago
Marius Gedminas 823677b490 Replace .iteritems() with six.iteritems()
Replace .iteritems() with six.iteritems() everywhere except in
module_utils (because there's no 'six' on the remote host).  And except
in lib/ansible/galaxy/data/metadata_template.j2, because I'm not sure
six is available there.
10 years ago
James Cammarata 057712c129 Also move action/connection plugins to shared plugin loader code
Fixes #12099
10 years ago
James Cammarata 266a069a73 Merge pull request #12107 from TravisPaul/devel
Update "smart" transport to handle Sun_SSH_1.5 on SmartOS
10 years ago
Marius Gedminas 0c6ce31f76 Use 'except ... as' syntax
This syntax works on Python 2.6 through 3.x.  lib/ansible/module_utils
(and lib/ansible/modules) need to support Python 2.4, so I didn't touch
those.
10 years ago
Travis Paul 604f825a8e Update "smart" transport to handle Sun_SSH_1.5 on SmartOS 10 years ago
Brian Coca a4ffa09414 Merge pull request #11880 from bcoca/configurable_squash
made squashable with_ plugin list configurable
10 years ago
Brian Coca e8b86f448d fix issue with improper connection override in delegation 10 years ago
Brian Coca 22a69e2498 fixes to delegation code 10 years ago
Brian Coca ee2e31b37a now passes the test of skipping list when dict attribute is undefined, added deprecation warning as this seems like bad behaviour 10 years ago
Brian Coca 6e825e8c22 fixed listify for lookups, made sure convert_bare is only on with_ 10 years ago
Brian Coca 7e7b546c34 reinstated listify 10 years ago
Brian Coca 3e5dbd045f fixed ref to removed var 10 years ago
Toshio Kuratomi d35b956900 listify lookup plugin terms when they're specified as "{{ lookup(terms) }}"
Before this, they were not listified there but they were listified when
specified like this:

with_lookup: terms
10 years ago
James Cammarata 5266679964 Use templar all the way down
Fixes bugs related to creating Templar() objects on the fly, where
the shared loader objects (serialized to TaskExecutor) aren't used
so information loaded into plugin loaders after forking is lost.

Fixes #11815
10 years ago
James Cammarata c2435fab7e Inject the play context vars into the variables used for loop item templating 10 years ago
James Cammarata 2673eb0afb Add option to fail on undefined variables to listify
And use it in the call to get the loop items for a task.
10 years ago
Abhijit Menon-Sen 2cb7cd8379 Remove outdated FIXME; _compute_delegate is called below 10 years ago
Chris Church e87cf4a3cc Fixes for WinRM/PowerShell support in v2.
- Add support for inserting module args into PowerShell modules.  Fixes #11661.
- Support Windows paths containing spaces.  Applies changes from #10727 to v2.  Fixes #9999.  Should also fix ansible/ansible-modules-core#944 and ansible/ansible-modules-core#1007.
- Change how execution policy is set for running remote scripts.  Applies changes from #11092 to v2.  Also fixes ansible/ansible-modules-core#1776.
- Use codepage 65001 (UTF-8) for WinRM connection instead of default (CP437), convert command to UTF-8 and results from UTF-8.  Replaces changes from #10024.  Fixes #11198.
- Close WinRM connection when task completes.
- Use win_stat, win_file and win_copy modules instead of stat, file and copy when called from within other action plugins (only when using WinRM+PowerShell).
- Unquote Windows path arguments before passing to win_stat, win_file, win_copy and slurp modules (only when using WinRM/PowerShell).
- Check for win_ping module to determine if core modules are missing (only when using WinRM/PowerShell).
- Add stdout_lines to result from running low level commands (so stdout_lines is available when using raw/script).
- Update copy action plugin to use shell functions for joining paths and checking for trailing slash.
- Update fetch action plugin to unquote source path when using Windows paths.
- Add win_copy and win_template action plugins that inherit from copy and template.
- Support running .bat and .cmd scripts using default system encoding instead of UTF-8.
- Always send PowerShell commands as base64-encoded blobs to allow for running simple PowerShell commands via raw.
- Support running modules on Windows with interpreters other than PowerShell.
- Update integration tests to support above changes and test unicode fixes.
- Add test for win_user error from ansible/ansible-modules-core#1241 (fixed by ansible/ansible-modules-core#1774).
- Add test for additional win_stat output values (implemented by ansible/ansible-modules-core#1473).
- Add test for OS architecture and name from setup.ps1 (implemented by ansible/ansible-modules-core#1100).

All WinRM integration tests pass for me with these changes.
10 years ago
James Cammarata 2d90cbf78b Properly fail results with rc != 0
Fixes #11769
11 years ago
James Cammarata cb262449c7 Reworking internal result flags and making sure include_vars hides vault data
Fixes #10194
11 years ago
Brian Coca 0858d97c44 also captures typeerrors for when not getting a proper string in output 11 years ago
James Cammarata e526743b4f Allowing `args: "{{some_var}}"` for task params again
This is unsafe and we debated re-adding it to the v2/2.0 codebase,
however it is a common-enough feature that we will simply mark it
as deprecated for now and remove it at some point in the future.

Fixes #11718
11 years ago
Andrew Hamilton 7254b22bf4 Fixing delegate_to when using a variable 11 years ago
James Cammarata d412bc72ef Fall back to paramiko if the smart detection fails to run ssh
Fixes #11695
11 years ago
James Cammarata e64989beb4 Moving ConnectionInformation -> PlayContext
Also making PlayContext a child class of the Playbook Base class,
which gives it access to all of the FieldAttribute code to ensure
field values are correctly typed after post_validation

Fixes #11381
11 years ago
James Cammarata 271a7f3281 Cleaning up some of the notify/facts logic added earlier to fix problems 11 years ago
James Cammarata 5abdd3b821 Handle notifications when coupled with a loop
Fixes #11606
11 years ago
Brian Coca c603caca27 removed extra print now that items are getting passed to callback in result 11 years ago
James Cammarata ba7243c5f9 Don't set changed for include tasks
Fixes #11197
11 years ago
James Cammarata a9712bb0fb Fixing some delegate_to bugs
* Moving connection creation until after the task is post_validated,
  to make sure all fields are properly templated (#11230)
* Fixing problems related to the connection method and remote address
  lookup on the delegated-to host

Fixes #11230
11 years ago
Brian Coca 50efeb13ba made squashable with_ plugin list configurable
partially deals with #11383
11 years ago
James Cammarata 9155af20e3 Make sure vars in debug tasks aren't templated too early
If the syntax var={{something}} is used, that can be templated too
early in the post_validation, leading the debug module to fail when it
tries to template the same value in turn.
11 years ago
James Cammarata 31239f44cd Show failed result on a retry message
Fixes #10099
11 years ago
Benno Joy 4889d04fc6 fixes 11448 , yum with with_items 11 years ago
Matt Martz 65fdcf8b9d Check for name or pkg when templating squashed items. Fixes #11430 11 years ago
James Cammarata b723f9a09a Allow squashed loop items to use name=foo-{{item}}
Fixes #9235
Fixes #11184
11 years ago
Toshio Kuratomi c346788194 Slight optimization of how we squash loops. Add dnf to the list of modules for which we squash.
Fixes #11235
11 years ago
Matt Martz 9754c67138 Use a decorator to ensure jit connection, instead of an explicit call to _connect 11 years ago
Patrick McConnell a899f8f016 Fix for task_executor on OS X
I get this exception during the setup task:

AttributeError: 'ConnectionInformation' object has no attribute 'remote_pass'

I believe it is supposed to be looking at the password attribute. Either that
or we should create a remote_pass attribute in ConnectionInformation.
11 years ago
Matt Martz 1b48111b12 If remote_addr isn't set, set to ipv4_address 11 years ago
James Cammarata 7a617e7b93 Merge pull request #11131 from sivel/issue/11130
Don't override ansible_ssh_host with inventory_hostname
11 years ago
Matt Martz 697a1a4061 Don't override ansible_ssh_host with inventory_hostname 11 years ago
James Cammarata d1b4371287 Correctly evaluate changed/failed for tasks using loops 11 years ago
James Cammarata 361eb29146 Also make task_executor connect explicitly (v2) 11 years ago
James Cammarata d34b586eb6 Add ability for connection plugins to set attributes based on host variables (v2) 11 years ago
James Cammarata 803fb397f3 Fixing filter plugins directory from switch 11 years ago
James Cammarata ce3ef7f4c1 Making the switch to v2 11 years ago