Commit Graph

692 Commits (d21a0287a2870986d67b3f956548864830d15148)

Author SHA1 Message Date
James Cammarata f4b3defcbf Set sudo in accelerate commands correctly
Fixes #4111
2013-09-15 20:20:22 -05:00
Michael Scherer 5e1828a524 add jail module, based on lxc and chroot connexion plugin 2013-09-15 17:26:48 +02:00
Hiroaki Nakamura 2357194b39 Add failed_when module variable.
Implementation note: Ternery operator trick for python prior to 2.5 is used.
(test and [when_true_value] or [when_false_value])[0]
http://stackoverflow.com/questions/394809/ternary-conditional-operator-in-python#comment1466794_394887
2013-09-10 08:34:01 +09:00
Serge van Ginderachter 4f9af7efad subelements lookup plugin 2013-09-09 23:45:55 +02:00
James Cammarata 6e9fa5019f Reverting HostVars change from a mapping back to a dictionary 2013-09-06 20:24:16 -05:00
James Cammarata 2a47f72139 Merge pull request #4049 from mscherer/fix_no_kerberos
Fix no kerberos
2013-09-06 07:10:10 -07:00
Michael Scherer f489702973 Also add back gssapi-keyex
While this is not currently implemented in openssh as far as I know,
there is patch floating around on the web and this may land one day
upstream.
2013-09-06 10:40:34 +02:00
Keiichi Mori 17c39b94a3 support GSSAPIAuth back
GSSAPIAuthentication has not been supported
due to PreferredAuthentications trick ( 2bdba17a85 )
2013-09-06 10:40:25 +02:00
James Cammarata ae9e38daf8 Change hostvars to a mutable mapping to more closely resemble a dict
Fixes #4030
2013-09-05 23:04:16 -05:00
James Cammarata 2cbf28385a Move check for accelerate mode deeper to account for ansible_connection
Fixes #4045
2013-09-05 20:20:25 -05:00
James Cammarata 20b0dc4abd Check for an empty executable passed into the accelerate plugin
This was breaking at least the script module, so it would seem best
to check for it and set it to the default executable value
2013-09-05 15:11:26 -05:00
James Cammarata 4bf506f683 Always run the accelerate module as the user specified in the play
Currently, the accelerate daemon will be run as the sudo_user if
specified, which is incorrect.
2013-09-05 12:04:48 -05:00
Scott Sturdivant 68bffb1233 Don't force accelerate connection for local actions. 2013-09-05 09:37:47 -06:00
James Cammarata f6e1bdabea Ensure ports are set correctly in accelerate module 2013-09-05 09:52:10 -05:00
guersam 64db327411 Fix: raise correct error in accelerate mode 2013-09-05 15:10:45 +09:00
Stephen Fromm d704b55860 Support using paramiko to set up accelerate connection
Adds original_transport attribute to Runner to track what the original
transport was before it is changed to 'accelerate'.
If using paramiko in original_transport, uses ParamikoConnection.  If
not, falls back to SSHConnection like before.
2013-09-04 13:57:03 -07:00
James Cammarata fff497a1ae Make sure the accelerated port is set to a sane value 2013-09-04 15:52:39 -05:00
James Cammarata cc21e5c90c Adding hostvars to injected variables in accelerate ssh runner
Also some minor cleanup of some fb* variables and functions, which
were remnants of the old fireball2 name

Fixes #4021
2013-09-04 15:29:46 -05:00
James Cammarata c0fecf87d1 Increase default socket timeout to 5 minutes 2013-09-04 09:47:40 -05:00
James Cammarata 2696135b3b Display error during launch of accelerated daemon
* also minor tweak to the # of retries in the connection attempt

Fixes #4012
2013-09-03 12:28:32 -05:00
James Cammarata 53c2f4c1bb Fix race condition on creating the temp directory for ControlPersist
Fixes #3943
2013-09-03 11:00:33 -05:00
James Cammarata d05c61d1f0 Merge branch 'devel' into fireball2
Conflicts:
	lib/ansible/playbook/__init__.py
	lib/ansible/playbook/play.py
