Commit Graph

219 Commits (ea0da421dfbcd3dadd54a91a99e4eaf43daa615f)

Author SHA1 Message Date
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
James Cammarata 8ef78b1cf8 Fixing accelerated connection plugin 2015-10-02 00:50:02 -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
James Cammarata dcb8caf9e8 Remember if we already skipped tasks via --start-at-task
Fixes #12482
2015-09-30 14:12:38 -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
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
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
Brian Coca de18bcb95f correct typo on error reporting
fixes #12495
2015-09-23 10:11:52 -04:00
Toshio Kuratomi 2a614c1c0f Close module file once we're done reading from it 2015-09-21 01:46:29 -07: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 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
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 bde5ed9672 Catch worker errors that may be subclassed on others that lead to incorrect exits 2015-09-17 14:46:53 -04:00
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.
2015-09-17 23:03:48 +05:30
James Cammarata a7e1113b26 Removing FIXME comment which is no longer required 2015-09-15 14:47:49 -04:00
James Cammarata 60c139e482 Fix logic for changed/failed_when + retry/until loops
Fixes #11809
2015-09-15 13:37:35 -04:00
James Cammarata 8e664ad226 Fix delegate_to localhost vs. 127.0.0.1 (and ::1) 2015-09-15 13:08:54 -04:00
James Cammarata 4156bcedf5 Fix typo in 049a48f 2015-09-11 15:54:24 -04:00
Abhijit Menon-Sen 049a48f3d3 Test state.tasks_child_state before dereferencing
I hit a traceback in the FAILED_TASKS case, but it seemed prudent to add
guards in the other similar branches.
2015-09-11 21:59:08 +05:30
Thomas Quinot 0bc9223826 Test for Python must be against basename of interpreter
Followup on issue #12076
2015-09-11 13:29:34 +02:00
James Cammarata 441a8af671 Merge pull request #12267 from h-hirokawa/add_replacer_jsonargs
Add the new module replacer <<INCLUDE_ANSIBLE_MODULE_JSON_ARGS>>.
2015-09-11 02:44:50 -04:00
James Cammarata 0c5bbe3c32 Use the original (un-templated) args for include params
Fixes #12314
2015-09-11 00:53:27 -04:00
James Cammarata aa3b290efd Fix indent on line in playbook executor 2015-09-09 18:10:38 -04:00
James Cammarata e81947c3b4 Fix vars_prompt short form support (and mark deprecated) 2015-09-09 17:52:44 -04:00
James Cammarata be7bd392cb Fix unreachable host detection and have plays continue after unreachable failures
Fixes #12284
2015-09-09 15:27:26 -04:00
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.
2015-09-09 14:21:56 -04:00
James Cammarata 926f127245 set_fact should put facts in the fact_cache, not vars_cache
Also fixes a template path lookup issue when using an include

Fixes #12277
2015-09-09 11:10:18 -04:00
James Cammarata 30399edada Use UnsafeProxy for lookup results too
Also fixes a couple of bugs that popped up when using the proxy class
2015-09-08 12:19:39 -04:00
h-hirokawa cd478a76fc Add the new module replacer <<INCLUDE_ANSIBLE_MODULE_JSON_ARGS>>.
Fixes #12266
2015-09-07 12:01:26 +09:00
Brian Coca 23a22397bf remove closing connections after every task, this goes against conneciton caching and was not expected behaviuor nor inhertited from v1 2015-09-04 10:11:25 -04:00
Marius Gedminas 37be9539ff Python 3: use six.text_type instead of unicode
Replace 'unicode' with six.text_type, everywhere but in module_utils.
2015-09-04 08:40:10 +03:00
James Cammarata 4ac2bafc4b Set hosts fact gathering flag based on fact cache entries
Fixes #12213
2015-09-03 14:11:19 -04:00
James Cammarata 8774ff5f57 Make sure PlayContext is copied when iterating in a with_ loop 2015-09-03 08:11:30 -04:00
James Cammarata c16961db60 Fix two PlayIterator bugs
* When iterating over a child state, a failure should be propagated
  up so parent blocks don't continue iterating
* Make sure a child state exists before trying to search it

