Commit Graph

322 Commits (28cf95e5855ad220e113f7a90c2a3856fb871419)

Author SHA1 Message Date
Daniel Hokka Zakrisson a79373f6b2 Make template_ds the only templater
Instead of having to remember when to use which one, rename template_ds
to template and move the last bit of code from template to varReplace
(which gets used for all string replacements, in the end).

This means that you can template any data type without worrying about
whether it's a string or not, and the right thing will happen.
2013-02-03 14:01:54 +01:00
Michael DeHaan f7aaa5ccc5 Fix copyright, unused imports 2013-02-02 13:06:48 -05:00
Michael DeHaan 857ccf7f6c Add random choice plugin (with_random_choice) 2013-02-02 13:02:47 -05:00
Daniel Hokka Zakrisson e166f71fcc Get output before receiving return code
Fixes hangs observed with large amounts of output, as it would get into
a dead-lock.
2013-01-29 00:38:07 +01:00
Daniel Hokka Zakrisson 4d71b31f7e Ensure destination and source are available before mangling them
Fixes #1918.
2013-01-25 23:14:52 +01:00
Daniel Hokka Zakrisson 35b58955d6 Fix paramiko for when no private key is specified 2013-01-21 21:48:02 +01:00
Tim Gerla 4c64d0d6be Expand ~ shell shortcuts for the --private-key argument 2013-01-20 13:16:29 -08:00
Daniel Hokka Zakrisson d11262af4d Fix raw (no executable) support on -c local 2013-01-13 15:16:13 +01:00
Daniel Hokka Zakrisson 5231be5d4b Add sudo password support for local 2013-01-13 15:16:13 +01:00
Daniel Hokka Zakrisson 7ecab22302 Move sudo command making to one common function 2013-01-13 15:16:13 +01:00
Jayson Vantuyl 13ddd39db9 add with_sequence lookup plugin
Plugin allows you to do easy counts for items.
2013-01-09 15:30:24 -08:00
Dag Wieers fb802beee7 In PR #1804 the use of C in script was moved to _low_level_execute_command()
So we cannot get rid of this one now.
2013-01-09 15:54:10 +01:00
Daniel Hokka Zakrisson 7782923ea2 Revert #1818 but avoid double-dwim, fixing relative fileglob 2013-01-09 14:52:52 +01:00
Daniel Hokka Zakrisson 891b1e371a Default to not using an executable
For compatibility with older releases as well as avoiding things like
action: raw executable= show status
to communicate with devices that don't have sh.
2013-01-09 14:15:47 +01:00
Daniel Hokka Zakrisson 92ad206b84 Use re instead of shlex.split to find executable
shlex.split will strip quotes and it might not even be sh at this point.
2013-01-09 14:13:53 +01:00
Dag Wieers b781438480 Clean up imports (taken from PR #1804) 2013-01-09 13:51:27 +01:00
Daniel Hokka Zakrisson 1b5d039bf4 Extend executable= support in raw to include no execuable
Useful for managing not-UNIX things.
2013-01-08 17:45:37 +01:00
Daniel Hokka Zakrisson 4955587d8c Merge pull request #1798 from dagwieers/raw-executable
Allow to change executable (shell/interpreter) when using raw
2013-01-08 08:35:08 -08:00
Daniel Hokka Zakrisson 637370089a Skip polling when all hosts were skipped
Fixes #1823.
2013-01-06 16:49:29 +01:00
Dag Wieers eb36ff45b9 Make script module use raw module so it does not require python 2012-12-24 00:24:34 +01:00
Dag Wieers 846161a1a4 Allow to change executable (shell/interpreter) when using raw
This patch adds an optional 'executable=' option to the raw command line to override the default shell (/bin/sh), much like the shell module does.
2012-12-23 20:49:02 +01:00
Dag Wieers 988db558b3 Add return code and error output to raw module
Since we use 'raw' heavily on equipment where 'command' and 'shell' are not (yet) working (and python may need to be installed first using raw) these improvements are necessary in order to write more complex scripts (with return code handling and separated stdout/stderr).

This change includes the following changes:

 - exec_command() now returns the return code of the command
 - _low_level_exec_command() now returns a dict, including 'rc', 'stdout' and 'stderr'
 - all users of the above interfaces have been improved to make use of the above changes
 - all connection plugins have been modified to return rc and stderr
 - fix the newline problem (stdout and stderr would have excess newlines)

In a future commit I intend to add assertions or error handling code to verify the return code in those places where it wasn't done. Since only the output was available, the return code was ignored, even though we expect them to be 0.
2012-12-23 18:04:54 +01:00
Daniel Hokka Zakrisson 97cc384ccf Set basedir to . if there isn't one
This avoids special-casing '' = '.' everywhere the basedir gets used.
Fixes #1729.
2012-12-19 13:22:57 +01:00
Daniel Hokka Zakrisson b73016b881 Make all lookup plugins work with lists
Lookup plugins should accept a string or a list, and always return
a list, even if it is just one item.
2012-12-15 21:47:16 +01:00
Daniel Hokka Zakrisson e54b4b1c9a Ignore arguments when checking for interpreter, and re-add before use 2012-12-02 14:28:52 +01:00
Daniel Hokka Zakrisson d5a456fbcf Merge pull request #1697 from bcoca/mint
Implements multiple interpreter overrides
2012-12-02 05:28:28 -08:00
Daniel Hokka Zakrisson f6245e17c1 Skip evaluating only_if for BYPASS_HOST_LOOP plugins 2012-11-28 21:37:30 +01:00
Daniel Hokka Zakrisson bda08c8a1b Avoid creating temporary directory for some action plugins
This ensures we don't litter remote systems with temporary directories
that don't get cleaned up, as well as speeds things up from not having
to touch every node.
2012-11-28 21:34:55 +01:00
Daniel Hokka Zakrisson f6e7381a71 Evaluate only_if in group_by 2012-11-28 16:22:58 +01:00
Brian Coca 2f2bd87b06 multiple _interpreter overrides with ansible_<bin>_interpreter variables, not
just for python anymore
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
2012-11-27 11:18:57 -05:00
Daniel Hokka Zakrisson d703f92077 Disable authentication methods that weren't specified 2012-11-27 15:24:33 +01:00
Stephen Fromm 6a68d3813f Set LANG in module_common.py
Add constant DEFAULT_MODULE_LANG that defaults to C.  Can be set via
environment variable ANSIBLE_MODULE_LANG or configuration variable
module_lang.  Updated test-module to have same behavior.
2012-11-27 00:16:06 -08:00
Michael DeHaan 33196ec131 Merge pull request #1669 from dagwieers/ssh-tcgetattr2
Use proper pseudo-tty's instead of pipes when using subprocess
2012-11-24 08:30:26 -08:00
Dag Wieers 7192eb3047 Use proper pseudo-tty's instead of pipes when using subprocess
This change avoids the "tcgetattr: Invalid argument" error by making sure the ssh we start does have a proper pseudo-tty.

We could also check whether our current terminal is a proper terminal (by doing a tcgetattr ourselves) but I don't think this adds anything.

This closes #1662 (if all use-cases have been tested: sudo, passwd)
2012-11-23 22:39:30 +01:00
Daniel Hokka Zakrisson db1a65342a Set -c local cwd to . if basedir is empty 2012-11-23 13:36:09 +01:00
Daniel Hokka Zakrisson ddef608c94 Wrap all remote commands in sh 2012-11-22 20:06:30 +01:00
Michael DeHaan 82f4aef959 Merge pull request #1648 from dhozac/local-cwd-basedir
Use runner's basedir as cwd for -c local
2012-11-21 06:40:01 -08:00
Dag Wieers 85bba04a1c Provide a proper error when the provided port is not an integer
As reported on the mailinglist, the user received a ValueError when the port number was not templated (fixed in #1649) and therefore it was not an integer. This change will catch the exception and provide a proper error so it is more clear.
2012-11-20 19:06:27 +01:00
Daniel Hokka Zakrisson 48898993b9 Fix removing of temporary files 2012-11-20 16:51:19 +01:00
Daniel Hokka Zakrisson 0ebf4b2d5a Add destination path to fetch result 2012-11-20 15:39:48 +01:00
Daniel Hokka Zakrisson bdf05ec9a0 Use runner's basedir as cwd for -c local 2012-11-20 15:36:43 +01:00
Daniel Hokka Zakrisson f89f07871d Fix typo in first_available_file error path 2012-11-19 23:02:26 +01:00
Daniel Hokka Zakrisson f95fefd8c5 Use plugin system to find modules 2012-11-18 19:09:21 +01:00
Daniel Hokka Zakrisson d2abfb9ff8 Ensure runner adds its basedir, so ansible can benefit from plugins 2012-11-18 18:37:20 +01:00
Daniel Hokka Zakrisson 5183417de8 Reinstate ANSIBLE_KEEP_REMOTE_FILES
Fixes #1395.
2012-11-18 18:32:45 +01:00
Daniel Hokka Zakrisson 11175781b8 Use slurp for fetch is sudo is enabled and needed
Fixes #1020.
2012-11-18 17:54:00 +01:00
Daniel Hokka Zakrisson 11afd84d32 Drop dwim prefix from returned items in fileglob
Fixes #1618.
2012-11-18 00:25:38 +01:00
Michael DeHaan 3bc0adacbf Merge pull request #1634 from dhozac/ssh-password
Add password support to -c ssh via sshpass
2012-11-17 07:37:51 -08:00
Daniel Hokka Zakrisson e6fed9f216 Add password support to -c ssh via sshpass 2012-11-16 23:46:49 +01:00
Daniel Hokka Zakrisson 021172f78d Use the configured remote_tmp even for root 2012-11-16 23:46:17 +01:00