2013-09-02 21:54:02 -05:00
James Cammarata d69d5c294f Renaming fireball2 as 'accelerate' and removing old references 2013-08-30 13:26:27 -05:00
James Cammarata 6f6efa268b Merge branch 'smoothify-defaults' into devel 2013-08-30 08:40:47 -05:00
James Cammarata 637d3070dc Allow default variables to be overridden by inventory variables 2013-08-29 17:21:28 -05:00
James Cammarata 9806f89a04 Revert "Construct the multiprocessing manager only once."
This reverts commit 1d13ec2da3.
2013-08-29 11:00:25 -05:00
James Cammarata 7d3ae9fc75 Fixing a few bugs related to fireball2
* ssh port not being picked up, always uses default of 22
* forgot to 'import time' in the fireball2 connection plugin
2013-08-28 19:27:18 -05:00
James Cammarata faf82bf841 Fix bug with fetch when using sudo: true
Fixes #3111
2013-08-28 13:24:16 -05:00
James Cammarata af1dd7075f Adding chunked file transfers to fireball2 2013-08-28 11:14:58 -05:00
James Cammarata 959138d00d Added accelerate_port to plays, and made it configurable 2013-08-28 11:14:58 -05:00
James Cammarata 167f185092 Initial support for running gather_facts through fireball2 2013-08-28 11:14:58 -05:00
James Cammarata b45342923c Initial support for sudoable commands over fireball2
Caveats:
* requiretty must be disabled in the sudoers config
* asking for a password doesn't work yet, so any sudoers users must
  be configured with NOPASSWD
* if not starting the daemon as root, the user running the daemon
  must have sudoers entries to allow them to run the command as the
  target sudo_user
2013-08-28 11:14:58 -05:00
James Cammarata 4b552457e7 Bail out correctly if socket.recv gets nothing (indicating a closed socket) 2013-08-28 11:14:58 -05:00
James Cammarata 86f01965cd Fireball2 module will now launch in a proper tmp path 2013-08-28 11:14:58 -05:00
James Cammarata 521e14a3ad Fireball2 mode working! 2013-08-28 11:14:58 -05:00
James Cammarata acc5d09351 Initial commit for the "fireball2" connection plugin
Still needs:
* chunked file transfer/receive
* should probably move all send/recv operations to separate
  functions to reduce code duplication
* initial connection setup over ssh? or do we handle that in runner?
2013-08-28 11:14:58 -05:00
Bruce Pennypacker cf6a76c814 changed ignore_md5_mismatch to validate_md5 2013-08-28 14:41:00 +00:00
Bruce Pennypacker 41c474d129 added optional ignore_md5_mismatch parameter 2013-08-28 14:16:57 +00:00
James Cammarata 8262f7bfac Merge branch 'with_items_and_complex_args' of https://github.com/lberruti/ansible into lberruti-with_items_and_complex_args 2013-08-22 23:01:11 -05:00
James Cammarata 462cd4f728 Merge branch 'pulls/fix-hostvars-inconsistancy' of https://github.com/ferringb/ansible into ferringb-pulls/fix-hostvars-inconsistancy 2013-08-22 13:56:34 -05:00
James Cammarata e6ad3b7792 Merge pull request #3895 from mscherer/fix_option_new_ssh
make sure ssh do not ask password
2013-08-22 10:26:54 -07:00
James Cammarata 157b697a83 Merge branch 'always_run-6' of https://github.com/stoned/ansible into stoned-always_run-6 2013-08-22 12:10:28 -05:00
James Cammarata af4f0bd008 Fix for "argument must be an int, or have a fileno() method" error
The issue was that, when forks == 1, the _executor() function was
being called with None for the value of new_stdin.

Fixes #3841, #3902
2013-08-21 22:45:34 -05:00
James Cammarata 978af89175 Disallow running async tasks with lookup plugins
Fixes #2897
2013-08-21 16:44:10 -05:00
James Cammarata 6bf5d19506 SSH connection plugin creates ControlPersist socket files in a secure directory
Files were being created in /tmp, but will now be created in $HOME/.ansible/cp/
Addresses CVE-2013-4259: ansible uses a socket with predictable filename in /tmp
2013-08-21 11:40:46 -05:00
Stoned Elipot f0743fc32a Introduce the 'always_run' task clause.
The 'always_run' task clause allows one to execute a task even in
check mode.

While here implement Runner.noop_on_check() to check if a runner
really should execute its task, with respect to check mode option
and 'always_run' clause.

Also add the optional 'jinja2' argument to check_conditional() :
it allows to give this function a jinja2 expression without exposing
the 'jinja2_compare' implementation mechanism.
2013-08-20 23:09:44 +02:00
Michael Scherer 2bdba17a85 make sure ssh do not ask password
For some reason, ssh seems to ask for password even when
PasswordAuthentication is set to no, adding PreferredAuthentications
with the 2 options removed do the trick.
2013-08-20 22:02:37 +02:00
Brian Harring 31061213fa Fix inconsistency in hostvars access.
Previously, hostvars would only expose a keys() list of hosts that had
been seen yet- however you could explicitly access the host if you knew
the name, and get the content that way.  This precludes template code
from being able to safely access information about other hosts if any
limiters/tags were in use.