Fixes #12210
2015-09-03 07:48:42 -04:00
Toshio Kuratomi 1ae28f606b Refactor to replace filter and lambda with a generator expression 2015-09-03 00:06:34 -07:00
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.
2015-09-03 09:23:27 +03:00
James Cammarata 9e1bc434c7 Further cleanup from locking changes 2015-09-03 01:07:29 -04:00
James Cammarata b93f27e260 Move the lockfile back to tqm to make sure it stays unique 2015-09-03 00:45:42 -04:00
James Cammarata 5adcd7054b Allow setup to run when using --start-at-task
Fixes #12147
2015-08-31 22:10:34 -04:00
James Cammarata 057712c129 Also move action/connection plugins to shared plugin loader code
Fixes #12099
2015-08-28 16:32:09 -04:00
James Cammarata 266a069a73 Merge pull request #12107 from TravisPaul/devel
Update "smart" transport to handle Sun_SSH_1.5 on SmartOS
2015-08-28 10:43:48 -04:00
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.
2015-08-27 22:15:04 +03:00
James Cammarata 50448d68e1 Implement max_fail_percentage and any_errors_fatal support
Fixes #11997
2015-08-26 12:03:47 -04:00
Travis Paul 604f825a8e Update "smart" transport to handle Sun_SSH_1.5 on SmartOS 2015-08-26 15:00:45 +00:00
James Cammarata 601a1cc6d9 Multiple fixes for include statements and blocks in general
Fixes #11981
Fixes #11995
Fixes #12039
Fixes #12077
2015-08-26 02:23:22 -04:00
Brian Coca 154754ae50 pushed module_loader to task_queue_manager so all cli's can benefit from it
also normalized -M option across all cli
fixes #12016
2015-08-25 18:14:03 -04:00
Toshio Kuratomi 1f7b0fee0a Fixes #12076 2015-08-24 19:07:04 -07:00
Toshio Kuratomi 6e107d2f22 Comments pointing the way towards substituting cryptography for pycrypto 2015-08-24 15:50:37 -07:00
Brian Coca a4ffa09414 Merge pull request #11880 from bcoca/configurable_squash
made squashable with_ plugin list configurable
2015-08-23 13:32:15 -04:00
Brian Coca e8b86f448d fix issue with improper connection override in delegation 2015-08-19 20:36:08 -04:00
Brian Coca 22a69e2498 fixes to delegation code 2015-08-19 15:49:37 -04:00
Brian Coca 2198f48f54 changed check to avoid OS X broken sem_getvalue()
fixes #11988
2015-08-18 03:46:20 -04:00
James Cammarata e7b2308b66 Performance improvements
* Speed up serialization of hostvars by simply using the internal
  dictionary used for cached lookups
* Use blocking gets/puts on queues instead of spin locking
* Merge sequential implicitly created blocks
2015-08-17 13:46:57 -04:00
Brian Coca ee2e31b37a now passes the test of skipping list when dict attribute is undefined, added deprecation warning as this seems like bad behaviour 2015-08-16 10:16:02 -04:00
Brian Coca 245e0dd4b7 made returns from next task consistent to avoid typeerrors, also linear now checks for none
fixes #11965
2015-08-14 18:07:14 -04:00
Brian Coca 6e825e8c22 fixed listify for lookups, made sure convert_bare is only on with_ 2015-08-11 16:42:09 -04:00
James Cammarata adb9d7e461 Track role execution per-host, not overall in the role
Fixes #11863
Fixes #11878
2015-08-11 16:34:58 -04:00
Brian Coca 7e7b546c34 reinstated listify 2015-08-10 17:38:20 -04:00
Brian Coca 3e5dbd045f fixed ref to removed var 2015-08-10 14:02:42 -04:00
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
2015-08-10 09:07:37 -07:00
Brian Coca a555a0652e allow for vars_prompt and pause prompt to be skipped in non interactive settings
ansible-pull users rejoice
2015-08-06 19:20:45 -04:00
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
2015-08-04 12:25:53 -04:00
James Cammarata c2435fab7e Inject the play context vars into the variables used for loop item templating 2015-08-03 12:12:45 -04:00
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.
2015-08-03 12:04:31 -04:00
Abhijit Menon-Sen 2cb7cd8379 Remove outdated FIXME; _compute_delegate is called below 2015-08-01 09:35:32 +05:30
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.
2015-07-31 14:38:31 -04:00
Abhijit Menon-Sen 1541e331c9 Also fix UTF-8 handling in vars_prompt 2015-07-30 23:27:39 +05:30
Abhijit Menon-Sen ff2d160fff Correct invalid reference to global display 2015-07-30 22:52:47 +05:30
Abhijit Menon-Sen 10def3aa54 Uncomment encrypt handling for vars_prompt 2015-07-30 22:42:21 +05:30
Brian Coca 056602c424 rearranged --list- options, now they are consolidated when used toghether, less loops, more concise output
list-hosts works
list-tasks works, but needs better task naming (missing role info)
list-tags only shows play tags
2015-07-28 22:05:49 -04:00
James Cammarata 42cfacf83b Switch up the task/host overrides for PlayContext to use the compiled vars dict
Fixes #11436
2015-07-28 16:25:44 -04:00
James Cammarata 2d90cbf78b Properly fail results with rc != 0
Fixes #11769
2015-07-28 10:15:14 -04:00
James Cammarata cb262449c7 Reworking internal result flags and making sure include_vars hides vault data
Fixes #10194
2015-07-27 14:04:31 -04:00
Brian Coca 0858d97c44 also captures typeerrors for when not getting a proper string in output 2015-07-24 18:43:40 -04:00
James Cammarata eccfb7e0b5 Adding initial support for includes in handlers
Fixes #11694
2015-07-24 16:22:02 -04:00
James Cammarata ff49c5adac Make sure we're actually looping before looking at 'results' in TaskResult
Fixes #11696
2015-07-24 11:55:22 -04:00
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
2015-07-24 10:33:12 -04:00
Brian Coca 851ed45bbf adding display to plugins and start moving debug to display 2015-07-23 10:26:12 -04:00
Andrew Hamilton 7254b22bf4 Fixing delegate_to when using a variable 2015-07-22 17:12:00 -07:00
James Cammarata d412bc72ef Fall back to paramiko if the smart detection fails to run ssh
Fixes #11695
2015-07-22 16:14:17 -04:00
James Cammarata 135404738e Fix a couple start-at-task issues
* added pattern matching to match v1 functionality
* check the task name, not the task+role name for matches
* make sure the input is unicode

