Commit graph

5522 commits

Author SHA1 Message Date
Ben Keith
1f82971283 Adding the inventory_file var back 2015-10-10 21:54:28 -04:00
Toshio Kuratomi
45a161b0a1 Merge pull request #12429 from edmstudio/devel
Update synchronize module plugin to work on OS X
2015-10-09 16:05:46 -07:00
Petr Mifek
6e035a3e94 Move nested function test for ipv6 to top level in synchronize module. 2015-10-10 00:01:22 +02:00
Brian Coca
45788fbfad <homer>doh!</homer> 2015-10-09 16:58:01 -04:00
Brian Coca
d24532757c remove fix for local_action/connection local that is now not needed 2015-10-09 16:53:17 -04:00
klshxsh
4a5e52b2d2 The serial keyword can be specified as a percentage, e.g '30%' or a number e.g. '3'; therefore it needs to be a string to allow both types 2015-10-09 21:34:37 +01:00
Brian Coca
b9d54e9a01 corrects previous fix to deal with missing item key in results dict 2015-10-09 13:01:32 -04:00
Brian Coca
abf2e13955 Revert "Track local_action internally to prevent it from being overridden"
This reverts commit 49ca0eb797.
2015-10-09 13:01:32 -04:00
Brian Coca
101c8785ec removed changes to make local action equate connection=local and brought it back to equate delegate_to=localhost 2015-10-09 13:01:32 -04:00
Brian Coca
bcb173996b Merge pull request #12695 from matburt/fix_cache_plugins_for_v2
Fix an issue where cache plugins weren't updated in certain scenarios
2015-10-09 11:39:58 -04:00
Brian Coca
fbf4cafab5 on skipped you 'might' not have an item, changed to getattr to avoid keyerror
fixes #12683
2015-10-09 11:28:11 -04:00
Matthew Jones
7da478a4f4 Fix an issue where cache plugins weren't updated
The first call to persisting facts would work due to the assignment of a
MutableMapping calling __setitem__ but subsequent module fact data would
not be propogated to the fact cache plugins because update() doesn't
invoke __setitem__.  This changes the behavior a little bit and ensures
set() is called on cache plugins.
2015-10-09 11:16:41 -04:00
Brian Coca
ec02b255c3 Merge pull request #12689 from soarpenguin/bugfix
Remove some warning of undefined name and fix classmethod syntax error.
2015-10-09 11:09:50 -04:00
James Cammarata
770032648a Show -> localhost for local_action tasks 2015-10-09 10:53:53 -04:00
James Cammarata
f415d39dfd Merge pull request #12690 from stelligent/devel
Use AWS_DEFAULT_REGION env var if none specified
2015-10-09 10:02:48 -04:00
James Cammarata
cfa62e7a2a Submodule pointer update 2015-10-09 09:50:16 -04:00
James Cammarata
868819f9fa Make sure shlex split is returning properly encoded strings
Fixes #12676
2015-10-09 09:49:27 -04:00
Shayne Clausson
55b3f9e4e5 Use AWS_DEFAULT_REGION env var if none specified 2015-10-09 10:27:36 +02:00
soarpenguin
b11ea17385 fix classmethod syntax error. 2015-10-09 12:46:31 +08:00
soarpenguin
5efa4d29e3 fix some warning of undefined name. 2015-10-09 12:43:42 +08:00
James Cammarata
59d655c543 Double echo temp directory name to handle spaces and ~ expansion both
Fixes #12667
2015-10-08 16:22:38 -04:00
Toshio Kuratomi
d1b98ec776 Correct typo 2015-10-08 08:44:25 -07:00
Toshio Kuratomi
2f5e817007 Do not mix byte str with unicode type 2015-10-08 08:31:12 -07:00
Toshio Kuratomi
01ba2e94c0 Wait until later to convert to byte strings for output
Also some pre-emptive python3 compat and a code simplification
2015-10-08 08:22:17 -07:00
Brian Coca
76feba00c4 avoid callbacks during syntax check and listing
fixes #12682
2015-10-08 10:15:48 -04:00
Brian Coca
4463ced8ba simpler safe output 2015-10-08 10:15:48 -04:00
James Cammarata
de792ba3c2 Improve handling of unicode errors
Fixes #12669
2015-10-08 10:04:15 -04:00
James Cammarata
5a0f5f1254 Load vars for localhost when created implicitly
Fixes #12666
2015-10-08 09:26:20 -04:00
Brian Coca
d8769c93c7 updated ec2 region description to add missing other env var 2015-10-07 16:41:58 -04:00
Brian Coca
c77733e64e added docs for commonly used region parameter in some ec2 modules 2015-10-07 15:52:06 -04:00
Brian Coca
638bc14566 now deps is always a list 2015-10-07 15:41:11 -04:00
Brian Coca
dac3684fd1 changed task color to dark gray to keep it from being confused with ignore/skip 2015-10-07 12:12:35 -04:00
Brian Coca
c459dd4e18 Merge pull request #12663 from Juraci/task-path
Displays the absolute path of a given task when verbosity is above level 3
2015-10-07 12:09:21 -04:00
James Cammarata
dbae110f6f Merge pull request #12660 from apollo13/fix_galaxy_init
Show a nice error if the role name is missing.
2015-10-07 10:31:47 -04:00
Juraci
e52950a939 Displaying task_path on task start when verbosity is more than 3 2015-10-07 10:11:50 -03:00
Juraci
254d6be520 Adding get_path method to Task class 2015-10-07 10:10:57 -03:00
Florian Apolloner
354383874f Show a nice error if the role name is missing. 2015-10-07 11:37:23 +02:00
=
345ce424c6 Explictly set the version of strict mode to use for powershell modules. 2015-10-07 06:24:37 +01:00
James Cammarata
9e364c2eb5 Don't modify results in callbacks
Fixes #12654
2015-10-06 21:43:43 -04:00
James Cammarata
8107c4efc7 Fixing a bug in galaxy parsing of text spec file lines 2015-10-06 21:25:28 -04:00
James Cammarata
7a815b7296 Force connection to local when localhost is delegated to 2015-10-06 20:37:57 -04:00
Toshio Kuratomi
97e8d25eb4 Fix for encoding errors when a command returns non-utf8 encoded values 2015-10-06 14:10:25 -07:00
Toshio Kuratomi
4f6f2c21e8 range vs xrange doesn't matter here and six.moves.range isn't available in six-1.3.0 (rhel7) 2015-10-06 12:19:03 -07:00
James Cammarata
5ae74f7d38 Version bump for 2.0.0-0.3.beta1 2015-10-06 08:19:20 -04:00
James Cammarata
d9b79b1bbc Also template the role name when loading roles
Fixes #12602
2015-10-06 03:33:08 -04:00
James Cammarata
9c9897805f More ansible-galaxy fixes for the old spec file format 2015-10-06 01:54:48 -04:00
James Cammarata
fb822a4305 Merge pull request #12637 from rcleere/rekey_fix
Fix ansible-vault rekey
2015-10-05 23:33:32 -04:00
James Cammarata
3b8eaf6128 Cleaning up some ansible-galaxy stuff 2015-10-05 22:59:08 -04:00
Ryan Cleere
0400ab8c0f Fix ansible-vault rekey 2015-10-05 16:41:34 -05:00
James Cammarata
d91b3c6b9d Make sure magic variables are available when templating vars_files
Also does some reorganization/cleanup on the magic vars/delegated
variable generation portions of VariableManager to make the above
possible.

