Commit Graph

65 Commits (4f9d330242f490f80d94c9c6fe5c6bba4cc94bc8)

Author SHA1 Message Date
James Cammarata ba38d6bc16 Adding support for hashed known_hosts entries
Fixes Issue #3716 - SSH known host checking needs to understand
hashed known hosts
2013-08-02 11:08:02 -05:00
Michael DeHaan 419661542b Added some pipes.quote ops to make sure paths with spaces in them are ok. 2013-07-20 18:28:11 -04:00
Michael DeHaan e1167d6977 tweak indentation for 'make pep8' 2013-07-20 12:48:11 -04:00
Michael Vogt 9caef884e1 fail early on the wrong sudo password instead of waiting until the timeout happens 2013-07-19 10:23:00 -04:00
Michael DeHaan 8a3ea0774a Update error message since user may have specified connection type via non command line or by default. 2013-07-19 09:09:04 -04:00
Michael DeHaan cf6e1f8db9 Make it possible to tell paramiko to not record new host keys, which can be slow with a large number of hosts.
-c ssh is preferred in most cases if you have ControlPersist available, otherwise if you are comfortable you
can turn off recording while leaving host key checking on, etc.
2013-07-05 22:06:54 -04:00
Michael DeHaan 2cb7c30834 Improve interlaced output prevention when asking for host key approval. 2013-07-04 18:17:45 -04:00
Michael DeHaan 1683d44d2e Lock around SSH connectivity to new hosts in host checking mode such that prompts for host approval
messages do not get interlaced.
2013-07-04 16:04:31 -04:00
Michael DeHaan ffadbc520a Enable paramiko to ask whether to add keys to known hosts. 2013-07-04 14:05:41 -04:00
Michael DeHaan 9db4f7a9a6 Makes host key checking the default behavior but can be disabled in ansible.cfg or by environment variable. 2013-07-03 16:47:20 -04:00
Michael DeHaan c265c761d0 Slight message tweak. 2013-06-30 18:27:15 -04:00
Arturas Slajus 9be93d6ac7 Better error for fireball + sudo mode. 2013-06-25 10:45:01 +03:00
Michael DeHaan 16709ecd76 Replace tab with spaces. 2013-05-19 19:26:30 -04:00
Dimos Alevizos e96bc981ce Set paramiko's logging level
Excplicity set paramiko's logging level to WARNING.
By default it inherits ansible's DEBUG logging level (set in
callbacks.py) and fills the log file with useless debug messages.
Obviously it only applies if log_path is set in ansible.cfg
2013-05-19 19:26:30 -04:00
Maykel Moya 60f24bb077 Remove unused modules 2013-05-18 23:11:47 +02:00
Maykel Moya f52e3dee70 Don't hardcode chroot executable path 2013-05-18 23:09:38 +02:00
Michael DeHaan 9073aa17ab Chroot also needs args/kwargs. 2013-04-05 14:50:15 -04:00
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
Brian Coca 82c3b4e685 now ssh connection plugin will only pass user as an option to ssh if it is
differnt from the current user. This should enable overrides for user in
.ssh/config w/o breaking any current functionality.

Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
2013-03-27 16:41:54 -04:00
Maykel Moya e898f30f78 Fix copyright 2013-03-06 02:40:34 +01: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
Michael DeHaan f7fb681bb2 Fix comment in chroot connection type 2013-02-23 11:56:24 -05:00
Michael DeHaan 5a1aef5372 Merge branch 'local-chroot-support-v2' of git://github.com/mmoya/ansible into testing 2013-02-23 11:51:11 -05:00
Maykel Moya 9a493ef388 Add support for running modules chrooted in a local dir
Adds 'chroot' connection for executing modules chrooted to
a local dir. Requires running ansible as root.

chroot dirs should be specified in the inventory like any
other host.

You can do things like:

$ sudo -E ansible -vvv -f 1 "./chroot1,./chroot2" -c chroot \
  all -m setup
$ sudo -E ansible-playbook -vvv -f 1 -i "./chroot1,./chroot2" \
  -c chroot some-playbook.yml

some-playbook.yml:
---
- hosts: all
  tasks:
    - name: echo something
      shell: echo "Yaaay!" >/tmp/foobar.txt
    - name: install less
      apt: pkg=less state=latest
2013-02-21 00:51:02 +01: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
fdavis 21a5c55921 Add ConnectTimeout=DEFAULT_TIMEOUT to ssh args 2013-02-06 23:42:04 -08: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 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
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 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 d703f92077 Disable authentication methods that weren't specified 2012-11-27 15:24:33 +01: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
Daniel Hokka Zakrisson bdf05ec9a0 Use runner's basedir as cwd for -c local 2012-11-20 15:36:43 +01:00
Daniel Hokka Zakrisson e6fed9f216 Add password support to -c ssh via sshpass 2012-11-16 23:46:49 +01:00
Michael DeHaan 096607eea4 Allow fireball to transfer binary files, fixup fireball docs, make fetch work with fireball. 2012-11-14 18:37:17 -05:00
Michael DeHaan 325025a5b6 Merge pull request #1574 from dhozac/ssh-moar-data
Make sure we get all data
2012-11-09 05:08:27 -08:00
Daniel Hokka Zakrisson e97a22603f Make sure we get all data 2012-11-09 11:24:57 +01:00