Fixes #11692
2015-07-22 07:45:03 -04:00
ZviRackover 628925a77d Fix: add missing import 'locale' 2015-07-22 01:09:31 +03:00
James Cammarata 4c733fe4b7 Fix issues with vars_prompt and vars_files
* Prompt had to be moved up, as it needed to be done before the first
  templating of the play occurs, otherwise vars_files won't be templated
  properly
* Fixed a bug related to an earlier fix of vars_files incorporating
  extra vars to do the templating of the file name

Fixes #11404
2015-07-21 14:52:57 -04:00
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
2015-07-21 12:13:50 -04:00
James Cammarata dca36c1d16 Reestablishing the use of tags/when for role duplication detection
Not figuring these in can cause problems with "diamond" pattern relationships,
even though this is still not quite optimal.
2015-07-20 14:37:20 -04:00
Brian Coca 171c95672e fixed gathering expression as it was triggering when gather_facts was no 2015-07-19 23:16:54 -04:00
James Cammarata 3d77723e3d Cleaning up some stuff related to the connection info/become/executable change 2015-07-19 01:12:23 -04:00
James Cammarata 1c185b68be Rearranging some become stuff in relation to action/connection plugins
Moving the make_sudo_cmd() calls back up to the action level so that connection
plugins don't have to know about it at all, and moving some of the become data
(prompt and success_key) into the ConnectionInformation object so they don't
need to be passed around needlessly.
2015-07-19 01:12:23 -04:00
James Cammarata 271a7f3281 Cleaning up some of the notify/facts logic added earlier to fix problems 2015-07-17 14:44:19 -04:00
James Cammarata 5abdd3b821 Handle notifications when coupled with a loop
Fixes #11606
2015-07-17 12:03:04 -04:00
Abhijit Menon-Sen 28e2eae902 Make gathering=explicit work again
There was a confusion between the valid values for defaults.gathering
(explicit/implicit/smart) and a play's gather_facts setting (boolean),
which resulted in gathering=explicit being ignored.
2015-07-17 13:05:00 +05:30
Brian Coca c603caca27 removed extra print now that items are getting passed to callback in result 2015-07-16 15:13:35 -04:00
Piyush f2bdd9af29 Fix #11369 A result is skipped when all it's children are skipped. This makes it fundamentally different from a result that was changed/failed/unreachable 2015-07-16 17:50:15 +05:30
James Cammarata ba7243c5f9 Don't set changed for include tasks
Fixes #11197
2015-07-15 15:11:46 -04:00
Brian Coca b76cb8f655 now that invocation is only async again, no need to sanitize 2015-07-15 10:40:37 -04:00
James Cammarata 0b035a4e35 Unicode in result debug statements caused a traceback 2015-07-15 01:56:28 -04:00
James Cammarata 8d887d8dd3 Adding back --start-at-task feature
Also implemented framework for --step, though it's not used yet
2015-07-14 15:02:20 -04:00
James Cammarata 4e94bb64d8 Fix group/host var loading relative to playbook basedir 2015-07-14 09:26:24 -04:00
Brian Coca a09f44210e now callback errors are not silent but warnings 2015-07-13 19:23:27 -04:00