Fixes #12633
2015-10-05 16:32:58 -04:00
James Cammarata
284bd118a0 Properly switch to the default transport when delegating from localhost 2015-10-05 16:32:58 -04:00
Brian Coca
6f88f79de9 removed dupe install code, now trap errors forom role.install 2015-10-05 13:04:12 -04:00
Brian Coca
f73329401b galaxy updates
better error reporting on fetching errors
use scm if it exists over src
unified functions in requirements
simplified logic
added verbose to tests
cleanup code refs, unused options and dead code
moved get_opt to base class
fixes #11920
fixes #12612
fixes #10454
2015-10-05 11:43:08 -04:00
Brian Coca
a3ed9fc131 updated to 'fixed' get_url so docs build again 2015-10-05 09:07:54 -04:00
Brian Coca
f3d0468726 updated submodule refs 2015-10-05 08:59:10 -04:00
James Cammarata
323012be2e Pop tags out of playbook include params
Fixes #12605
2015-10-05 08:41:34 -04:00
Toshio Kuratomi
10a4a4e986 Quote any file paths that we have to use with dd to copy.
This is because we pass the whole dd command string into the shell
that's running on the contained environment rather than running it
directly from python via subprocess without a shell.
2015-10-03 18:07:27 -07:00
Toshio Kuratomi
b83988d9fb Port libvirt_lxc connection plugin to v2 2015-10-03 17:42:49 -07:00
Toshio Kuratomi
567deb5ac2 Add explicit substitution of relative paths on the remote host just in case the connection programs do something unexpected. 2015-10-03 17:33:57 -07:00
Brian Coca
8528b20702 fixed usage text 2015-10-03 12:02:51 -04:00
Brian Coca
04a2b221b9 removed conflicting short options 2015-10-03 10:05:23 -04:00
James Cammarata
38528c8ef3 Show more info in the minimal callback for unreachable hosts
Fixes #12621
2015-10-03 01:41:57 -04:00
Toshio Kuratomi
613e87db6c FIx typo arg_path (not plural) 2015-10-02 19:55:32 -07:00
Brian Coca
4ba5ebd1c8 Merge pull request #12538 from yesbox/url_lookup_plugin_httperror_fix
Fix url lookup plugin HTTPError message not being reachable
2015-10-02 21:30:16 -04:00
Peter Sprygada
ab3239ecd7 added methods for retrieving vapp and vm 2015-10-02 18:01:35 -04:00
Toshio Kuratomi
10750214ea Since Connection.execute_command() returns bytes, deal with the repurcussions here. 2015-10-02 12:39:36 -07:00
Brian Coca
e2ae3215f6 corrected no_log for items and skipped tasks
corrected output from default callback
added new tests for no_log loops
updated makefile test to check for both positive and negative occurrences of no_log
2015-10-02 14:35:33 -04:00
James Cammarata
c28758d2a8 Merge branch 'ssh-args' of https://github.com/amenonsen/ansible into amenonsen-ssh-args 2015-10-02 13:38:00 -04:00
James Cammarata
82faba619e Also add args_path param to powershell shell plugin 2015-10-02 13:25:26 -04:00
James Cammarata
30d481ac57 Fix old-style (non-python) module support 2015-10-02 12:58:35 -04:00
Toshio Kuratomi
e40e08d799 Update core sumodule ref to fix docs 2015-10-02 09:22:43 -07:00
Abhijit Menon-Sen
b127221f50 Pass default None to getattr, remove repeated call 2015-10-02 21:26:25 +05:30
Abhijit Menon-Sen
96c4dc273a Set explicit default for ANSIBLE_SSH_ARGS
The earlier code behaved exactly as though this default had been set,
but it was actually handled as a(n unnecessary) special case inside the
connection plugin, rather than set as an explicit default.

