Commit Graph

1158 Commits (f4bd38a153694665686ecbe73995548e1594c15b)

Author SHA1 Message Date
jctanner 76f73dc81f Change the raw module's detection of environment settings. (#15535)
The task_vars datastructure always contains an environment key,
so use the _task.environment property to look for a non-empty
list instead.
2016-04-21 22:58:07 -04:00
Brian Coca a5d79a39d5 Ensure action plugins remove tmp dirs created (#15501)
fixes #14917
2016-04-20 13:39:12 -04:00
Matt Davis 67e6bd18e4 Merge pull request #15488 from jctanner/AMC-32
WARN if the play or the task attempts to pass environment to the raw module
2016-04-20 10:03:17 -07:00
James Tanner 095ec760ac Provide a warning if the play or the task attempts to pass environment to the raw module.
Addresses ansible-modules-core/issues/32
2016-04-19 22:41:46 -04:00
James Cammarata f32592f092 Merge pull request #14400 from d3matt/FIX/paramiko_lecture
paramiko transport appears to hang if it gets a sudo lecture
2016-04-19 13:31:17 -04:00
Brian Coca 33761efd19 Merge pull request #15417 from bcoca/copy_vaulted
Copy vaulted
2016-04-19 10:22:30 -04:00
Matt Davis 822f904aa6 Merge pull request #14813 from mattclay/lxd-plugin
Add lxd connection plugin.
2016-04-19 02:06:31 -07:00
James Cammarata 0e2f1b423d Merge pull request #15455 from chemikadze/devel
Fix duplicate host with different uuid created after add_host
2016-04-19 02:50:27 -04:00
James Cammarata 6eefc11c39 Make the loop variable (item by default) settable per task
Required for include+with* tasks which may include files that also
have tasks containing a with* loop.

Fixes #12736
2016-04-19 01:42:40 -04:00
Nikolay Sokolov d8867d7ce3 Fix duplicate host with different uuid created after add_host
If add_host is performed with hostname existing in inventory, but
not yet accessed and put in inventory cache, additional host with
same hostname and different uuid is created, causing patterns to
misbehave.
2016-04-18 00:10:09 -07:00
Matt Clay 5fc76df18b Add lxd connection plugin. 2016-04-15 19:10:57 -07:00
Peter Sprygada 9111efc975 adds two new regex filters for use in playbooks (#14696)
The first filter is regex_search which adds the ability to do a regex
search on a fact.  The filter supports returning either all capture groups
or a set of capture groups (either by index or named).

Example usage of regex_search filter

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

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

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

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

- cleanup_real_file will remove a temporary file created previously with
  get_real_file
2016-04-14 14:12:48 -04:00
Toshio Kuratomi dcc5dfdf81 Controller-side module caching.
This makes our recursive, ast.parse performance measures as fast as
pre-ziploader baseline.

Since this unittest isn't testing that the returned module data is
correct we don't need to worry about os.rename not having any module
data.  Should devise a separate test for the module and caching code
2016-04-12 08:01:07 -07:00
James Cammarata 2e55b3567b Also fix intermittent ssh error using pty's for paramiko
Related to #13876
2016-04-12 08:35:48 -04:00
Toshio Kuratomi 0ced20951f Use /var/tmp is user set remote_tmp below /var/tmp.
We want them to be able to influence this choice in case they want to
keep files out of /tmp (perhaps to conserve RAM if that is a tmpfs).
2016-04-11 21:03:13 -07:00
James Cammarata 44877b7c7e Don't use -tt for ssh connections when sudoable=False
Due to an apparent race condition while using pty's on a heavily loaded
system, rarely a request to create a temp directory returns an empty
string rather than the newly created path, causing an error. Disabling
forced pty's appears to resolve the issue, so this patch modifies the
mkdtemp remote call not use -tt as we're not escalating privileges and
thus no pty is required.

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

Fixes #15372
2016-04-11 20:00:10 -07:00
nitzmahone 336b1ae84b add win_reboot action
also includes WinRM connection plugin change to support connection reset
2016-04-11 14:48:39 -07:00
Jesper Geertsen Jonsson bd0066d621 Adds support for converting a MAC address to an integer.
Example:
---
- hosts: local
  tasks:
    - set_fact: mac_str="52:54:00:00:00:00"
    - set_fact: base_mac="{{ mac_str | macaddr('int') }}"
    - debug: msg="{{ (base_mac|int + 257) | macaddr('linux') }}" # 52:54:00:00:01:01
2016-04-11 20:46:45 +02:00
Toshio Kuratomi 54acdd7ead Remove workaround for fixed bug. (#15340)
* Remove workaround for fixed bug.

The bug where PluginLoader required objects to directly inherit from
base_classes has been fixed.  Remove workaround from this strategy
plugin   Also switched to using super so that we don't have to modify
all of hte code anytime something like that happens.

* These should be to_uniocde because they're being sent to display()
2016-04-10 09:24:54 -07:00
Kishin Yagami e4a6106ea5 Add debug strategy plugin (#15125)
* Add debug strategy plugin

* Fix Python 2-3 compatiblity issue

* Add document for debug strategy
2016-04-08 14:39:08 -04:00
peter.jang 65856f2231 added suport rsync protocol (#12197)
* added suport rsync protocol

* use startswith method for safety
2016-04-08 11:42:07 -04:00
James Cammarata e5c4f88b71 Fix free strategy, which was incorrectly using _wait_on_pending_results
Broken in 210cf06d
2016-04-08 06:49:16 -04:00
Matt Davis 957b336cc1 skip fixup_perms for Powershell
action plugins will now skip _fixup_perms for Powershell. We'll have to come up with another way to do this at some point, but it's not necessary yet since we don't support become on Windows. Also added NotImplementedError throws to chmod/chown/set_facl operations on Powershell (instead of returning '') in case anyone tries to use them in the future.



fixes #15312
2016-04-07 07:27:01 -07:00
Brian Coca 5225048df9 capture attribute errors for invalid class plugins
also switched to py3 safe to_str
2016-04-07 10:16:35 -04:00
James Cammarata 040893a677 Adding a config option to allow disabling locale settings upon module exec
Fixes #15138
2016-04-06 12:19:22 -04:00
Matt Martz bce79c67c3 Cascade ssh_*args configurations in synchronize instead of limiting to just ssh_args. See https://github.com/ansible/ansible-modules-core/issues/3370 2016-04-06 10:27:58 -05:00
Toshio Kuratomi edab8d338d Expand tilde after expanding vars 2016-04-05 22:27:07 -07:00
Toshio Kuratomi 4b0aa1214c Ziploader
* Ziploader proof of concept (jimi-c)

* Cleanups to proof of concept ziploader branch:

* python3 compatible base64 encoding
* zipfile compression (still need to enable toggling this off for
  systems without zlib support in python)
* Allow non-wildcard imports (still need to make this recusrsive so that
  we can have module_utils code that imports other module_utils code.)
* Better tracebacks: module filename is kept and module_utils directory
  is kept so that tracebacks show the real filenames that the errors
  appear in.

* Make sure we import modules that are used into the module_utils files that they are used in.

* Set ansible version in a more pythonic way for ziploader than we were doing in module replacer

* Make it possible to set the module compression as an inventory var

This may be necessary on systems where python has been compiled without
zlib compression.

* Refactoring of module_common code:

* module replacer only replaces values that make sense for that type of
  file (example: don't attempt to replace python imports if we're in
  a powershell module).
* Implement configurable shebang support for ziploader wrapper
* Implement client-side constants (for SELINUX_SPECIAL_FS and SYSLOG)
  via environment variable.
* Remove strip_comments param as we're never going to use it (ruins line
  numbering)

* Don't repeat ourselves about detecting REPLACER

* Add an easy way to debug

* Port test-module to the ziploader-aware modify_module()

* strip comments and blank lines from the wrapper so we send less over the wire.

* Comments cleanup

* Remember to output write the module line itself in powershell modules

* for line in lines strips the newlines so we have to add them back in
2016-04-05 11:06:17 -07:00
Matt Davis 6a3670b1f0 Merge pull request #15281 from jpic/fix_plugin_configuration
Regression fix: proper plugin configuration was reset
2016-04-05 10:00:40 -07:00
James Cammarata 0f2b1244d2 Make sure VariableManager has a view of HostVars
Fixes #15261
2016-04-05 11:32:28 -04:00
jpic da175d0a57 Bugfix: proper plugin configuration was reset
Before this patch, if config was ['/some/path'] then it would enter the
else block and config would be set to [].

The regression this patch fixes was introduced by 700db154.
2016-04-05 14:41:49 +02:00
Toshio Kuratomi c75b5ba85f Use to_bytes and to_str instead of str as str is unsafe. 2016-04-04 12:57:32 -07:00
Dag Wieers 055aae55f7 Implement own CSVRecoder and CSVReader from documentation
As detailed in the python manual:
https://docs.python.org/2/library/csv.html
2016-04-04 20:32:08 +02:00
Dag Wieers ac75069ee0 Support different encoding types in csvfile lookup plugin
This fixes #15266.
2016-04-04 14:11:44 -04:00
nitzmahone 700db15452 fix unconfigured plugin path case
We tried to expand paths for None- ensure we're not passing [None] in that case, but [] instead.
2016-04-01 20:37:43 -07:00
Brian Coca dbc5cc9d7a fix issue with plugin load path inconsistency
now assures it is always a list of paths and not just assumes it
this avoids issues of parsing a 'string path' and picking up '/' as
a valid path for plugin loader
2016-04-01 23:14:56 -04:00
Brian Coca 0bd6f3a5e8 correctly adds searchpath as list 2016-04-01 23:14:56 -04:00
Toshio Kuratomi 4ccea9905b Fix async for old style modules and don't send an args file for new-style modules 2016-04-01 20:04:25 -07:00
Dag Wieers d46af7cda3 On change in diff-mode we don't need to see file content in task output
I was surprised to see complete file content in the (JSON) task output when
in diff-mode. Since we see the diff anyhow, there's no need to send everything
on screen.
2016-04-01 18:03:51 +02:00
Toshio Kuratomi f29b8e461b Merge pull request #15151 from mattclay/accelerate-unicode
Add to_bytes to file paths for accelerate plugin.
2016-03-31 21:47:33 -07:00
Matt Davis 3f70d7a70d Merge pull request #15144 from mattclay/winrm-test
Add winrm tests and fix exposed unicode errors.
2016-03-31 16:30:45 -07:00
James Cammarata 0656d1466a Adds two variables to facts when a task fails and a rescue block starts
`ansible_failed_task`:
   Contains the task data, essentially a serialized view of the Task() object.
`ansible_failed_result`:
   Contains the result of the task failure, which is identical in function
   to registering the result. Doing so automatically like this saves the user
   from having to register every result in a block and then trying to figure
   out which result had the failure

Similar to the way try/except/finally work, these variables will not be
available in the `always` portion of a block unless there is a corresponding
`rescue` first.

Fixes #12341
2016-03-31 15:29:33 -04:00
James Cammarata 26a4761d0f Fix logic error in script action plug related to use of shell.exists 2016-03-31 15:21:45 -04:00
Matt Clay 262c341cda Add connection tests for winrm connection plugin.
These are the same tests used for the other connection plugins,
adapted to use winrm modules and Windows friendly paths.
2016-03-31 08:32:41 -07:00
Matt Clay 83e53cbb91 Add to_bytes to file paths for accelerate plugin. 2016-03-30 23:23:04 -07:00
James Cammarata a8dbd3dee9 Pass the variable manager into load_list_of_blocks for include files
Fixes #15194
2016-03-31 00:44:41 -04:00
Brian Coca 4b3257c4fe Merge pull request #15208 from bcoca/constants_pathlist
centralize path list handling
2016-03-30 19:49:18 -07:00
Brian Coca 5dfc013e18 Merge pull request #14971 from bcoca/clear_facts
meta: clear_facts
2016-03-30 19:09:38 -07:00
James Cammarata eab4ce19f3 Making the return parsing in ActionBase generic for reuse
Now also correctly parses the return value for the _low_level_execute_command
2016-03-30 12:45:21 -04:00
Brian Coca 92d154f4ef centralize path list handling
move it to constants and avoid duplicating code or misinforming
developers on the nature of the data
2016-03-30 07:16:09 -07:00
Brian Coca 3f6166d2bf always return rc 2016-03-30 07:15:51 -07:00
nitzmahone 05af5c88ea fix Mac chown/chmod -R issue, add error checks
The changes to chown/chmod were broken on Mac (-R was being appended to the end of the command- OSX requires it before the file list).

A number of base action remote setup commands were also blindly proceeding without checking for success. Added error raises for unrecoverable failure cases.
2016-03-29 07:44:09 -07:00
Brian Coca 04610106a3 Merge pull request #15173 from mattclay/issue6072
Support remote_user in jail connection plugin.
2016-03-28 09:22:00 -07:00
Brian Coca e9a4526251 allow bypassing executable setting
if you set executable to an empty string this avoids passing one to the command constructor
fixes #14813
2016-03-28 08:02:27 -07:00
Brian Coca c303ed24b5 Merge pull request #15159 from sigio/filter-ip4-hex
Add ip4_hex filter to convert ip-address to hex notation
2016-03-27 14:14:25 -07:00
Brian Coca 363384f517 Merge pull request #15174 from mattclay/conn-msg-host
Fix inconsistent/missing host names in messages.
2016-03-27 14:07:13 -07:00
Toshio Kuratomi 0fffb6c60c Merge pull request #15163 from ansible/synchronize-connection-vs-play_context
Use _connection instead of _play_context for information about the connection
2016-03-27 10:24:46 -07:00
Matt Clay 5fdc29e00f Fix inconsistent/missing host names in messages. 2016-03-25 21:11:53 -07:00
Matt Clay b60062bdf9 Support remote_user in jail connection plugin.
Resolves #6072.
2016-03-25 20:15:52 -07:00
Brian Coca 28d20dbe53 moved 'path exists' function to shell
now it will work with powershell/winrm
2016-03-25 12:56:48 -07:00
Toshio Kuratomi 0cabd133ba have to always run dwim() on the path to get the full absolute path.
Fixes #14944
2016-03-25 12:09:30 -07:00
Toshio Kuratomi e2f5762232 Use _connection instead of _play_context for information about the connection
If we're not delegating then we change _connection into a local
connection midway through the file but we don't change
_play_context.connection (no need to alter that).  When we later check
it in process_remote() we need to know the actual connection, not the
connection that we thought we were going to use at the start of run().
So we have to use _connection.transport in process_remote().  The rest
of the places could use either one (because we have not yet changed to
a local connection) but we go ahead and switch those to
_connection.transport as well to avoid confusion in the future.

Fixes https://github.com/ansible/ansible-modules-core/issues/3136
2016-03-25 09:25:19 -07:00
Mark Janssen -- Sig-I/O Automatisering b1015d897d Re-add accidentaly removed comment 2016-03-25 15:33:35 +01:00
Mark Janssen -- Sig-I/O Automatisering 73766e0816 Add ip4_hex filter to convert ip-address to hex notation 2016-03-25 15:24:48 +01:00
Matt Davis afc82f6beb Merge pull request #14930 from mholiv/enable_dollar_as_first_char_in_folder_and_userName
Modified files to use single quotes rather than double for file path.…
2016-03-25 07:14:42 +00:00
Toshio Kuratomi 3221be4340 Reverse boilerplate order because from __future__ must be the first code in the file 2016-03-24 20:08:39 -07:00
Brian Coca 1c4cfee415 Merge pull request #15046 from bcoca/script_raw
removes python requirement to script
2016-03-24 19:52:06 -07:00
nitzmahone 4241106ad2 fix breakage from new recursive=True arg to chmod 2016-03-24 19:47:43 -07:00
Toshio Kuratomi 80e7fbff75 Add python3 compat boilerplate 2016-03-24 18:04:16 -07:00
Brian Coca 1ebc2fda71 removes python requirement to script
mistakenly added when checksum was made to use stat module
fixed assertion in test
2016-03-24 16:17:58 -07:00
Brian Coca 6768f34b31 Merge pull request #15062 from gechr/gc-subset-superset-filters
Add `issubset` and `issuperset` tests
2016-03-24 16:17:13 -07:00
Thomas Steinbach 870160b8ed fixed some breaks after merging ansible/devel 2016-03-24 22:09:41 +01:00
Thomas Steinbach cd2c140f69 forwarded docker_extra_args to latest upstream/origin/devel 2016-03-24 21:25:38 +01:00
Toshio Kuratomi f323eb858e nv_por is needed later in the file
Fixes #14654
2016-03-24 06:58:56 -07:00
Brian Coca 5b11494437 python3 compatiblity
remove use of basestring
deal with configparser
2016-03-24 06:39:21 -07:00
Toshio Kuratomi 52e9209491 Don't create world-readable module and tempfiles without explicit user permission 2016-03-23 09:52:19 -07:00
Joel 23a74eb125 Sort plugins by basename to support ordering callbacks 2016-03-22 12:12:51 -05:00
Toshio Kuratomi f39a1da360 Merge pull request #15074 from ansible/pluginloader-cleanups
Cleanup some minor issues in PuginLoader:
2016-03-21 12:57:46 -07:00
George Christou 02ad029840 Add `issubset` and `issuperset` tests 2016-03-21 19:22:39 +00:00
Toshio Kuratomi 7ce130212f Cleanup some minor issues in PluginLoader:
* class_only was a keyword arg of get() and all() that was mistakenly
  passed on to Plugins.  Be sure to strip it from the keyword args
  before instantiating Plugins.  (Reworked API probably should either
  not instantiate Plugins or take the args for the Plugin as a separate
  list and a dict.)
* Checking required base_classes was only done in get() and only if
  class_only was False (ie: that Plugin was instantiated).  This meant
  that different plugins could be found depending on whether the call
  was to .get() or to all() and whether it was for classes or instances.
  Fixed so that required base_classes are always checked.
2016-03-21 09:54:37 -07:00
Brian Coca 3ae9a272e0 Merge pull request #14977 from towolf/hide_ok_items_in_actionable
For `actionable` cb plugin also hide ok for itemized results
2016-03-21 08:04:52 -07:00
Toshio Kuratomi 407f8f934e Merge pull request #14976 from xiaket/devel
use __mro__ for plugin loading when we search for its base class.
2016-03-21 07:32:07 -07:00
Tobias Wolf 4938b98e4e For `actionable` cb plugin also hide ok for itemized results
The purpose of the `actionable` callback plugin is to hide uninteresting
results.

Also hide the ok results when the task was itemized.
2016-03-21 14:59:57 +01:00
夏恺(Xia Kai) 38092dcc27 import the base class and check whether this obj has the required base class.
Signed-off-by: 夏恺(Xia Kai) <xiaket@gmail.com>
2016-03-21 07:21:54 +00:00
Toshio Kuratomi 9053d0468e Merge pull request #15006 from ansible/local-pipelining
Add changes necessary for enabling pipelining for local connections
2016-03-20 22:12:07 -07:00
Matt Clay 24c4384f0e Add missing to_bytes for cmd. 2016-03-19 11:13:38 -07:00
Toshio Kuratomi f5654dced9 Merge pull request #15043 from mattclay/docker-user
Use docker exec -u only when supported.
2016-03-18 18:46:46 -07:00
Matt Clay ea1a6c56b9 Use docker exec -u when needed and if supported.
If remote_user is given and cannot be set in docker, a warning will
be displayed unless the default container user matches remote_user.
2016-03-18 18:19:41 -07:00
James Cammarata 13f3cbaf3b Renaming per-item and retry callbacks 2016-03-18 15:17:43 -04:00
Toshio Kuratomi 60c943997b More doc updates regarding ansible_shell_executable 2016-03-18 09:16:21 -07:00
Brian Coca b809d23863 fixed typo 2016-03-18 07:04:12 -07:00
Brian Coca db61e9be0c add ansible_executable inventory var
also handle the overrides appropriately
also new executable to set shell type
2016-03-17 18:54:37 -07:00
Thomas Steinbach 14dfad730e use just 'remote_user' as user for the docker connection 2016-03-17 14:39:44 -07:00
Thomas Steinbach 4ac49ed4a8 use remote_user or become_user in docker connection 2016-03-17 14:39:44 -07:00
Toshio Kuratomi ab693579a9 Clarify the document about the order of matryoshka shells
(nesting shells)
2016-03-17 14:29:49 -07:00
James Cammarata 1ee6d489ab Make sure tuples returned by _get_item() are handled correctly in formatting
Fixes #14800
2016-03-17 14:19:58 -04:00
Toshio Kuratomi 2dd6bae9e1 Merge pull request #15003 from ansible/jail-enable-pipelining
Enable pipelining for jail connection plugin
2016-03-17 07:55:36 -07:00
Brian Coca bc60f52db5 avoid exceptiosn when not being called by CLI 2016-03-17 07:19:35 -07:00
Brian Coca 5ae9955aad Merge pull request #15011 from dagwieers/fix-unreachable-color
Fix the color when unreachable in default cb plugin
2016-03-16 17:02:05 -07:00
Dag Wieers ed457ad53b Fix the color when unreachable in default cb plugin
The dedicated color for unreachable errors was not being used in the default cb plugin.
This corrects the color.
2016-03-17 00:18:13 +01:00
qqo a7f89cac63 fix TypeError: coercing to Unicode: need string or buffer, AnsibleParserError found 2016-03-17 00:56:47 +03:00
Toshio Kuratomi 1346c209b0 Add changes necessary for enabling pipelining for local connections 2016-03-16 12:47:52 -07:00
Toshio Kuratomi a8acd7f93e Enable pipelining for jail connection plugin 2016-03-16 11:39:51 -07:00
Toshio Kuratomi de306eb5da Small cleanup to use class attribute directly instead of property for transport names 2016-03-16 11:22:50 -07:00
Toshio Kuratomi fee73100c4 Move BUFSIZE to __init__ since it's common to many connection plugins 2016-03-16 11:20:02 -07:00
Toshio Kuratomi fe278202f2 Fix saving of tracebacks on module failure 2016-03-15 20:31:40 -07:00
夏恺(Xia Kai) cd6d865e27 use __mro__ for plugin loading when we search for its base class.
This would relax the constraint a little bit, allowing subclassing existing plugins.

Signed-off-by: 夏恺(Xia Kai) <xiaket@gmail.com>
2016-03-15 10:01:31 +00:00
Brian Coca 09699d0cd0 meta: clear_facts
draft implementation
2016-03-14 21:24:26 -07:00
Brian Coca 2984ffdfac now item callback honors display_skipped_hosts
fixes #14956
2016-03-14 13:13:50 -04:00
root 2aba1c211d Modified files to use single quotes rather than double for file path. Powershell does not process $ variables in strings that are single quoted. Powershell DOES process $ variables that are in double quoted strings.
Using single quotes enables ansible to  handle file paths that contain folders that start with $. (i.e. C:/Users/$admin/...)
2016-03-11 14:00:28 -05:00
Matt Clay ba1bcdfc17 Add noseclabel support to libvirt_lxc plugin. 2016-03-10 15:34:31 -08:00
James Cammarata 52efd7438c Fixing template/assemble action plugins related to tmp dir use/cleanup 2016-03-10 14:07:58 -05:00
Matt Clay f878a5d2e0 Fix unicode handling in connection plugins. 2016-03-10 09:04:32 -08:00
Brian Coca 5cbdaff9fd avoid creating extra tmp dirs we don't delete
fixes #14867
2016-03-10 10:31:36 -05:00
Peter Sprygada ae5951b97f Merge pull request #14698 from privateip/plugin_action_ops_template
updates the ops_template plugin action backup key
2016-03-09 22:14:56 -05:00
Toshio Kuratomi 0628951ac6 Handle shlex incompatibility between python2.6 and python3 2016-03-09 11:27:19 -08:00
Toshio Kuratomi c0e2dd1693 Fix ssh connection plugin to work with python3 2016-03-09 11:17:10 -08:00
Matt Clay 33f93f9241 Fix misplaced paren. 2016-03-08 22:16:23 -08:00
James Cammarata aee2eb6287 Merge pull request #14864 from dagwieers/patch-12
Only show diff when the task actually induced a change
2016-03-08 15:02:49 -05:00
James Cammarata 1a5ee115f0 Fixing minor logic error in error detection/handling in ssh connection plugin
If max retries were reached, no AnsibleConnectionFailure was raised, which
means potentially in some cases an unreachable error might not be returned
2016-03-08 14:50:35 -05:00
Dag Wieers f5b6f52940 Only show diff when the task actually induced a change
This implements solution #1 in the proposal #14860.

It only shows the diff if the task induced a change, which means that if the changed_when control overrides the task, not diff will be produced.
See #14860 for a rationale and the use-case.
2016-03-08 17:33:29 +01:00
Dag Wieers 175351f200 Little improvement in flow
Don't get the hostname if it's not needed.
2016-03-08 17:23:34 +01:00
Brian Coca 49bb4803b5 clarify --step prompt
now shows full words and indicates default
fixes #7433
2016-03-08 10:57:54 -05:00
Brian Coca 3d6ec52e83 Merge pull request #14830 from bcoca/assemble_fix
fix assemble to not pass extra args to copy/file
2016-03-08 09:22:15 -05:00
Brian Coca 66ea464ebd Merge pull request #14793 from xiaket/devel
remove main_q for simplicity.
2016-03-07 12:51:38 -05:00
Brian Coca 25e9b5788b add per item diff handling
fixes #14843
2016-03-07 09:49:18 -05:00
Brian Coca 7d8b84dae6 fix assemble to not pass extra args to copy/file
also small refactor to dedupe code
fixes https://github.com/ansible/ansible-modules-core/issues/3154
2016-03-06 10:00:36 -05:00
Peter Sprygada c0f1e1801b adds multiline flag to regex test for search and match
This commit adds the multiline flag to the regexp search and match test
plugin.  It defaults to re.M = False for backwards compatibility.  To use
the multiline feature add multiline=True to the test filter

{{ config | search('^hostname', multiline=True) }}
2016-03-06 08:11:46 -05:00
Kishin Yagami 299c18d700 Support strategy_plugins setting in a configuration file 2016-03-05 20:15:04 +09:00
Matt Clay 5b79ed77e7 Use to_bytes on filenames in filesystem calls. 2016-03-04 09:08:41 -08:00
夏恺(Xia Kai) b33074b703 remove main_q for simplicity.
main_q is not used anywhere in the codebase.

It is created in TaskQueueManager._initialize_processes, bundled with rslt_q
into TaskQueueManger._workers, later unwrapped in StrategyBase but not used.
This queue is closed in TaskQueueManger._cleanup_processes.

Historically, it is passed as a init parameter into WorkerProcess,
introduced in 62d7956, but this behavior is changed in 120b9a7.

Signed-off-by: 夏恺(Xia Kai) <xiaket@gmail.com>
2016-03-04 07:58:18 +00:00
Toshio Kuratomi 8f1303c81a Remember to use errors=strict since this is looking up a filename on the filesystem (ie it has to match exactly) 2016-03-03 20:56:50 -08:00
Toshio Kuratomi 253376b3b7 Make the source path into a byte string before passing to os.path 2016-03-03 20:44:01 -08:00
Brian Coca f565508d7f Merge pull request #14764 from bcoca/max_diff_config
made max diff size configurable
2016-03-03 18:19:27 -05:00
Brian Coca 6cad356b3b updated docs to show new output 2016-03-03 18:05:39 -05:00
Brian Coca b2a6784a9f changed the output to keep backwards compat
still shows path when verbose
2016-03-03 18:03:02 -05:00
Brian Coca fd8593d613 Merge pull request #14661 from jjshoe/fix-up-profile-tasks
Update the profile task callback plugin to include a fix for duplicate named tasks. Added additional features to adjust the number of tasks output and the sort order.
2016-03-03 17:46:40 -05:00
Brian Coca c24249c57d made max diff size configurable 2016-03-02 17:25:22 -05:00
Brian Coca ca0797fc4e avoid issues when stdin is a closed file
this seems to happen when nohup is involved, so the check tty
does not get a chance to fail, it just works with pipes

fixes http://github.com/ansible/ansible-modules-core/issues/3166
2016-03-02 11:58:16 -05:00
Matt Martz d0a717694f Fix variable name in paramiko connection plugin 2016-02-29 10:12:17 -06:00
Peter Sprygada f67bf3f775 updates the ops_template plugin action backup key
This commit changes the key the ops_template will search for in order
to backup the current configuration to local disk on the Ansible control
host.  This change was made to make ops_template consistent with the
other network template modules.
2016-02-28 23:40:05 -05:00
Toshio Kuratomi b70bf3b056 Use io.StringIO and io.BytesIO instead of StringIO.StringIO for compat with py3 2016-02-26 16:43:05 -08:00
Joel b3aa373932 Update the profile task callback plugin to include a fix for duplicate named tasks. Added additional features to adjust the number of tasks output and the sort order. 2016-02-25 10:02:36 -06:00
James Cammarata 2db3f290ba Fix logic error when copying files recursively to a directory 2016-02-23 16:29:57 -05:00
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
2016-02-23 15:07:06 -05:00
Brian Coca 6eb4633b07 always return a checksum key, even if empty 2016-02-23 15:07:14 -05:00
Matt Martz 3ac0143cf1 Merge pull request #13654 from sivel/paramiko-proxy-command
Add ProxyCommand support to the paramiko connection plugin
2016-02-23 11:30:43 -06:00
Brian Coca e35b1cf154 show task path on vv and above 2016-02-21 16:22:39 -05:00
Brian Coca cea10794fd removed unused color var 2016-02-21 02:03:48 -05:00
Brian Coca 6febb816d2 Merge pull request #14569 from sivel/json-stdout-callback
Add json stdout callback
2016-02-19 07:12:30 -08:00
George Christou bbc855c218 Make --diff lines of context configurable 2016-02-19 12:18:09 +00:00
Matt Martz 7f7536f7ad Add json callback to be used in replace of the default stdout to print a JSON structure to stdout 2016-02-18 16:39:31 -06:00
Matt Davis 4c58066153 Merge pull request #14557 from ansible/display-play-args
Add a configuration setting that allows the user to specify printing …
2016-02-18 07:40:50 -08:00
Brian Coca 5552c04976 allow skipping debug depending on verbosity 2016-02-18 06:58:43 -08:00
Toshio Kuratomi 86b8dc0e79 Add a configuration setting that allows the user to specify printing of task arguments in the header.
Fixes #14554
2016-02-18 04:20:35 -08:00
Brian Coca 1dba6da40f changed filtered to actionable cb plugin 2016-02-18 02:32:05 -08:00
Brian Coca 54942ee8ff Merge pull request #13593 from agaffney/devel
Add 'filtered' stdout callback plugin
2016-02-18 02:30:32 -08:00
Brian Coca 22082216a4 Merge pull request #13408 from sivel/v2-slack-callback
V2 slack callback plugin
2016-02-18 02:12:39 -08:00
Brian Coca 6012646d8c added playbook and options info to callbacks
will display on certain verbosity levels, both playbook/file info
and non empty options with which it's running.
avoid errors when not using CLI classes
2016-02-18 02:09:07 -08:00
Brian Coca 5300a2eafc Merge pull request #14491 from gechr/gc-simple-colour-diff
Add simple --diff colour support
2016-02-18 02:00:03 -08:00
Brian Coca 3e407ed743 Merge pull request #14490 from bcoca/stat_instead_of_checksum
Use stat module instead of checksum code
2016-02-18 01:45:50 -08:00
Brian Coca 2b5fffa751 updated to use to_unicode as per feedback 2016-02-18 01:41:23 -08:00
George Christou 56239ee347 Make --diff colours configurable 2016-02-17 10:25:54 +00:00
Brian Coca b9d0662faf use stat module instead of checksum code
- added new function for action plugins this avoids the very fragile checksum code that is shell dependant.
- ported copy module to it
- converted assemble to new stat function
- some corrections and ported temlpate
- updated old checksum function to use new stat one under the hood
- documented revamped remote checksum method
2016-02-16 08:43:38 -05:00
George Christou 8edcca0ef5 Add simple --diff colour support 2016-02-15 22:23:03 +00:00
Brian Coca 6dc910c13a shell + become fixes
1 less level of shell + quoting
simplified become commands, less quote and shell
2016-02-15 13:00:13 -05:00
James Cammarata 06b072c1f7 Fix bugs related to task_includes and dep chain inheritance
* Fix the way task_include fields were created and copied
* Have blocks get_dep_chain() look at task_include's blocks for proper
  dep chain inheritance
* Fix the way task_include fields are copied to prevent a recursive
  degradation

Fixes #14460
2016-02-13 01:02:47 -05:00
Peter Sprygada 22aaff5af7 adds new action plugin iosxr_template
This adds a new action plugin iosxr_template that allows the
iosxr_template module to pass network device configurations through the
template engine.  It also allows configurations to be backed up.
2016-02-12 17:08:21 -05:00
James Cammarata 275728e0f6 Fixing bugs related to nested blocks inside roles
* Make sure dep chains are checked recursively for nested blocks
* Fixing iterator is_failed() check to make sure we're not in a
  rescue block before returning True
* Use is_failed() to test whether a host should be added to the TQM
  failed_hosts list
* Use is_failed() when compiling the list of hosts left to iterate
  over in both the linear and free strategies

Fixes #14222
2016-02-12 13:39:39 -05:00
Brian Coca 00f600bfc8 Merge pull request #14319 from bcoca/shell_plugin_revamp
moved to base class for shell plugins
2016-02-12 13:08:12 -05:00
Sandra Wills edf776d6a4 Merge pull request #13805 from aioue/patch-1
profile_tasks README.md
2016-02-12 12:23:45 -05:00
Tom Paine edb36b6c4a Update profile_tasks.rst
remove brackets on links
2016-02-12 17:13:39 +00:00
Brian Coca af68ae1e87 switched from threading to multiprocessing
functions same, just keeping names from confusing people
2016-02-11 22:25:17 -05:00
Brian Coca a8aa5ff4eb fix cartesian lookup
it seems that this was not working in 1.9 but we swallowed up the error
fixes #14437
2016-02-11 10:35:37 -05:00
Peter Sprygada cf251258a8 initial add of new action plugin junos_template
This adds a new action plugin, junos_template that allows the
the junos_template module to perform the templating function.  It
implements net_template
2016-02-11 08:28:35 -05:00
Brian Coca 3079a03773 read full file when doing diff
but avoid reading file at all or full file when file is too big for diffing
2016-02-10 12:05:45 -05:00
Brian Coca b4b24a0889 moved to base class for shell plugins
fish now sets env vars correctly
fish checksum now works
fixed and cleaned up imports
fixed typo
2016-02-09 17:39:51 -05:00
Matthew Stoltenberg c90ab8856d paramiko transport appears to hang if it gets a sudo lecture
* bring paramiko transport closer to ssh transport in how it deals with prompt
2016-02-09 15:08:33 -07:00
Matthew Stoltenberg d36394d6a6 strip BECOME-SUCCESS at lower level
Fixes #14395
2016-02-09 13:03:18 -05:00
James Cammarata 162dd2594f Filter become success string from the stdout of script results
Fixes #14390
2016-02-09 12:34:15 -05:00
Toshio Kuratomi 0f15e59cb2 Also hide the before state of files with --diff and no_log 2016-02-08 22:05:46 -08:00
Toshio Kuratomi 06b2400aae Need to apply to_str to each element of the list so that we don't mix types in the join()
"Third time's the charm"
2016-02-08 20:28:55 -08:00
Brian Coca 81a40ac235 fix winrm erorr formatting 2016-02-08 23:00:19 -05:00
Tom Paine 8e3cc3eecd Update profile_tasks.rst 2016-02-08 19:19:05 +00:00
Brian Coca 46ce9a0016 Merge pull request #13883 from shaba/devel
Add support ssh configs from /etc/openssh.
2016-02-08 10:27:44 -05:00
Tom Paine 5a88cd8ad9 Rename profile_tasks.md to profile_tasks.rst 2016-02-08 15:02:50 +00:00
James Cammarata 1ea21f1f8c Also chmod the args file path when using become for old-style modules
Fixes #14348
2016-02-08 10:00:26 -05:00
Felix Fontein 8eea1c7e01 Allowing multiple tags to be specified in include's tags argument. 2016-02-06 21:19:03 +01:00
Tom Paine 9eca815377 Update profile_tasks.md
Converted to RST.
2016-02-05 18:06:10 +00:00
James Cammarata c79d9a9c62 Handle run_once scenarios in the free strategy
* Raise an error if the action is using BYPASS_HOST_LOOP, to prevent
  unexpected behavior from those actions
* Show a warning regarding tasks marked as run_once, as the free strategy
  does not yet support that behavior
* Minor tweak to linear strategies run_once code to make sure we don't
  raise an error if an action isn't found
2016-02-05 11:19:50 -05:00
James Cammarata 27f9cc05f8 Make sure run_once tasks also set any_errors_fatal so all hosts fail
Currently implemented only in the linear strategy (free strategy simply
ignores run_once/BYPASS_HOST_LOOP actions).

Fixes #14252
2016-02-05 10:58:24 -05:00
Peter Sprygada 18094d8595 Merge pull request #14313 from chouseknecht/net_template_changes
When in context of a role, create backup dir within role_path
2016-02-04 20:21:12 -05:00
Toshio Kuratomi e2a7ba35db Fix --diff to respect no_log task parameter. 2016-02-04 12:44:45 -08:00
chouseknecht 4f61fb6cce Add safety check on _backup key. 2016-02-04 14:47:43 -05:00
chouseknecht 0766219f58 When in context of a role, create backup dir within role_path 2016-02-04 14:47:43 -05:00
Peter Sprygada f30d5b1d94 Merge pull request #14012 from privateip/action_nxos_config
initial add of action plugin nxos_template
2016-02-04 11:41:41 -05:00
Peter Sprygada c7180cf1a5 Merge pull request #14011 from privateip/action_ops_config
initial add of action plugin ops_template
2016-02-04 11:41:29 -05:00