Commit Graph

24 Commits (8475a92dec781dfe75aab46b94be6795a44338b4)

Author SHA1 Message Date
Michael DeHaan 3d25b4a7c0 Standardize args/kwargs on connection plugins. 2013-04-05 14:50:15 -04:00
Dag Wieers d5d26bab9b Make private key customizable per host using ansible_ssh_private_key_file configurable as variable
This fixes issue #1026 for @toshywoshy together with ansible_ssh_user and ansible_ssh_port.
2013-04-05 14:50:15 -04:00
Michael DeHaan 0b4ad2749a Increase error handling in the unlikely case of failing to establish a connection. 2013-03-01 21:39:50 -05:00
Shaun Zinck e7719e4e46 pass in int() args to get_pty
If LINES or COLUMNS was set, get_pty was failing because it was
expecting an int value to be passed in.
2013-02-24 13:39:03 -06:00
martin f. krafft ab39909260 Initialise PTY from calling environment
If we need to acquire a PTY for sudo's use, then it should really
inherit the capabilities of the calling environment. This is what
OpenSSH does, and so it makes sense to copy this behaviour for the
paramiko connection type.

Closes: #2065
Signed-off-by: martin f. krafft <madduck@madduck.net>
2013-02-15 10:23:34 +13:00
martin f. krafft 1cf43e9afe Only allocate a PTY when sudo is used
Postpone the paramiko.Channel.get_pty until we know sudo is used. If
sudo is not used, then we do not need a PTY. In fact, the paramiko docs
explicitly state that it's not desirable to allocate a PTY for a simple
exec_command.

Signed-off-by: martin f. krafft <madduck@madduck.net>
2013-02-15 10:17:43 +13:00
Daniel Hokka Zakrisson a1e00c93e5 Add ansible_ssh_user/pass to enable inventory-defined users 2013-02-10 23:22:18 +01: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 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 7ecab22302 Move sudo command making to one common function 2013-01-13 15:16:13 +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
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 ddef608c94 Wrap all remote commands in sh 2012-11-22 20:06:30 +01:00
Daniel Hokka Zakrisson 1052dd9c8f Initialize sftp variable to fix error on transferless session 2012-10-26 23:54:21 +02:00
Michael DeHaan 5e2c2564bc Explicitly execute /bin/sh versus $SHELL because some folks have very incompatible/weird shells. We do not
execute modules through the shell, this is only for basic ops, so should be sufficient.
2012-10-25 23:00:07 -04:00
Michael DeHaan ff787146d1 stray debug 2012-10-25 22:24:15 -04:00
Michael DeHaan 24416b9e49 Remove stray debug message 2012-10-25 22:19:50 -04:00
Michael DeHaan 3257c5b61f Some caching improvements to paramiko which are still not yet fully leveraged
in playbook mode, since the Runner still closes abstract host connections completely
and does not have a LRU.
2012-10-25 22:09:54 -04:00
Michael DeHaan 4c83c274e0 Don't close paramiko SFTP multiple times in the same runner pass. Noticeable performance increase. 2012-10-25 21:49:28 -04:00
Michael DeHaan a69e59ab2b Allows delegate_to to use inventory host/port info. 2012-10-16 20:57:37 -04:00
Aleksej Romanov 0db5ccfecb Don't use ssh-agent if password is specified. 2012-09-27 14:57:06 +07:00
Michael DeHaan 3de4e45741 Move plugin directories 2012-08-21 20:32:21 -04:00