If the default is overriden either in ansible.cfg or the environment,
the new code will continue to work (in fact, it won't know or care,
since it just uses the value set in the PlayContext).

This is submitted as a separate commit for easier review to address
backwards-compatibility concerns.
2015-10-02 21:26:25 +05:30
Abhijit Menon-Sen
1981bf2b95 Aggregate ssh arguments in PlayContext instead of the connection plugin
Using set_host_overrides() in the connection plugin to access the ssh
argument variables from the inventory didn't see group_vars/host_vars
settings, as noted earlier. Instead, we can set the correct values in
the PlayContext, which has access to all command-line options, task
settings, and variables.

The only downside of doing so is that the source of the settings is no
longer available in ssh.py, and therefore can't be logged. But the code
is simpler, and it actually works.

This change was suggested by @jimi-c in response to the FIXME in the
earlier commit.
2015-10-02 21:26:25 +05:30
Abhijit Menon-Sen
3ad9b4cba6 Rework additional ssh argument handling
Now we have the following ways to set additional arguments:

1. [ssh_connection]ssh_args in ansible.cfg: global setting, prepended to
   every command line for ssh/scp/sftp. Overrides default ControlPersist
   settings.
2. ansible_ssh_common_args inventory variable. Appended to every command
   line for ssh/scp/sftp. Used in addition to ssh_args, if set above, or
   the default settings.
3. ansible_{sftp,scp,ssh}_extra_args inventory variables. Appended to
   every command line for the relevant binary only. Used in addition to
   #1 and #2, if set above, or the default settings.