Additionally, the object was inconsistent for hostvars['myhost'] access
and [x[1] for x in hostvars.items() if x[0] == 'myhost'] access; this is
due to the original derivation from the dict object.  .items() would be
handled by dict.items(), using the passed in setup_cache values without
using the actual lookup content.

This patch rebases the class implementation to a py2.6 dictmixin, fixing
those issues and restoring behaviour to match what the docs claim.
2013-08-19 23:57:08 -04:00
Michael Scherer 3aac187387 fix ssh connection plugin to work with ipv6 address
Due to various inconsistencies of ssh and sftp regarding ipv6 and
ipv4 handling, some special arguments must be passed, and the
ipv6 must be passed in a specific format.
2013-08-19 15:27:20 -05:00
Michael DeHaan dacd311474 Removing synchronize momentarily as it looks like this won't make 1.3 dates 2013-08-16 15:22:39 -04:00
Luca Berruti eee278e02b fix 2013-08-14 13:26:14 +02:00
Luca Berruti 5048218ab5 Fix: with_items and complex_args 2013-08-14 11:49:46 +02:00
Michael DeHaan bc02e20503 Merge branch 'rsynctake2' into devel
Conflicts:
	CHANGELOG.md
2013-08-11 16:22:36 -04:00
Abhijit Menon-Sen 1a90d01ba9 Fix some typos discovered during casual reading 2013-08-11 18:41:23 +05:30
Michael DeHaan f8c97d6e79 Style/docs cleanup, and also improve an error message. 2013-08-10 18:58:45 -04:00
Michael DeHaan aeb8649da5 Merge branch 'ansible-rsync-take2' of git://github.com/tima/ansible into rsynctake2 2013-08-10 18:31:45 -04:00
Michael DeHaan 4d1f447908 Merge pull request #3650 from bcoca/forking_optimizations
forking least possible
2013-08-10 15:29:19 -07:00
Michael Vogt 89bc43cab0 support i18n on sudo failure 2013-08-10 17:56:39 -04:00
Serge van Ginderachter 9991a530ab fix an encoding bug in copy content = lookup plugin
closes #3518
2013-08-10 17:37:04 -04:00
Michael DeHaan 66b29b6813 Merge branch 'feature/gh-3789-inventory-file' of https://github.com/resmo/ansible into devel 2013-08-10 17:11:48 -04:00
Michael DeHaan 1d13ec2da3 Construct the multiprocessing manager only once. 2013-08-10 09:32:46 -04:00
René Moser e8272e365d
implemented 'inventory_file' variable. Closes GH-3789. 2013-08-10 13:04:56 +02:00
Timothy Appnel 2288a11b6a Implemented setup method in rsync action module. 2013-08-09 21:24:50 -04:00
Timothy Appnel 4a9635e04e Straighten out local-remote-delegate logic in rsync action module. Force set delegate to local if one is not defined. 2013-08-09 21:24:49 -04:00
Timothy Appnel adbca9d251 Fixed identity key logic. 2013-08-09 21:24:47 -04:00
Timothy Appnel 9f170f579a Introduced ansible-rsync to core. 2013-08-09 21:24:46 -04:00
Chris Church 6ba4331161 Correctly check for failed status from an async task. Use runner_on_async_failed callback (instead of runner_on_failed) when an async task times out. Add runner_on_async_ok callback when a task is started in fire and forget mode. 2013-08-06 12:42:44 -04:00
Michael DeHaan 1c6b81233c Merge pull request #3692 from tima/action-init
Added support of an optional init method for action modules like rsync that need to alter the connection and other inject data before it's established.
2013-08-03 12:00:04 -07:00
Michael DeHaan 76fd769704 Merge pull request #3685 from mspaulding06/indexed_items
Indexed items lookup plugin
2013-08-03 11:36:51 -07:00
Michael DeHaan c0ab417ef9 Don't iterate across strings in with_nested. 2013-08-03 14:22:18 -04:00
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
Timothy Appnel 11beb38c66 Added support of an optional setup method for action modules like rsync that need to alter the connection and other inject data before it's established. 2013-07-29 19:10:43 -04:00
Matt Spaulding 5d15515bbf Add indexed_items lookup plugin 2013-07-28 13:54:17 -07:00
Vincent Hardion 09ef7751e1 Fix nested loop for more than 3 elements
- combine flatten list for each nested level instead once at the end
2013-07-24 14:19:13 +02:00
Brian Coca 576962d335 now if you set fork to 0 or a number higher than the number of hosts, it
will be readjusted to the number of hosts runner is going to deal with.
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
2013-07-23 20:44:06 -04:00
Michael DeHaan f0eafff1b4 Merge pull request #3621 from sergevanginderachter/rename2flattened
also rename plugin name in error message
2013-07-22 10:32:38 -07:00
Serge van Ginderachter b40295910d also rename plugin name in error message 2013-07-22 16:47:36 +02:00
Michael DeHaan 2fe25f19dc Fix to group_by module as a result of previous conditional upgrades. 2013-07-22 10:11:19 -04:00
Michael DeHaan e3f213e030 Fixup error reporting. 2013-07-22 08:35:31 -04:00
Michael DeHaan c07dd07767 Add raw copy support (raw=yes), tweak tempfile error message string. 2013-07-22 08:25:55 -04:00
Michael DeHaan 0cf5e5cec3 Merge branch 'devel' of git://github.com/bradleyy/ansible into together 2013-07-21 11:47:05 -04:00
Michael DeHaan 7f462a346a Work in progress on merging changed_when. 2013-07-21 10:34:47 -04:00
Michael DeHaan 88720516a1 Merge branch 'changed_when' of git://github.com/stoned/ansible into changed_when 2013-07-21 10:14:03 -04:00
Michael DeHaan 62b39d3de5 Fix for saving conditionals in variable expressions. 2013-07-21 08:52:00 -04: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
Stoned Elipot 667ad2480e Use AnsibleFilterError exception 2013-07-20 23:39:25 +02:00
Michael DeHaan e1167d6977 tweak indentation for 'make pep8' 2013-07-20 12:48:11 -04:00
Michael DeHaan 0f4229f6c4 Merge pull request #3462 from stoned/filtererror
Introduce exception AnsibleFilterError and use it in Jinja filters.  Ign...
2013-07-20 09:12:26 -07:00
Michael DeHaan f7dec4f8f4 Rename plugin. 2013-07-20 11:02:16 -04:00
Michael DeHaan 9dec701728 Merge pull request #3559 from sergevanginderachter/flat_list
Introduce flat_list lookup plugin
2013-07-20 07:59:44 -07: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 c98b20b2cf Slight style preferences. 2013-07-19 09:22:17 -04:00
Sharif Olorin 5fcbfa984d More informative error message on failure to resolve tmpdir 2013-07-19 09:19:40 -04:00
Sharif Olorin 1a7a779e88 Handle SSH failures when creating remote tmpdir
Bail out if the SSH command fails rather than continuing with an
empty tmp variable.
2013-07-19 09:19:26 -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
Serge van Ginderachter 730b368259 Introduce flat_list lookup plugin
- hosts: localhost
    gather_facts: False
    tasks:
    - debug: msg="{{item}}"
      with_flat_list:
      - a
      - - b
        - c
        - d
        - - e
        - f
        - - g
          - h
      - i
      - j
      - - k
        - l

  # note: main list or list (sub)items can also be set as a variable

  TASK: [debug msg="{{item}}"] **************************************************
  ok: [localhost] => (item=a) => {"item": "a", "msg": "a"}
  ok: [localhost] => (item=b) => {"item": "b", "msg": "b"}
  ok: [localhost] => (item=c) => {"item": "c", "msg": "c"}
  ok: [localhost] => (item=d) => {"item": "d", "msg": "d"}
  ok: [localhost] => (item=e) => {"item": "e", "msg": "e"}
  ok: [localhost] => (item=f) => {"item": "f", "msg": "f"}
  ok: [localhost] => (item=g) => {"item": "g", "msg": "g"}
  ok: [localhost] => (item=h) => {"item": "h", "msg": "h"}
  ok: [localhost] => (item=i) => {"item": "i", "msg": "i"}
  ok: [localhost] => (item=j) => {"item": "j", "msg": "j"}
  ok: [localhost] => (item=k) => {"item": "k", "msg": "k"}
  ok: [localhost] => (item=l) => {"item": "l", "msg": "l"}
2013-07-17 13:59:41 +02:00
Brian Coca 18cb155bd5 now ANSIBLE_KEEP_REMOTE_FILE acts as boolean
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
2013-07-14 22:08:36 -04:00
Bradley Young 23557b6e5a change the name from transpose to "together". Change to use itertools.izip_longest() rather than method cribbed from nested.py 2013-07-14 16:31:37 -07:00
Stoned Elipot eb45f07ae3 Introduce 'changed_when' keyword to override a task's changed status with the evaluation of a Jinja2 expression 2013-07-14 21:07:45 +02:00
Bradley Young ea93a36b10 Adding transpose lookup method. This will matrix transpose arrays that are passed in, and then work like items over the resulting list of lists. e.g.:
Transpose a list of arrays:
    [1, 2, 3], [4, 5, 6] -> [1, 4], [2, 5], [3, 6]
    Replace any empty spots in 2nd array with "":
    [1, 2], [3] -> [1, 3], [2, ""]
2013-07-11 23:45:03 -07:00