3. Using the --ssh-common-args or --{sftp,scp,ssh}-extra-args command
   line options (which are overriden by #2 and #3 above).

This preserves backwards compatibility (for ssh_args in ansible.cfg),
but also permits global settings (e.g. ProxyCommand via _common_args) or
ssh-specific options (e.g. -R via ssh_extra_args).

Fixes #12576
2015-10-02 21:26:25 +05:30
Toshio Kuratomi
f13d5201b8 Update module refs 2015-10-02 08:34:05 -07:00
Brian Coca
4c9f58a152 added no_log censoring to item output
should be last commit that fixes #12214
2015-10-02 09:11:41 -04:00
Brian Coca
ba4afcbbb6 added no_log to results
normalized outputs to use display class
cleaned up unused imports
2015-10-02 09:11:41 -04:00
Brian Coca
c27bd4fab0 {sudo,su}_user does not imply become 2015-10-02 09:11:41 -04:00
James Cammarata
57372906aa Pull host/group vars when adding hosts/groups
Fixes #12582
2015-10-02 02:47:09 -04:00
James Cammarata
aa3687d736 Fix syntax error for octal in encrypt methods 2015-10-02 02:27:57 -04:00
James Cammarata
538568305a Submodule pointer update for accelerate module fixes 2015-10-02 00:50:02 -04:00
James Cammarata
8ef78b1cf8 Fixing accelerated connection plugin 2015-10-02 00:50:02 -04:00
Brian Coca
3705d54485 fixed error reporting on splitter 2015-10-01 19:03:04 -04:00
Brian Coca
de2f62bd9e fixed error reporting for unkown become user 2015-10-01 18:58:16 -04:00
Brian Coca
6d6bfbc3d2 added missing import for pwd, was being obscured by exception catching and fallback 2015-10-01 18:56:30 -04:00
Brian Coca
a680ef66dd fixed vault password file script execution 2015-10-01 18:49:51 -04:00
Brian Coca
6b842d9c49 fixed incorrect data passing on certain events 2015-10-01 18:49:51 -04:00
Brian Coca
2463922306 fixed error reporting when missing redis import 2015-10-01 18:49:51 -04:00
Brian Coca
6e96188085 added missing entry for dealing with bcc 2015-10-01 18:49:51 -04:00
Brian Coca
6ec5abf1c3 fixed some pyflakes 2015-10-01 14:14:20 -04:00
Abhijit Menon-Sen
49b35ad5dd Remove mysterious old cruft
The two lines were added in 2673eb0a and modified in 60e1a1f8, but foo
is completely unused. Removing it doesn't break anything: out it goes!
2015-10-01 20:32:08 +05:30
Brian Coca
fe0e4f27ad Merge pull request #12584 from amenonsen/fixups
Remove an unwanted FIXME annotation
ok, confirmed we don't want to support it
2015-10-01 10:24:58 -04:00
Brian Coca
6c190aa8a4 updated ansible-doc to ignore more stuff that has been added to the module repos 2015-10-01 10:17:41 -04:00
Brian Coca
1a56a5c442 created debug method, renamed debug attribute to _debug 2015-10-01 10:17:41 -04:00
James Cammarata
deff045aa9 Fix bug caused by options not having start_at_task when used through adhoc
Fixes #12590
2015-10-01 10:09:58 -04:00
Toshio Kuratomi
a0920c06e1 Pull submodule refs to fix docs builds 2015-09-30 19:57:55 -07:00
Toshio Kuratomi
4dae7eeca1 Update submodule refs 2015-09-30 19:41:56 -07:00
Toshio Kuratomi
56fa9a5098 Port to v2 API 2015-09-30 19:39:07 -07:00
Toshio Kuratomi
d35c9a30fb Minor refactorings 2015-09-30 19:39:06 -07:00
Toshio Kuratomi
888bcd65a8 Create error messages instead of tracebacks. 2015-09-30 19:39:06 -07:00
Abhijit Menon-Sen
93515468c4 Remove an unwanted FIXME annotation
<crab> jimi|ansible: do you think it should be possible to add both
       foo:22 and foo:23 to the inventory?
<jimi|ansible> no

…so we don't want an invitation to FIXME.
2015-10-01 06:56:29 +05:30
Toshio Kuratomi
4cfcf5d61b Merge pull request #12568 from mgedmin/py3k
Python 3: fix most tests for ansible.module_utils.basic
2015-09-30 12:47:29 -07:00
Trond Hindenes
94cfbe7ee9 Get-AnsibleParam 2015-09-30 21:02:12 +02:00
James Cammarata
dcb8caf9e8 Remember if we already skipped tasks via --start-at-task
Fixes #12482
2015-09-30 14:12:38 -04:00
chouseknecht
57adf11262 Fix metadata description for galaxy_tags. 2015-09-30 13:36:28 -04:00
chouseknecht
f4690e3bfe Changing tag to galaxy_tag. 2015-09-30 13:36:23 -04:00
chouseknecht
8360a1b3f2 Replace categories with tags.
Also added --ignore-certs option for use with install and search commands. Helpful when
overriding server and server has self signed cert.
2015-09-30 13:36:17 -04:00
Abhijit Menon-Sen
0bb34fd076 Make «ansible-vault view» not write plaintext to a tempfile
CLI already provides a pager() method that feeds $PAGER on stdin, so we
just feed that the plaintext from the vault file. We can also eliminate
the redundant and now-unused shell_pager_command method in VaultEditor.
2015-09-30 22:13:36 +05:30
Brian Coca
bf06e36382 updated async to pass along no_log setting 2015-09-30 11:52:27 -04:00
Marius Gedminas
cc1e1648f5 Tweak comment style 2015-09-30 18:46:50 +03:00
Marius Gedminas
213029a21e Python 3: don't convert unicode to unicode 2015-09-30 18:46:49 +03:00
Marius Gedminas
c7be004c19 Python 3 has no dict.iteritems()
(Reminder: cannot use six here, module_utils get shipped to remote
machines that may not have six installed -- besides six doens't support
Python 2.4.)
2015-09-30 18:46:49 +03:00
Marius Gedminas
9f3e5ceb14 Make sure 'basestring', 'bytes' and 'unicode' are defined
Python 3 doesn't have 'basestring' and 'unicode'.

Python 2.4 doesn't have 'bytes'
2015-09-30 18:40:47 +03:00
Brian Coca
ddafed4403 Merge pull request #12528 from bcoca/task_logging
task logging revamp
2015-09-30 11:38:34 -04:00
Brian Coca
7b64126c9d pushed up openvz detection for cases of 'stacked' virtualization 2015-09-30 11:27:50 -04:00
Linus Unnebäck
45f9800754 facts: correctly detect docker inside a xen host 2015-09-30 17:08:21 +02:00
James Cammarata
3bd71d0619 Use delegated_to field for play context remote_addr, if none other exists
Fixes #12527
2015-09-30 09:27:29 -04:00
James Cammarata
40bdf09998 Merge pull request #12561 from srvg/anotherdirpy
Inject existing groups at InventoryDir initialization
2015-09-30 08:18:34 -04:00
James Cammarata
6fcd292c5e Merge pull request #12569 from amenonsen/fixes
Bring groups handling in ini.py up-to-date (trivial fix)
2015-09-30 08:16:14 -04:00
James Cammarata
dfa33d0f23 Tweak variable manager use in role includes to avoid test failures 2015-09-30 08:05:55 -04:00
Abhijit Menon-Sen
50d75f8d6d Bring groups handling in ini.py up-to-date
Since c8f2483d, ini.py expects to always be passed in a pre-created list
of groups, and can no longer deal sensibly with an empty list; this just
makes that expectation clear.
2015-09-30 15:13:37 +05:30
James Cammarata
a89412ecb1 Fail all hosts if a run_once task fails
Fixes #12563
2015-09-29 15:10:00 -04:00
James Cammarata
7173f587ed Allow delegate_to on a role again
Fixes #12560
2015-09-29 15:07:32 -04:00
James Cammarata
a3e913da62 Don't assume handlers exist in the same role (if any)
Fixes #12536
2015-09-29 14:52:43 -04:00
Serge van Ginderachter
7461ba9998 Inject existing groups at InventoryDir initialization
This fixes a corner case where ini files live in a subdir
of the main inventory directory.

Reproducing the original error:

mkdir -p inventory/ini
cat > inventory/ini/hosts << EOF
[www]
www1
EOF

$ ansible -i inventory/ all -m ping
ERROR! 'all'

(or without the [www] group, it would complain about 'ungrouped')
2015-09-29 18:16:05 +02:00
James Cammarata
79e364d98b Properly template role dependency names
Fixes #12505
2015-09-29 09:55:57 -04:00
Marius Gedminas
5edd6d9be4 Python 3: there's no basestring
Fixes another failing test.

(I don't want to do a global search/replace for 'basestring' because I
want to have unit tests covering each occurrence.  When I run out of
existing failing tests, I'll try to write new ones.)
2015-09-29 09:01:57 +03:00
Toshio Kuratomi
95ede22a1e Add a comment about the docker connection and usage by non-root users 2015-09-28 22:50:06 -07:00
Toshio Kuratomi
0e110d23f8 Misc cleanups and some fixes for docker connection plugin
* Remove extraneous imports
* Fix some error handling
* Enable pipelining
* Disable su since it doesn't work
* Add error message when installed docker is not recent enough to
  support this plugin
* Move nested functions to class level
* Make transport a class attribute
* Make exec_command, put_file and fetch_file more robust
2015-09-28 22:35:52 -07:00
Toshio Kuratomi
1d119a1f46 Cleanup some extraneous imports 2015-09-28 22:35:52 -07:00
James Cammarata
ffdba96668 Save the included directory for playbook includes for use as the basedir
Fixes #12524
2015-09-29 00:28:45 -04:00
Konstantin Manna
4226e49bc6 bugfix: statement had no effect => statement now has assumed effect 2015-09-28 23:33:48 -04:00
Konstantin Manna
1ccfeafa76 bugfix: use correct close calls 2015-09-28 23:33:32 -04:00
Brian Coca
c1ad96e5cf removed fixme as it is already implemented below. 2015-09-28 23:32:57 -04:00
RedRampage
922b5c8109 Removed deletion of salt by 'password' lookup
Removed deletion of salt param from lookup file by 'password' lookup_filter.
Old behaviour leads to constant changed status when two tasks uses same lookup,
one with 'encrypt' parameter, and other without.

For example:

    tasks:
      - name: Create user
        user:
          password: "{{ lookup('password', inventory_dir + '/creds/user/pass' ncrypt=sha512_crypt) }}"
          ...
    # Lookup file 'creds/user/pass' now contain password with salt
      - name: Create htpasswd
        htpasswd:
          password: "{{ lookup('password', inventory_dir + '/creds/user/pass') }}"
          ...
    # Salt gets deleted from lookup file 'creds/user/pass'
    # Next run of "Create user" task will create it again and will have 'changed' status
2015-09-28 23:28:01 +03:00
Toshio Kuratomi
12a2585e84 chroot plugin minor touchups:
* Disable su as it's not currently working 100% (and was disabled in v1).
* Move BUFSIZE out of the class to match other conenction plugins
* _connect shouldn't return self.
2015-09-28 13:16:56 -07:00
Toshio Kuratomi
7a4266e9c5 One more try -- the error message should reference the become method
requested via play context
2015-09-28 11:28:33 -07:00
Toshio Kuratomi
696cf32d63 Correct name of variable 2015-09-28 11:28:33 -07:00
Brian Coca
8d024c3747 Merge pull request #12472 from resmo/for_ansible
cloudstack: improvements and tests
2015-09-28 14:27:22 -04:00
Toshio Kuratomi
0dfa1fb43a Correct call to method typo 2015-09-28 11:24:00 -07:00
Toshio Kuratomi
d827325644 Re-order the methods in ssh.py so that methods needed for implementation are near and just above the relevant public methods.
Standard with the rest of the code base.
2015-09-28 10:34:02 -07:00
Toshio Kuratomi
37844a5c1b Update submodule refs 2015-09-28 09:47:16 -07:00
Toshio Kuratomi
c811668a4d Merge pull request #12546 from amenonsen/ssh-cleanups
A couple of ssh cleanups
2015-09-28 09:46:24 -07:00
Toshio Kuratomi
05af4c8e91 Merge pull request #12471 from amenonsen/pipelining
Make pipelining a connection variable
2015-09-28 09:02:43 -07:00
Abhijit Menon-Sen
38c7422da5 Move ControlPersist/Path checking into a separate method
This is also peripheral to what _build_command needs, can be improved
and tested independently, and so makes more sense in a separate method.

This commit doesn't change any functionality (and I've verified that it
works with the various combinations: control_path set in ansible.cfg,
ssh_args adding or not adding ControlMaster/ControlPersist, etc.).
2015-09-28 21:11:56 +05:30
Toshio Kuratomi
c3a05b1181 Update to fix one more doc error 2015-09-28 08:38:24 -07:00
Abhijit Menon-Sen
f33d541964 Move sshpass checking into a separate method
Checking for sshpass is peripheral to the calling code, so it's easier
to follow when the details are moved into a method.
2015-09-28 20:58:30 +05:30
Abhijit Menon-Sen
565c6f1ae7 Make ansible_pipelining a connection variable
SSH pipelining can be a significant performance improvement, but it will
not work if sudoers is configured to requiretty. With this change, one
could have pipelining enabled in ansible.cfg, but use sudo to turn off
requiretty in a separate play (or task) where pipelining is disabled:

    - hosts: foo
      vars:
          ansible_pipelining: no
      tasks:
        - lineinfile: dest=/etc/sudoers line='Defaults requiretty' state=absent
          sudo_user: root

(Note that sudoers has a complicated syntax, so the above lineinfile
invocation may be too simplistic for production use; but the point is
that a separate play can do something to disable requiretty.)
2015-09-28 20:55:14 +05:30
Toshio Kuratomi
fd267989fb Fix docs build 2015-09-28 08:23:12 -07:00
Toshio Kuratomi
69ebb899a7 Update submodule refs 2015-09-28 07:52:04 -07:00
James Cammarata
c860775b5d Another fix for --limit in adhoc 2015-09-28 10:39:33 -04:00
James Cammarata
babf47decb Clean up some bugs related to --limit on adhoc commands 2015-09-28 09:02:24 -04:00
James Cammarata
621575681a Merge pull request #12542 from amenonsen/qfix
Clarify why we add -q only for ssh
2015-09-28 08:18:31 -04:00
Abhijit Menon-Sen
2ce219b5af Clarify why we add -q only for ssh 2015-09-28 16:00:23 +05:30
Marius Gedminas
9b39af8e9a Python 3: the StringIO module is gone
Fixes 17 failing tests on Python 3.4, restoring the 8 failures we had
last Friday.
2015-09-28 09:28:53 +03:00
Jesper Geertsen Jonsson
353b549eb0 Fix HTTPError message not being reachable 2015-09-27 18:01:19 +00:00
James Cammarata
4cd810a674 Only append -q option for ssh if we're using ssh 2015-09-26 21:27:38 -04:00
James Cammarata
46984a067c Don't wrap vars from include_vars with UnsafeProxy 2015-09-26 15:16:46 -04:00
James Cammarata
abfeb104df Merge pull request #12529 from soarpenguin/bug-fix
fix no self pointer out of class.
2015-09-26 14:18:58 -04:00
Toshio Kuratomi
342bc97322 Port chroot conection plugin to the latest v2 connection API.
Also get pipelining working for people who look to chroot as an example
for their own connection plugins

Note: In the latest v2 API, action handles become but chroot doesn't
reliably handle become.  Maybe we need to add a has_become attribute
that the action can display an appropriate error.
2015-09-26 10:00:28 -07:00
Toshio Kuratomi
056a020357 Do not fail if /proc/uptime is not present
This can happen in chroot environments that don't have all of /proc
available
2015-09-26 10:00:28 -07:00
Toshio Kuratomi
ae66d01a33 Document how a command is executed on the remote machine
Helps connection plugin implementors understand how to structure
exec_command()
2015-09-26 10:00:28 -07:00
James Cammarata
6dd38c2a10 Fix parent attribute lookup to be default
Fixes #12526
2015-09-26 11:28:29 -04:00
James Cammarata
a1c38a3fda Adding delegate_to to Blocks 2015-09-26 11:28:01 -04:00
Brian Coca
bb6141ec41 renamed managed_syslog to no_target_syslog 2015-09-26 08:22:32 -04:00
Abhijit Menon-Sen
8251ab2e37 Update outdated comment
Since #12165 was merged, hostnames are properly validated.
2015-09-26 17:32:13 +05:30
Abhijit Menon-Sen
6ff4d40d74 Update outdated comment
We now use "sudo -n" instead of "sudo -k && sudo …"
2015-09-26 17:28:22 +05:30
soarpenguin
1ea66e234f fix logic judgment error. 2015-09-26 15:15:53 +08:00
soarpenguin
2caa52a981 fix no self pointer out of class. 2015-09-26 14:09:56 +08:00
Brian Coca
37a918438b task logging revamp
* allow global no_log setting, no need to set at play or task level, but can be overriden by them
 * allow turning off syslog only on task execution from target host (manage_syslog), overlaps with no_log functionality
 * created log function for task modules to use, now we can remove all syslog references, will use systemd journal if present
 * added debug flag to modules, so they can make it call new log function conditionally
 * added debug logging in module's run_command
2015-09-25 23:57:28 -04:00
James Cammarata
60e1a1f8eb Fix bug in nested lookup where pop is called indiscriminately 2015-09-25 17:16:56 -04:00
Brian Coca
191ae0831d fixed syntax error 2015-09-25 17:15:26 -04:00
Brian Coca
48412c13b2 fixed copy n paste typo on future code 2015-09-25 17:08:03 -04:00
James Cammarata
bb1101498d Clean up typo from cdc6c52 2015-09-25 16:58:27 -04:00
James Cammarata
cdc6c5208e Clean string data run through the template engine
Also strip UnsafeProxy off of low level srings and objects to ensure
they don't cause issues later down the road

Fixes #12513
2015-09-25 16:49:31 -04:00
James Cammarata
ae9b34b1d9 Fix for equality checking in Host to make sure things are like types 2015-09-25 16:49:31 -04:00
Toshio Kuratomi
fa9ea32a86 Fix test of whether a result has a failed host 2015-09-25 12:09:27 -07:00
Brian Coca
1c49e3b842 draft shared service code for modules, part of spliting service module 2015-09-25 11:26:21 -04:00
Toshio Kuratomi
41756be4d3 Update core module ref 2015-09-25 07:49:32 -07:00
Toshio Kuratomi
dcdcd9e9c5 Move is_executable to the toplevel of basic.py so we can utilize it from other code 2015-09-25 07:48:57 -07:00
James Cammarata
ccddda1ebc Merge pull request #12502 from mgedmin/py3k
Python 3: make test_variable_manager_precedence pass
2015-09-25 03:05:02 -04:00
James Cammarata
eb8d7dcd14 Make sure formatted strings don't bomb on tuples
Fixes #12501
2015-09-25 03:01:42 -04:00
James Cammarata
31d5f88a1d Use the task loop to calculate multiple delegated hosts
Due to the way we're now calculating delegate_to, if that value is based
on a loop variable ('item') we need to calculate all of the possible
delegated_to variables for that loop.

Fixes #12499
2015-09-25 01:41:09 -04:00
Toshio Kuratomi
a1428d6bed Remove tmp as a parameter to the connection plugins
There doesn't appear to be anything that actually uses tmp_path in the
connection plugins so we don't need to pass that in to exec_command.
That change also means that we don't need to pass tmp_path around in
many places in the action plugins any more.  there may be more cleanup
that can be done there as well (the action plugin's public run() method
takes tmp as a keyword arg but that may not be necessary).

As a sideeffect of this patch, some potential problems with chmod and
the patch, assemble, copy, and template modules has been fixed (those
modules called _remote_chmod() with the wrong order for their
parameters.  Removing the tmp parameter fixed them.)
2015-09-24 13:33:57 -07:00
James Cammarata
95b371dd60 Use AnsibleFileNotFound instead of AnsibleParsingError when YAML files are not found
And update portions of code to expect the proper error.

Fixes #12512
2015-09-24 16:27:25 -04:00
Toshio Kuratomi
0250beb68a Remove compress option from paramiko connection for now
It's not available on older versions of paramiko such as shipped in RHEL6
2015-09-24 13:18:00 -07:00
James Cammarata
12df9f2e31 Make hostvars more dynamic again to improve performance with large inventories
Fixes #12477
2015-09-24 13:53:44 -04:00
Abhijit Menon-Sen
82b33c381f We don't need even a token timeout here; just poll once
The process is already gone, so there's not going to be any new data
showing up on its stderr; we only want to make sure that we haven't
missed something that was already written. So polling once is enough.
2015-09-24 12:10:16 -04:00
Abhijit Menon-Sen
6e82df451a Clarify select() handling for ssh connections
This change is motivated by an ssh oddity: when ControlPersist is
enabled, the first (i.e. master) connection goes into the background; we
see EOF on its stdout and the process exits, but we never see EOF on its
stderr. So if we ran a command like this:

    ANSIBLE_SSH_PIPELINING=1 ansible -T 30 -vvv somehost -u someuser -m command -a whoami

We would first do select([stdout,stderr], timeout) and read the command
module output, then select([stdout,stderr], timeout) again and read EOF
on stdout, then select([stderr], timeout) AGAIN (though the process has
exited), and select() would wait for the full timeout before returning
rfd=[], and then we would exit. The use of a very short timeout in the
code masked the underlying problem (that we don't see EOF on stderr).

It's always preferable to call select() with a long timeout so that the
process doesn't use any CPU until one of the events it's interested in
happens (and then select will return independent of elapsed time).

(A long timeout value means "if nothing happens, sleep for up to <x>";
omitting the timeout value means "if nothing happens, sleep forever";
specifying a zero timeout means "don't sleep at all", i.e. poll for
events and return immediately.)

This commit uses a long timeout, but explicitly detects the condition
where we've seen EOF on stdout and the process has exited, but we have
not seen EOF on stderr. If and only if that happens, it reruns select()
with a short timeout (in practice it could just exit at that point, but
I chose to be extra cautious). As a result, we end up calling select()
far less often, and use less CPU while waiting, but don't sleep for a
long time waiting for something that will never happen.

Note that we don't omit the timeout to select() altogether because if
we're waiting for an escalation prompt, we DO want to give up with an
error after some time. We also don't set exceptfds, because we're not
actually acting on any notifications of exceptional conditions.
2015-09-24 12:10:16 -04:00
Toshio Kuratomi
03127dcfae remove the stdin return value from connection plugin exec_command() methods
The value was useless -- unused by the callers and always hardcoded to
the empty string.
2015-09-24 08:57:19 -07:00
James Cammarata
9d47eabfa4 Merge pull request #12506 from hyperized/devel
Add Weekday (0-6) as a number and add weeknumber (00-52)
2015-09-24 11:44:39 -04:00
Toshio Kuratomi
24b9e2e6d1 Update extras submodule ref 2015-09-24 07:18:23 -07:00
Gerben Geijteman
4c20964475 Add Weekday (0-6) as a number and add weeknumber (00-52) 2015-09-24 15:05:44 +02:00
Marius Gedminas
56f2a25bff Python 3: there's no 'unicode' 2015-09-24 12:53:48 +03:00
Marius Gedminas
6d4618f46f Python 3: there's no dict.iteritems() 2015-09-24 12:50:00 +03:00
Marius Gedminas
0624797375 Bugfix: if you define a custom __eq__, you must define a __hash__ too
Also, on Python 3 the stock object.__hash__ raises an error ("unhashable
type"), and we have code that uses Host instances as dict keys.
2015-09-24 12:46:06 +03:00
Marius Gedminas
a2bc6b4b26 Bugfix: if you define __eq__, you should define __ne__ too 2015-09-24 12:43:33 +03:00
Marius Gedminas
5d29a2eabd Python 3: shlex.split() wants unicode
On Python 2, shlex.split() raises if you pass it a unicode object with
non-ASCII characters in it.  The Ansible codebase copes by explicitly
converting the string using to_bytes() before passing it to
shlex.split().

On Python 3, shlex.split() raises ('bytes' object has no attribute 'read')
if you pass a bytes object.  Oops.

This commit introduces a new wrapper function, shlex_split, that
transparently performs the to_bytes/to_unicode conversions only on
Python 2.

Currently I've only converted one call site (the one that was causing a
unit test to fail on Python 3).  If this approach is deemed suitable,
I'll convert them all.
2015-09-24 12:36:05 +03:00
Toshio Kuratomi
5d3d9cfe0d Convert to byte strings to avoid UnicodeErrors
Fixes #12488
2015-09-23 15:24:17 -07:00