Commit graph

6326 commits

Author SHA1 Message Date
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
Brian Coca
de18bcb95f correct typo on error reporting
fixes #12495
2015-09-23 10:11:52 -04:00
Abhijit Menon-Sen
40f608a377 A bit more debugging output
We used to display input chunks earlier anyway, so this isn't making
things more verbose.
2015-09-23 22:35:14 +05:30
Abhijit Menon-Sen
9700d9c04f Fix typo in checking select results
It's possible for more than one fd to be set, so 'elif' is obviously not
the right thing to use.
2015-09-23 22:32:15 +05:30
James Cammarata
1164e83477 Remove unnecessary calls to save inventory restrictions since 81bf88b 2015-09-23 12:18:09 -04:00
Toshio Kuratomi
89a78ba16e Update submodule refs 2015-09-23 08:40:59 -07:00
James Cammarata
9e734df0ec Conditionally poll longer if we're still waiting for an auth prompt 2015-09-23 11:20:11 -04:00
Toshio Kuratomi
5f0f5363b6 Merge pull request #12487 from mgedmin/py3k
Fix one more failing test on Python 3
2015-09-23 08:18:17 -07:00
James Cammarata
2898e000a0 Don't use the connection timeout for the select poll timeout 2015-09-23 11:13:12 -04:00
Abhijit Menon-Sen
587054db2a Send initial data before calling select whenever possible
Without this, we could execute «ssh -q ...» and call select(), which
would timeout after the default 10s, and only then send initial data.
(This is a relic of the earlier change where we always ran ssh with
-vvv, so the situation where it would sit quietly never happened in
practice; but this would have been the right thing to do even then.)
2015-09-23 20:09:50 +05:30
James Cammarata
c9a004227e Improve error catching from malformed playbook data
Fixes #12478
2015-09-23 08:56:36 -04:00
James Cammarata
e8e1d9f6fb Apply --limit to inventory in adhoc commands
Fixes #12473
2015-09-23 08:28:38 -04:00
Marius Gedminas
95e655eb67 Python 3: there's no basestring
Fixes one failing test.

The long series of module_utils/basic.py fixes were all because
module_utils/basic is imported in ansible/inventory/script.py.
2015-09-23 10:04:26 +03:00
Marius Gedminas
2c4982b58d Python 3: there's no itertools.imap
Because the builtin map() acts like an iterator already.
2015-09-23 10:04:26 +03:00
Marius Gedminas
6708d56a21 Python 3: avoid long integer literals
Even Python 2.4 automatically promotes int to long.
2015-09-23 10:04:25 +03:00
Marius Gedminas
f5d4935197 Python 3: treat python as a function in module_utils/basic.py
NB: we can't use 'from __future__ import print_function', but luckily
print(one_thing) works fine on both Python 2 and Python 3 without that.
2015-09-23 10:04:25 +03:00
Marius Gedminas
e71a986e16 Python 3: avoid octal constants in module_utils/basic.py 2015-09-23 10:04:25 +03:00
Marius Gedminas
d2bec7f81f Python 3: avoid "except ..., e:" in module_utils/basic.py
Make the code compatible with Pythons 2.4 through 3.5 by using
sys.exc_info()[1] instead.

This is necessary but not sufficient for Python 3 compatibility.
2015-09-23 10:04:25 +03:00
James Cammarata
65630d2ce1 Fixing one more bug related to staticmethods in LookupBase 2015-09-23 02:33:32 -04:00
James Cammarata
cbbb270761 Cleanup bug from moving base lookup methods to staticmethods 2015-09-23 02:26:19 -04:00
Abhijit Menon-Sen
ac98fe9e89 Implement ssh connection handling as a state machine
The event loop (even after it was brought into one place in _run in the
previous commit) was hard to follow. The states and transitions weren't
clear or documented, and the privilege escalation code was non-blocking
while the rest was blocking.

Now we have a state machine with four states: awaiting_prompt,
awaiting_escalation, ready_to_send (initial data), and awaiting_exit.
The actions in each state and the transitions between then are clearly
documented.

The check_incorrect_password() method no longer checks for empty strings
(since they will always match), and check_become_success() uses equality
rather than a substring match to avoid thinking an echoed command is an
indication of successful escalation. Also adds a check_missing_password
connection method to detect the error from sudo -n/doas -n.
2015-09-23 01:55:00 -04:00
Abhijit Menon-Sen
840a32bc08 Reorganise ssh.py to cleanly separate responsibilities
The main exec_command/put_file/fetch_file methods now _build_command and
call _run to handle input from/output to the ssh process. The purpose is
to bring connection handling together in one place so that the locking
doesn't have to be split across functions.

Note that this doesn't change the privilege escalation and connection IO
code at all—just puts it all into one function.

Most of the changes are just moving code from one place to another (e.g.
from _connect to _build_command, from _exec_command and _communicate to
_run), but there are some other notable changes:

1. We test for the existence of sshpass the first time we need to use
   password authentication, and remember the result.
2. We set _persistent in _build_command if we're using ControlPersist,
   for later use in close(). (The detection could be smarter.)
3. Some apparently inadvertent inconsistencies between put_file and
   fetch_file (e.g. argument quoting, sftp -b use) have been removed.

Also reorders functions into a logical sequence, removes unused imports
and functions, etc.

Aside: the high-level EXEC/PUT/FETCH description should really be logged
from ConnectionBase, while individual subclasses log transport-specific
details.
2015-09-23 01:55:00 -04:00
James Cammarata
95c6fe88e4 Fix handling of conditional vars_files which contain variables
Fixes #12484
2015-09-23 01:26:24 -04:00
Toshio Kuratomi
c83f51b7f2 Some LookupBase cleanups:
* Make LookupBase an abc with required methods (run()) marked as an
  abstractmethod
* Mark methods that don't use self as @staticmethod
* Document how to implement the run method of a lookup plugin.
2015-09-22 16:19:36 -07:00
Toshio Kuratomi
049952fa50 Update submodule refs. 2015-09-22 14:01:53 -07:00
James Cammarata
1e7fd2196d Fixing synchronize + delegate_to user bug
Fixes #12464
2015-09-22 16:06:52 -04:00
James Cammarata
3ffc2783c4 Don't bomb out on handlers with undefined variables in their names 2015-09-22 12:42:02 -04:00
Toshio Kuratomi
4b0d52d2cb Merge pull request #12420 from ansible/win_prefix_modules
Fix for user defined modules not overriding modules from core.
2015-09-22 09:16:38 -07:00
James Cammarata
1076155d8d When failing because of vars_files templating, try and bubble up the file/line info 2015-09-22 12:13:55 -04:00
Toshio Kuratomi
18e2ee16ef Fix for user defined modules not overriding modules from core.
This fix takes into account that powershell modules are somewhat
different than regular modules and have to be kept separate.
2015-09-22 09:07:37 -07:00
Toshio Kuratomi
f61fb9787d Update submodule refs 2015-09-22 08:59:10 -07:00
Rene Moser
b43939dfd6 cloudstack: make tags handling idempotence
Credits to @jeffersongirao, who provided the patch.
2015-09-22 16:12:35 +02:00
James Cammarata
c30e464388 Additional tweaks to callback output for delegate_to 2015-09-22 09:25:38 -04:00
James Cammarata
513619867a Show delegated-to host in callback message
Fixes #12465
2015-09-22 08:45:04 -04:00
Rene Moser
efd122c2f0 cloudstack: add returns_to_int return handling into utils
It is not uncommon that the API returns string for int values e.g. ports in listFirewallRules or listPortForwardings,
2015-09-22 14:44:08 +02:00
Rene Moser
c9a3801a25 cloudstack: common argument_spec and requried_together to utils 2015-09-22 14:36:43 +02:00
James Cammarata
f563b22446 Merge pull request #12461 from mgedmin/py3k
Python 3: there's no basestring
2015-09-22 03:11:43 -04:00
James Cammarata
d2949f5449 Merge pull request #12463 from mgedmin/fix-ansible-doc
Fix option descriptions in ansible-doc output
2015-09-22 03:10:59 -04:00
James Cammarata
0fb4a6a67b Tweak to the way new host variables are created for delegated hosts 2015-09-22 03:03:21 -04:00
Marius Gedminas
339790adc4 Fix option descriptions in ansible-doc output
Fixes #12462.
2015-09-22 10:00:33 +03:00
James Cammarata
18adfc6d1a Set some default vars on hosts created for delegate_to connections 2015-09-22 02:35:01 -04:00
James Cammarata
a22f7b883d Restrict role param vars to tasks within that role
Fixes #12460
2015-09-22 02:14:18 -04:00
Marius Gedminas
fc0dcc3947 Python 3: there's no basestring
Fixes one failing test.

Now technically a filename can be a bytestring, even on Python 3.  I
hope this is unlikely for Ansible.
2015-09-22 08:42:33 +03:00
James Cammarata
ecf7d8c9ee Fix relative path bug in copy action
Without rebreaking #12055

Fixes #ansible-modules-core/2098
2015-09-22 01:31:03 -04:00
James Cammarata
53794b692c Merge pull request #12457 from ansible/warn-if-core-modules-not-present
Detect if core modules aren't installed and warn if that is the  case
2015-09-21 21:15:54 -04:00
Toshio Kuratomi
627f9d73ba Detect if core modules aren't installed and warn if that is the case
Fixes #11206
2015-09-21 12:31:51 -07:00
Brian Coca
d27b73e7b5 fixed case in which boto3 is present but module is not using it yet 2015-09-21 15:16:07 -04:00
James Cammarata
cb7060c9fe Allow undefined var errors to bubble up when templating vars_files in certain conditions
Follow up to 8769f03c, which allows the undefined var error to be raised
if we're getting vars with a full context (play/host/task) and the host
has already gathered facts. In this way, vars_files containing variables
that fail to be templated are not silently ignored.
2015-09-21 11:57:37 -04:00
Brian Coca
f96255f7fd fixed typo 2015-09-21 10:10:21 -04:00
James Cammarata
86566e691a Merge pull request #12447 from mgedmin/py3k
Python 3: there is no 'basestring'
2015-09-21 09:39:17 -04:00
James Cammarata
8769f03c16 Also catch AnsibleUndefinedVariable errors when templating vars_files names
Fixes #12449
2015-09-21 09:35:06 -04:00
Toshio Kuratomi
2a614c1c0f Close module file once we're done reading from it 2015-09-21 01:46:29 -07:00
Marius Gedminas
9cdb6ebae3 Python 3: there is no 'basestring'
This fixes a failing unit test.

In actual use (which is still quite far), I'm not sure if bytes ->
unicode conversion should be done here (in which case the code will fail
with an AttributeError: 'bytes' object has no attribute 'readlines'), or
inside self._connection.exec_command() (in which case my change is
correct).
2015-09-21 08:48:59 +03:00
Victor Salgado
20bbd66e85 Use dict.get() 2015-09-20 22:54:02 -03:00
James Cammarata
65bf14cbb0 Merge pull request #12431 from hslee16/devel
Stops using _groups_list to check for host when using 'add_host'
2015-09-20 18:17:02 -04:00
James Cammarata
88e1aa94fa Add play context vars to list of variables before post validation
Fixes #12437
2015-09-19 21:51:24 -04:00
James Cammarata
05f6e76407 Template handler names before checking to see if they need to run
Fixes #12427
2015-09-18 18:54:48 -04:00
James Cammarata
72769d1899 Merge pull request #12432 from mgedmin/py3k
Python 3: there's no xrange
2015-09-18 15:33:08 -04:00
James Cammarata
37f2cbc429 Merge pull request #12436 from amenonsen/ranges
Support «hosts: foo[1:]» and add tests for split/apply_subscript
2015-09-18 15:32:15 -04:00
James Cammarata
1f5584aa5b Refactoring delegate_to code
Now, instead of relying on hostvars on the executor side, we compile
the vars for the delegated to host in a special internal variable and
have the PlayContext object look for things there when applying task/
var overrides, which is much cleaner and takes advantage of the code
already dealing with all of the magic variable variations.

Fixes #12127
Fixes #12079
2015-09-18 15:25:10 -04:00
James Cammarata
fa69e8ebb8 Fixing some bugs in _compute_delegate() in TaskExecutor
* Clearing interpreter settings from variables, so those set for the
  original host aren't incorrectly applied to the delegated to host
* Fixed incorrect string for remote user in delegated hosts hostvars
* Properly looking for multiple possiblities in the delegated-to hosts
  hostvars (ansible_ssh_host vs. ansible_host)
2015-09-18 15:25:10 -04:00
Peter Sprygada
e45b71d6cd added new module object to vca 2015-09-18 13:45:37 -04:00
Abhijit Menon-Sen
2fcdb37e7b Support «hosts: groupname[1:]» notation (~= 'the rest of the group') 2015-09-18 22:28:34 +05:30
Brian Coca
aca83b15e5 Merge pull request #12425 from privateip/devel
initial add of vca common module
2015-09-18 11:24:54 -04:00
Brian Coca
11707576a3 fix for AIX network facts
fixes #12434
2015-09-18 10:43:53 -04:00
Brian Coca
d7b61db6dc made boto3 non mandatory 2015-09-18 08:05:33 -04:00
Toshio Kuratomi
fdb1c14004 Update the submodule pointers 2015-09-18 04:49:30 -07:00
Petr Mifek
27f779a7cc Small clean up and refactor of the rsync target ipv6 observing formatter for synchronize action. 2015-09-18 11:46:33 +02:00
Marius Gedminas
baf9320369 Python 3: there's no xrange
Use six.moves.range instead (aliased to xrange on Python 2, aliased to
range on Python 3).

Also I couldn't resist replacing the elaborate chr/ord/randrange dance
with the simpler random.choice(string.ascii_lowercase) that was already
used elsewhere in the Ansible codebase.
2015-09-18 08:52:26 +03:00
Alex Lee
cf289191e5 return None if group does not exist in inventory groups 2015-09-17 15:58:10 -07:00
Petr Mifek
6f3f4dff7a Change synchronize module plugin to be backwards compatible with RSync 2.6.9 with regard to handling IPv6 addresses. 2015-09-17 23:19:11 +02:00
James Cammarata
cc6627cdd6 Remove custom json encoder cleaner and strip proxy var stuff out before encoding
Fixes #12349
2015-09-17 16:04:47 -04:00
James Cammarata
c95d4ca05f Properly assign search path to environment.loader in template lookup
Same fix as was applied in f162990c to the action plugin

Fixes #12355
2015-09-17 14:47:20 -04:00
James Cammarata
bde5ed9672 Catch worker errors that may be subclassed on others that lead to incorrect exits 2015-09-17 14:46:53 -04:00
Peter Sprygada
8f43d222c0 initial add of vca common module 2015-09-17 14:41:53 -04:00
James Cammarata
053c41e79d Fix typo in ansible module_utils import from galaxy code 2015-09-17 14:25:48 -04:00
Chrrrles Paul
7b778d8a4b Merge pull request #12424 from amenonsen/ipv6-ranges
Tested.  Thanks for spotting and then fixing this -- Allow hexadecimal ranges in IPv6 addresses, not only 0-9
2015-09-17 14:21:03 -04:00
Abhijit Menon-Sen
2d420a9bb7 Allow hexadecimal ranges in IPv6 addresses, not only 0-9 2015-09-17 23:32:58 +05:30
James Cammarata
b386f0c64d Merge pull request #12423 from amenonsen/split-fixup
Remove deprecation warning; now handled in _split_patterns
2015-09-17 14:02:22 -04:00
James Cammarata
a1fffff92c Merge branch 'addresses' of https://github.com/amenonsen/ansible into amenonsen-addresses 2015-09-17 13:43:05 -04:00
Abhijit Menon-Sen
62ca6b5e35 Remove deprecation warning; now handled in _split_patterns 2015-09-17 23:09:56 +05:30
Abhijit Menon-Sen
575a8b8c77 Merge Host.ipv[46]_address into .address
The earlier distinction was never used; .ipv6_address was always a copy
of .ipv4_address, and the latter was always used to set the remote_addr
field in the PlayContext.

Also uses the canonical ansible_host/ansible_port names when setting the
address and port from variables.
2015-09-17 23:03:48 +05:30
James Cammarata
951128d7a6 Merge branch 'hostpatterns' of https://github.com/amenonsen/ansible into amenonsen-hostpatterns 2015-09-17 13:31:51 -04:00
Victor Salgado
14fefebaad Modify _split_pattern to use map when working with list input 2015-09-17 13:52:54 -03:00
James Cammarata
46baed864f Submodule update after correcting doc bug 2015-09-17 11:30:38 -04:00
James Cammarata
0beb37a121 Submodule update 2015-09-17 11:26:54 -04:00
James Cammarata
ba82e57445 Merge branch 'sudo_on_if_needed' of https://github.com/apollo13/ansible into apollo13-sudo_on_if_needed 2015-09-17 11:03:27 -04:00
Toshio Kuratomi
8532ddd5ed typo in formatting the warning message 2015-09-17 08:01:43 -07:00
Toshio Kuratomi
4ae5512fb0 Restore python3 compat fix and fix AnsibleError undefined before use 2015-09-17 07:45:21 -07:00
James Cammarata
c881b1acae Merge pull request #12407 from mgedmin/py3k
Python 3: basestring in play_context.py
2015-09-17 10:40:57 -04:00
James Cammarata
8acbc00853 Fixing groups variable structure to match v1
Fixes #12418
2015-09-17 10:24:03 -04:00
Abhijit Menon-Sen
349eec7855 Fix missing colon (typo) in IPv6 pattern 2015-09-17 19:34:33 +05:30
Abhijit Menon-Sen
2405861a9e Use ',' instead of ':' or ';' to separate host patterns
The earlier-recommended "pat1:pat2:pat3[x:y]" notation doesn't work well
with IPv6 addresses, so we recommend ',' as a separator instead. We know
that commas can't occur within a pattern, so we can just split on it.

We still have to accept the "foo:bar" notation because it's so commonly
used, but we issue a deprecation warning for it.

Fixes #12296
Closes #12404
Closes #12329
2015-09-17 19:31:16 +05:30
Florian Apolloner
d9f873495e Ported over #7158 to support SELinux context switches. 2015-09-17 15:03:46 +02:00
Brian Coca
ee840f3029 fixed function signature 2015-09-17 07:47:51 -04:00
Florian Apolloner
decd9e8710 Only use become if the target user difers from the current remote user. 2015-09-17 12:24:16 +02:00
Marius Gedminas
8243954dcd Python 3: basestring in play_context.py 2015-09-17 08:08:55 +03:00
Toshio Kuratomi
3db8070aa3 Fix urlopen usage to use open_url instead
Add a travis test for urlopen usage
2015-09-16 20:40:17 -07:00
James Cammarata
e97d448838 Cleanup one more missed inventory bug 2015-09-16 16:53:08 -04:00
James Cammarata
5db9e38377 Merge pull request #12345 from mgedmin/py3k
Python 3: two more instances of 'basestring'
2015-09-16 16:49:46 -04:00
Chris Church
43b15ab9a4 Merge pull request #12385 from cchurch/winrm_put_empty_file
Enable winrm put_file to upload an empty file.
2015-09-16 16:46:01 -04:00
Chris Church
93af0b327f Merge pull request #12384 from cchurch/powershell_strict_mode
Add PowerShell exception handling and turn on strict mode.
2015-09-16 16:45:40 -04:00
Chris Church
0325f92b6a Merge pull request #12054 from cchurch/winrm_options
Support additional options for WinRM connections via inventory variables
2015-09-16 16:39:18 -04:00
Chris Church
c5409ab493 Remove ansible_winrm_ host/port/user/pass options, update exception handling around establishing a winrm connection. 2015-09-16 16:38:19 -04:00
Chris Church
056c6b77d0 Support additional options for WinRM connections via inventory variables. 2015-09-16 16:38:18 -04:00
James Cammarata
11c27078c0 Cleaning up inventory bugs from earlier group change 2015-09-16 16:36:27 -04:00
Chris Church
1d15e8f37a Pass windows command as-is without splitting/rejoining parameters.
* Fixes extra spaces added between parameters from https://github.com/ansible/ansible-modules-core/issues/1929
* Correctly decode PowerShell command encoded as UTF-16-LE so that it displays correctly in debug messages, fixes the other issue from https://github.com/ansible/ansible-modules-core/issues/1929
* Add test to verify that script parameters are passed as-is, so $true is interpreted as a boolean, fixes https://github.com/ansible/ansible/issues/10947
2015-09-16 16:30:10 -04:00
Victor Salgado
54f1560d3e Fix mutable default argument 2015-09-16 16:49:45 -03:00
James Cammarata
33e79203ce Merge branch 'quinot-topic/crash_empty_inventory' into devel 2015-09-16 13:15:40 -04:00
James Cammarata
c8f2483d6d Cleaning up default group creation in inventory parsers 2015-09-16 12:54:54 -04:00
Toshio Kuratomi
30552cf7e9 Fix problems with undefined references to self.display and remove method that's no longer called 2015-09-16 09:27:28 -07:00
James Cammarata
3f8e12d1f7 Merge pull request #12359 from cchurch/fetch_no_fail_on_missing
Fix fetch to not fail for missing file when fail_if_missing=False
2015-09-16 11:05:39 -04:00
James Cammarata
4429e7611b Merge pull request #12382 from AxelDelmas/env_async
Added env_string in async_cmd
2015-09-16 11:04:40 -04:00
James Cammarata
e899b8e70d Merge branch 'topic/crash_empty_inventory' of https://github.com/quinot/ansible into quinot-topic/crash_empty_inventory 2015-09-16 10:08:43 -04:00
James Cammarata
b2848bd25f Merge pull request #12389 from amenonsen/minus-t
Set PlayContext.timeout from the value specified by -T on the command-line
2015-09-16 09:49:39 -04:00
James Cammarata
d91ff0db74 Fixing parent block serialization for blocks
Fixes #12395
2015-09-16 09:29:16 -04:00
Thomas Quinot
c005f75469 Always create 'all' group
Create 'all' even if host_list is empty, as this group needs to exist
when creating the implicit 'localhost' host.

Fixes #12391
2015-09-16 12:24:06 +02:00
Abhijit Menon-Sen
85bb508f26 Set PlayContext.timeout from the value specified by -T on the command-line
Fixes #12372
2015-09-16 08:57:25 +05:30
James Cammarata
2a50957ad8 Fix galaxy install dep failure
Also fixes issue where force does not force reinstall of deps

Fixes #10425
2015-09-15 17:31:47 -04:00
Toshio Kuratomi
1a39e32a13 Update core modules ref 2015-09-15 14:26:09 -07:00
Chris Church
6ab4cff7db Enable winrm put_file to upload an empty file. 2015-09-15 17:21:27 -04:00
Chris Church
5c65ee7f0c Add PowerShell exception handling and turn on strict mode.
* Add exception handling when running PowerShell modules to provide exception message and stack trace.
* Enable strict mode for all PowerShell modules and internal commands.
* Update common PowerShell code to fix strict mode errors.
* Fix an issue with Set-Attr where it would not replace an existing property if already set.
* Add tests for exception handling using modified win_ping modules.
2015-09-15 16:32:35 -04:00
James Cammarata
a1948dd1c1 Merge branch 'bcoca-normalize_plugin_paths' into devel 2015-09-15 14:48:11 -04:00
James Cammarata
a7e1113b26 Removing FIXME comment which is no longer required 2015-09-15 14:47:49 -04:00
James Cammarata
d818a72375 Merge branch 'normalize_plugin_paths' of https://github.com/bcoca/ansible into bcoca-normalize_plugin_paths 2015-09-15 14:41:09 -04:00
Axel Delmas
4802641de7 Added env_string in async_cmd 2015-09-15 20:11:14 +02:00
James Cammarata
60c139e482 Fix logic for changed/failed_when + retry/until loops
Fixes #11809
2015-09-15 13:37:35 -04:00
James Cammarata
8e664ad226 Fix delegate_to localhost vs. 127.0.0.1 (and ::1) 2015-09-15 13:08:54 -04:00
James Cammarata
38573c55bf Tweak failure condition for field attributes expected to be strings 2015-09-15 13:08:40 -04:00
James Cammarata
cfdaec0c22 Make sure string attributes are strings from YAML to avoid bad type conversions
Fixes #12367
2015-09-15 12:17:55 -04:00
Brian Coca
b6d6c2e4db corrected all missing paths changes 2015-09-15 11:57:54 -04:00
Brian Coca
4aea1f6568 normalized plugin paths and names and configs 2015-09-15 11:44:09 -04:00
Brian Coca
02372e9761 Merge pull request #12371 from apollo13/patch-1
Remove duplicate SU_PROMPT_LOCALIZATIONS
2015-09-15 09:54:07 -04:00
Florian Apolloner
9334046189 Remove duplicate SU_PROMPT_LOCALIZATIONS 2015-09-15 10:40:25 +02:00
gptech
1c6be7b9ba Replace 'degug' with 'debug'
Tiny typo fix.
2015-09-14 23:21:03 -04:00
Andriy Yurchuk
af213241ab Fix typo 2015-09-14 21:11:40 +02:00
Brian Coca
e7807c4f2d Merge pull request #12339 from emonty/feature/openstack-no-log
Add no-log parameter to common openstack args
2015-09-14 15:03:09 -04:00
James Cammarata
4f30db8ca5 Check if path is /dev/null when checking if a file is in fact a file 2015-09-14 14:41:22 -04:00
Chris Church
260b9f648c Fix fetch action plugin to not fail if file is missing and fail_if_missing=False (the default). Add tests to test_fetch role to verify it works as expected. 2015-09-14 14:21:52 -04:00
James Cammarata
feee4613cd Merge pull request #12357 from apollo13/become_fix
Fixed #12356 -- Restored ansible 1.9.x become behavior.
2015-09-14 12:27:45 -04:00
James Cammarata
49ca0eb797 Track local_action internally to prevent it from being overridden
Fixes #12053
2015-09-14 12:11:58 -04:00
Florian Apolloner
8182eb3787 Fixed #12356 -- Restored ansible 1.9.x become behavior. 2015-09-14 17:53:14 +02:00
Marius Gedminas
9877a5c415 Python 3: two more instances of 'basestring'
Fixes two failing tests on Python 3.4.
2015-09-14 08:27:39 +03:00
Monty Taylor
3bdd6793ca Add no-log parameter to common openstack args
These bad boys can contain secret data, so should be marked no-log.
2015-09-13 19:48:37 +02:00
James Cammarata
aa762bb432 Don't split args out unless we're parsing module args using the new style
Fixes #12331
2015-09-12 17:50:05 -04:00
James Cammarata
1cb4e0be1c Fix bug in implicit block squashing where block is not reassigned
Fixes #12333
2015-09-12 11:27:30 -04:00
James Cammarata
7deb8bbd1c Reworking how includes within handlers are run
Fixes #12238
2015-09-12 08:46:29 -04:00
Brian Coca
03758151e4 Merge pull request #12330 from cchurch/revert_find_plugin_changes
Revert "Fix order of loading of modules."
2015-09-11 20:05:37 -04:00
Brian Coca
9d4d7bd74d fixed porting bugs in profile_tasks to v2 2015-09-11 16:48:09 -04:00
Chrrrles Paul
ba7734b78b Merge pull request #12165 from amenonsen/address-parsing
Hi @amenonsen - thanks for fixing up the hunting down the unicode bug and expanding test_addresses.  The code looks good, merging!-- Be systematic about parsing and validating hostnames and addresses
2015-09-11 15:25:50 -05:00
James Cammarata
4156bcedf5 Fix typo in 049a48f 2015-09-11 15:54:24 -04:00
Chris Church
ed3a9795d4 Revert "Fix order of loading of modules."
This reverts commit 4b895f04e3.
2015-09-11 14:16:30 -04:00
James Cammarata
1243686b90 Submodule update 2015-09-11 13:11:15 -04:00
Abhijit Menon-Sen
049a48f3d3 Test state.tasks_child_state before dereferencing
I hit a traceback in the FAILED_TASKS case, but it seemed prudent to add
guards in the other similar branches.
2015-09-11 21:59:08 +05:30
James Cammarata
df89f03627 Fixing precedence order for new nonpersistent vars (set_fact/register)
These used to go in vars_cache, so merging them in after that as they
are "live" variables and the user would most likely want to see these
above anything else.
2015-09-11 12:24:44 -04:00
Abhijit Menon-Sen
7479ab47e0 Be stricter about parsing hostname labels
Labels must start with an alphanumeric character, may contain
alphanumeric characters or hyphens, but must not end with a hyphen.
We enforce those rules, but allow underscores wherever hyphens are
accepted, and allow alphanumeric ranges anywhere.

We relax the definition of "alphanumeric" to include Unicode characters
even though such inventory hostnames cannot be used in practice unless
an ansible_ssh_host is set for each of them.

We still don't enforce length restrictions—the fact that we have to
accept ranges makes it more complex, and it doesn't seem especially
worthwhile.
2015-09-11 21:47:19 +05:30
Abhijit Menon-Sen
065bb52109 Be systematic about parsing and validating hostnames and addresses
This adds a parse_address(pattern) utility function that returns
(host,port), and uses it wherever where we accept IPv4 and IPv6
addresses and hostnames (or host patterns): the inventory parser
the the add_host action plugin.

It also introduces a more extensive set of unit tests that supersedes
the old add_host unit tests (which didn't actually test add_host, but
only the parsing function).
2015-09-11 21:47:18 +05:30
James Cammarata
49803509b4 Make sure include paths are templated before dwim in case they're absolute
Fixes #12327
2015-09-11 11:57:43 -04:00
James Cammarata
4cdd9b2a82 Merge pull request #12318 from mgedmin/py3k
Python 3: make ansible.template.safe_eval() work
2015-09-11 10:44:37 -04:00
Brian Coca
52f587cac3 Merge pull request #12325 from quinot/topic/wrong_interp_test
Test for Python must be against basename of interpreter
2015-09-11 09:47:49 -04:00
James Cammarata
c2115c3715 Re-adding part of 926f127 which was actually fixing #12277 2015-09-11 09:45:27 -04:00
James Cammarata
083aef65ad Revert "set_fact should put facts in the fact_cache, not vars_cache"
This reverts commit 926f127245.
2015-09-11 09:45:27 -04:00
Thomas Quinot
0bc9223826 Test for Python must be against basename of interpreter
Followup on issue #12076
2015-09-11 13:29:34 +02:00
James Cammarata
441a8af671 Merge pull request #12267 from h-hirokawa/add_replacer_jsonargs
Add the new module replacer <<INCLUDE_ANSIBLE_MODULE_JSON_ARGS>>.
2015-09-11 02:44:50 -04:00
Marius Gedminas
f91b28ef23 Fix safe_eval() of set literals
There was code to support set literals (on Python 2.7 and newer), but it
was buggy: SAFE_NODES.union() doesn't modify SAFE_NODES in place,
instead it returns a new set object that is then silently discarded.

I added a unit test and fixed the code.  I also changed the version
check to use sys.version_tuple instead of a string comparison, for
consistency with the subsequent Python 3.4 version check that I added in
the previous commit.
2015-09-11 09:41:05 +03:00
Marius Gedminas
2b73002044 Python 3: make ansible.template.safe_eval() work
Two things changed in Python 3.4:

- 'basestring' is no longer defined, so use six.string_types

- True/False are now special AST node types (NamedConstant) rather than
  just names

(Good thing we had tests, or I wouldn't have noticed the 2nd thing!)

I found only one place where safe_eval() is called inside the ansible
codebase: in lib/template/__init__.py.  The call to safe_eval(result,
...) is protected by result.startswith('...'), which means result cannot
possibly be a byte string on Python 3 (or startswith() would raise, so
six.string_types (which excludes byte strings on Python 3) is fine here.
2015-09-11 09:37:44 +03:00
James Cammarata
0c5bbe3c32 Use the original (un-templated) args for include params
Fixes #12314
2015-09-11 00:53:27 -04:00
James Cammarata
292e2da4e1 Fix some bugs related to facts/nonpersistent-facts cache split
Fixes #12313
2015-09-10 17:36:39 -04:00
Brian Coca
91c9df2154 added verbosity to ansible-doc to make it easier to trace down issues 2015-09-10 16:50:14 -04:00
James Cammarata
b35529b09f Submodule pointer update 2015-09-10 15:44:30 -04:00
James Cammarata
95a58d1178 Properly serialize UnsafeProxy objects
Required as part of fix for #12123
2015-09-10 14:01:02 -04:00
James Cammarata
a410bf26d3 Wrap registered variables in UnsafeProxy
Fixes #12123
2015-09-10 14:01:02 -04:00
Toshio Kuratomi
46bf3d1bc1 Remove plugin._basedirs as we now use different data structures to achieve that functionality. 2015-09-10 10:41:31 -07:00
Jiri tyr
174f805fb3 Resurrection of the comment filter 2015-09-10 14:37:42 +02:00
Marius Gedminas
b95e3d18a7 Python 3: use the right PyYAML SafeRepresenter for unicode
PyYAML has a SafeRepresenter in lib/... that defines

    def represent_unicode(self, data):
        return self.represent_scalar(u'tag:yaml.org,2002:str', data)

and a different SafeRepresenter in lib3/... that defines

    def represent_str(self, data):
        return self.represent_scalar('tag:yaml.org,2002:str', data)

so the right thing to do on Python 3 is to use represent_str.

(AnsibleUnicode is a subclass of six.text_type, i.e. 'str' on Python 3.)
2015-09-10 08:57:53 +03:00
Benno Joy
6de13c3062 Merge pull request #11818 from Java1Guy/module_utils_ec2_for_ecs
change ec2 util to create only requested objects
2015-09-10 11:06:19 +05:30
James Cammarata
ee7905c7e1 Compare include params against deprecated param names too
Fixes #12282
2015-09-09 22:15:50 -04:00
James Cammarata
950e067d2f Merge pull request #12295 from napkindrawing/patch-3
Typo in comment: "bsaename" → "basename"
2015-09-09 21:41:13 -04:00
James Cammarata
f576e0f1af Merge pull request #12300 from robusto/devel
Vault missing DataLoader for pwd file #12293
2015-09-09 18:52:31 -04:00
James Cammarata
22639a2a22 Fix mistake in fact setting to nonpersistent cache in VariableManager
Fixes #12301
2015-09-09 18:28:39 -04:00
James Cammarata
aa3b290efd Fix indent on line in playbook executor 2015-09-09 18:10:38 -04:00
Toshio Kuratomi
4b895f04e3 Fix order of loading of modules.
Allows ANSIBLE_LIBRARY to overload core modules even if the module in
ANSIBLE_LIBRARY doesn't have a .py extension.
2015-09-09 15:00:26 -07:00
James Cammarata
e81947c3b4 Fix vars_prompt short form support (and mark deprecated) 2015-09-09 17:52:44 -04:00
Blake Atkinson
6062519986 Vault missing DataLoader for pwd file #12293 2015-09-09 15:33:52 -05:00
James Cammarata
be7bd392cb Fix unreachable host detection and have plays continue after unreachable failures
Fixes #12284
2015-09-09 15:27:26 -04:00
Toshio Kuratomi
25c97fff69 Merge pull request #12294 from ansible/fix-password-lookup
Fix problem with "=" in the initial file path.
2015-09-09 11:48:30 -07:00
Brian Coca
0dbebfddaa Revert "remove closing connections after every task, this goes against conneciton caching and was not expected behaviuor nor inhertited from v1"
needed for winrm, disabled closing connections in ssh to avoid issues with that persistance, need to normalize all this in future

This reverts commit 23a22397bf.
2015-09-09 14:21:56 -04:00
Brian Coca
3f0e14c2a0 disabled ssh closing connections 2015-09-09 14:21:46 -04:00
Toshio Kuratomi
e2c49b4ef4 Fix problem with "=" in the initial file path. 2015-09-09 11:14:31 -07:00
James Cammarata
56d7f3889d Add new level of vars to deal with set_fact/register precedence rules 2015-09-09 12:21:07 -04:00
napkindrawing
172bbac97a Typo in comment: "bsaename" → "basename" 2015-09-09 11:55:40 -04:00
James Cammarata
926f127245 set_fact should put facts in the fact_cache, not vars_cache
Also fixes a template path lookup issue when using an include

Fixes #12277
2015-09-09 11:10:18 -04:00
Toshio Kuratomi
e2e9319f06 Merge pull request #12287 from mgedmin/py3k
Python 3: use six.string_types instead of basestring
2015-09-09 01:35:46 -07:00
Toshio Kuratomi
fa2edfa1ef * Make sure we don't sometimes get byte strings instead of unicode strings
* Turn strings into byte strings before passing to shlex and turn them
  back into unicode strings after they are retyurned from there

  Fixes #12257
2015-09-09 01:24:11 -07:00
Toshio Kuratomi
e67459df86 Fix docstring of parse_value() to be informative 2015-09-09 01:24:11 -07:00
Marius Gedminas
ba0cf42ce9 Python 3: use six.string_types instead of basestring
Reduces the number of failing tests from 35 to 17.
2015-09-09 09:25:23 +03:00
James Cammarata
30399edada Use UnsafeProxy for lookup results too
Also fixes a couple of bugs that popped up when using the proxy class
2015-09-08 12:19:39 -04:00
Brian Coca
f1c72a55a5 Merge pull request #12261 from toshywoshy/12169
added Manjaro as an Archlinux family
2015-09-08 08:24:01 -04:00
Victor Costan
bd405169fb Fix #12258: don't wrap None in UnsafeProxy. 2015-09-08 04:02:04 -04:00
James Cammarata
ac6f61ec7f Properly handle group/host_var files with dots in them
Fixes #12245
2015-09-08 03:20:09 -04:00
James Cammarata
1eb5b42705 Don't double proxy unsafe variables
Potential fix for #12260
2015-09-08 02:50:07 -04:00
Gaurav Jain
6c107258fa Fix rsync connections to IPv6 addresses
Similar to https://github.com/ansible/ansible/pull/11816 we can unconditionally
wrap the host address in square brackets. This is required by rsync for IPv6
addresses.
2015-09-06 22:20:45 -07:00
h-hirokawa
cd478a76fc Add the new module replacer <<INCLUDE_ANSIBLE_MODULE_JSON_ARGS>>.
Fixes #12266
2015-09-07 12:01:26 +09:00
Toshio Kuratomi
718812d945 update submodule refs for documentation formatting 2015-09-05 08:56:15 -07:00
Toshio Kuratomi
26e109aa13 Update module refs 2015-09-05 08:27:48 -07:00
Toshaan Bharvani
4702d2be09 added Manjaro as an Archlinux family 2015-09-05 12:49:20 +02:00
James Cammarata
ff9f5d7dc8 Starting to add additional unit tests for VariableManager
Required some rewiring in inventory code to make sure we're using
the DataLoader class for some data file operations, which makes mocking
them much easier.

Also identified two corner cases not currently handled by the code, related
to inventory variable sources and which one "wins". Also noticed we weren't
properly merging variables from multiple group/host_var file locations
(inventory directory vs. playbook directory locations) so fixed as well.
2015-09-04 16:41:38 -04:00
James Cammarata
87f75a50ad Use proxy class to mark variables unsafe for templating
Fixes #12191
2015-09-04 16:38:06 -04:00
Toshio Kuratomi
2d251cba45 Merge pull request #12256 from ansible/password-lookup-fix
Use parse_kv to correctly parse parameters from password lookup
2015-09-04 12:27:18 -07:00
Toshio Kuratomi
c68e04c185 Use parse_kv to correctly parse parameters from password lookup
Fixes https://github.com/ansible/ansible-modules-core/issues/1968
2015-09-04 12:18:46 -07:00
Brian Coca
6e5f3db9de updated submodule refs 2015-09-04 12:17:34 -04:00
Brian Coca
c17fbf2f12 simplify become testing and handling, we had drifted and were doulbe checking prompt, become and become_pass
fixed tests to conform to new signature and now tests both with and w/o password
now we are more explicit about self.prompt
2015-09-04 10:36:16 -04:00
Brian Coca
eb0e7e198b remove closing connections after every task, this goes against conneciton caching and was not expected behaviuor nor inhertited from v1 2015-09-04 10:36:15 -04:00
Marius Gedminas
37be9539ff Python 3: use six.text_type instead of unicode
Replace 'unicode' with six.text_type, everywhere but in module_utils.
2015-09-04 08:40:10 +03:00
James Cammarata
1840906f74 Merge pull request #12236 from amenonsen/ssh-cpdir
Go back to using ~/.ansible/cp as the ControlPath
2015-09-03 21:12:45 -04:00
Toshio Kuratomi
e218bf8da9 Do not escape backslashes when processing a template file.
Fixes #12198
Fixes #12241
2015-09-03 17:45:17 -07:00
Abhijit Menon-Sen
7aa6cd3f63 Go back to using ~/.ansible/cp as the ControlPath
This was commented out earlier because of the lack of interprocess
locking and prepare_writeable_dir in v2.

The locking was not needed: it could only protect against other siblings
of this process (since they were all locking a temporary file that was
opened in the parent), and those would be running as the same user and
with the same umask. Also, os.makedirs() tolerates intermediate paths
being created by other processes. For any other kind of error, both
locking and non-locking code paths would fail in the same way.

So all we really need to do is make sure we have write permissions.

(We also move the cp_dir handling code to where we actually set the
ControlPath ourselves; if the user has set it via ssh_*args already,
we don't need to bother.)
2015-09-04 00:35:13 +05:30
James Cammarata
4ac2bafc4b Set hosts fact gathering flag based on fact cache entries
Fixes #12213
2015-09-03 14:11:19 -04:00
James Cammarata
6650ba7654 Squashed commit of the following:
commit 9921bb9d20
Author: Abhijit Menon-Sen <ams@2ndQuadrant.com>
Date:   Mon Aug 10 20:19:44 2015 +0530

    Document --ssh-extra-args command-line option

commit 8b25595e7b
Author: Abhijit Menon-Sen <ams@2ndQuadrant.com>
Date:   Thu Aug 13 13:24:57 2015 +0530

    Don't disable GSSAPI/Pubkey authentication when using --ask-pass

    This commit is based on a bug report and PR by kolbyjack (#6846) which
    was subsequently closed and rebased as #11690. The original problem was:

        «The password on the delegated host is different from the one I
        provided on the command line, so it had to use the pubkey, and the
        main host doesn't have a pubkey on it yet, so it had to use the
        password.»

    (This commit is revised and included here because #11690 would conflict
    with the changes in #11908 otherwise.)

    Closes #11690

commit 119d032389
Author: Abhijit Menon-Sen <ams@2ndQuadrant.com>
Date:   Thu Aug 13 11:16:42 2015 +0530

    Be more explicit about why SSH arguments are added

    This adds vvvvv log messages that spell out in detail where each SSH
    command-line argument is obtained from.

    Unfortunately, we can't be sure if, say, self._play_context.remote_user
    is obtained from ANSIBLE_REMOTE_USER in the environment, remote_user in
    ansible.cfg, -u on the command line, or an ansible_ssh_user setting in
    the inventory or on a task or play. In some cases, e.g. timeout, we
    can't even be sure if it was set by the user or just a default.

    Nevertheless, on the theory that at five v's you can use all the hints
    available, I've mentioned the possible sources in the log messages.

    Note that this caveat applies only to the arguments that ssh.py adds by
    itself. In the case of ssh_args and ssh_extra_args, we know where they
    are from, and say so, though we can't say WHERE in the inventory they
    may be set (e.g. in host_vars or group_vars etc.).

commit b605c285ba
Author: Abhijit Menon-Sen <ams@2ndQuadrant.com>
Date:   Tue Aug 11 15:19:43 2015 +0530

    Add a FAQ entry about ansible_ssh_extra_args

commit 49f8edd035
Author: Abhijit Menon-Sen <ams@2ndQuadrant.com>
Date:   Mon Aug 10 20:48:50 2015 +0530

    Allow ansible_ssh_args to be set as an inventory variable

    Before this change, ssh_args could be set only in the [ssh_connection]
    section of ansible.cfg, and was applied to all hosts. Now it's possible
    to set ansible_ssh_args as an inventory variable (directly, or through
    group_vars or host_vars) to selectively override the global setting.

    Note that the default ControlPath settings are applied only if ssh_args
    is not set, and this is true of ansible_ssh_args as well. So if you want
    to override ssh_args but continue to set ControlPath, you'll need to
    repeat the appropriate options when setting ansible_ssh_args.

    (If you only need to add options to the default ssh_args, you may be
    able to use the ansible_ssh_extra_args inventory variable instead.)

commit 37c1a5b679
Author: Abhijit Menon-Sen <ams@2ndQuadrant.com>
Date:   Mon Aug 10 19:42:30 2015 +0530

    Allow overriding ansible_ssh_extra_args on the command-line

    This patch makes it possible to do:

        ansible somehost -m setup \
            --ssh-extra-args '-o ProxyCommand="ssh -W %h:%p -q user@bouncer.example.com"'

    This overrides the inventory setting, if any, of ansible_ssh_extra_args.

    Based on a patch originally by @Richard2ndQuadrant.

commit b023ace8a8
Author: Abhijit Menon-Sen <ams@2ndQuadrant.com>
Date:   Mon Aug 10 19:06:19 2015 +0530

    Add an ansible_ssh_extra_args inventory variable

    This can be used to configure a per-host or per-group ProxyCommand to
    connect to hosts through a jumphost, e.g.:

        inventory:
            [gatewayed]
            foo ansible_ssh_host=192.0.2.1

        group_vars/gatewayed.yml:
            ansible_ssh_extra_args: '-o ProxyCommand="ssh -W %h:%p -q bounceuser@gateway.example.com"'

    Note that this variable is used in addition to any ssh_args configured
    in the [ssh_connection] section of ansible.cfg (so you don't need to
    repeat the ControlPath settings in ansible_ssh_extra_args).
2015-09-03 11:26:56 -04:00
James Cammarata
8774ff5f57 Make sure PlayContext is copied when iterating in a with_ loop 2015-09-03 08:11:30 -04:00
James Cammarata
c16961db60 Fix two PlayIterator bugs
* When iterating over a child state, a failure should be propagated
  up so parent blocks don't continue iterating
* Make sure a child state exists before trying to search it

Fixes #12210
2015-09-03 07:48:42 -04:00
Marius Gedminas
38a96d7e8f Python 3: avoid iteritems() in a template
I don't think six.iteritems is available here, but I also don't expect
there to be enough platforms to ever make the speed difference between
.items() and .iteritems() noticeable.
2015-09-03 10:11:32 +03:00
Toshio Kuratomi
364313c01f Simplify and speed up _split_role_params() by moving an invariant outside of a loop. 2015-09-03 00:06:34 -07:00
Toshio Kuratomi
1ae28f606b Refactor to replace filter and lambda with a generator expression 2015-09-03 00:06:34 -07:00
Marius Gedminas
a32bf1ec18 Simplify FactCache.copy()
Also fix the bug (missing from six import iteritems) I introduced in
823677b490.
2015-09-03 09:44:44 +03:00
Marius Gedminas
823677b490 Replace .iteritems() with six.iteritems()
Replace .iteritems() with six.iteritems() everywhere except in
module_utils (because there's no 'six' on the remote host).  And except
in lib/ansible/galaxy/data/metadata_template.j2, because I'm not sure
six is available there.
2015-09-03 09:23:27 +03:00
James Cammarata
9e1bc434c7 Further cleanup from locking changes 2015-09-03 01:07:29 -04:00
James Cammarata
b93f27e260 Move the lockfile back to tqm to make sure it stays unique 2015-09-03 00:45:42 -04:00
James Cammarata
b9afbf0ee4 Reorganizing the way the connection lockfile is created 2015-09-03 00:18:52 -04:00
James Cammarata
7034bbef30 Merge branch 'connection-locking' of https://github.com/amenonsen/ansible into amenonsen-connection-locking 2015-09-02 23:54:52 -04:00
Abhijit Menon-Sen
9378c8e2da Make the paramiko plugin use locking 2015-09-03 08:43:21 +05:30
Abhijit Menon-Sen
5887e96b27 Introduce a connection locking infrastructure
The lock file is (a temporary file) opened in the parent process, whose
open fd is inherited by the workers after fork, and passed down through
the PlayContext. Connection grows lock/unlock methods which can be used
by individual connection plugins.
2015-09-03 08:43:21 +05:30
Abhijit Menon-Sen
12d8f9132e Make lock_host_keys a real noop, instead of half-a-noop
Right now, we don't do any locking, but we still scan known_hosts files
twice per connection. That's completely unnecessary, and the proposed
solutions to the locking problem wouldn't need known_hosts scanning
anyway, so this code can go away.
2015-09-03 05:52:57 +05:30
Brian Coca
a006e85947 removed printing module args as it violates no_log settings 2015-09-02 16:14:40 -04:00
Toshio Kuratomi
1998eddf8d Keep newlines by default now.
In v1, a trailing newline was kept if the parameter was passed as key=value.  If
the parameter was passed as yaml dict the trailing newline was
discarded.  Since key-value and yaml dict were unified in v2 we have to
make a choice as to which behaviour we want.  Decided that keeping trailing
newlines by default made the most sense.

Fixes #12200
Fixes #12199
2015-09-02 11:55:45 -07:00
Toshio Kuratomi
41da8de094 Speedup for counting newlines 2015-09-02 10:59:51 -07:00
James Cammarata
843138e7d9 Merge pull request #12202 from mgedmin/py3k
Use rich comparisons for Attribute and FieldAttribute
2015-09-02 13:57:04 -04:00
James Cammarata
5434ed973b Make sure locals in safe_eval is a plain dict when running eval
Fixes #12206
2015-09-02 13:54:58 -04:00
Toshio Kuratomi
417bf1c805 Unittest the _count_trailing_newlines function 2015-09-02 08:59:31 -07:00
Toshio Kuratomi
7ed746ad45 Fix preserve_trailing_newlines (broken by 7f5080f64a )
Fix for one half of hte bug reported in #12198
2015-09-02 08:47:20 -07:00
Brian Coca
a7231c2203 actually implemented flags correctly for all priv escalation methods 2015-09-02 11:31:39 -04:00
Brian Coca
b9642585bd added missing become_exe from config 2015-09-02 09:52:26 -04:00
Brian Coca
e156d9b677 fixed and generalized privilege escalation exe settings 2015-09-02 09:29:34 -04:00
Marius Gedminas
33a374edde Use rich comparisons for Attribute and FieldAttribute
Because __cmp__ is not supported on Python 3.
2015-09-02 12:33:42 +03:00
Marius Gedminas
ca908f2e12 Fix indentation to be a multiple of 4 2015-09-02 12:22:18 +03:00
Abhijit Menon-Sen
147b04b682 Remove duplicated function definition (fallout from earlier repeated merge) 2015-09-02 07:47:48 +05:30
James Cammarata
f162990cb3 Properly assign the searchpath for templates to the environment loader
dbd755e0 previously assigned the value to self._templar.environment.searchpath,
which is incorrect - it needs to be assigned to the environment.loader.searchpath
value instead.

Fixes #11931
2015-09-01 17:33:14 -04:00
James Cammarata
2761df232e Small tweak to 7551b75 to correct the ordering of tests 2015-09-01 14:48:59 -04:00
James Cammarata
7551b75e61 Add ispath type for constants and make sure all local paths are ispath=True
Fixes #12180
2015-09-01 14:47:45 -04:00
Toshio Kuratomi
aeff960d02 Cleanup combine_vars
* Dedupe combine_vars() code (removed from VariableManager)
* Fix merge_hash algorithm to preserve the type
* unittest combine_vars and merge_hash
2015-09-01 11:23:12 -07:00
James Cammarata
7fe495d619 Merge pull request #12187 from caphrim007/add-utf-8-encoding-to-f5-module-utils
Adds utf-8 encoding to f5 module_utils
2015-09-01 14:15:42 -04:00
James Cammarata
d00c445d2c Merge pull request #12188 from amenonsen/easy-debug
Show module name and args with -vvv
2015-09-01 14:15:15 -04:00
Abhijit Menon-Sen
d6d523bcae Show module name and args with -vvv
This information was earlier shown only with ANSIBLE_DEBUG, but it's
extremely useful in a user context, especially with module invocations
with deeply nested args like the ec2_vpc/ec2 modules.

Closes #11680
2015-09-01 23:44:13 +05:30
James Cammarata
3e1a774ba5 Don't use iteritems() in templar to avoid (hostvars) dict size change errors 2015-09-01 14:11:23 -04:00
James Cammarata
974b69d236 looped includes need unique references to prevent information bleeding
Fixes #12155
2015-09-01 12:32:35 -04:00
James Cammarata
a341a8a093 Make sure tasks from a role see their defaults above all others
Fixes #12081
2015-09-01 11:27:35 -04:00
Tim Rupp
6f41a72158 Adds utf-8 encoding to f5 module_utils
The contributor's name on line 10 (originally line 7) includes a character
that the default Python encoding (ASCII) raises an error on when interpreting
the file.

Specifying the utf-8 encoding, as is done in other modules, resolves
the error.

The error being raised is

SyntaxError: Non-ASCII character '\xc3' in file /.../lib/ansible/module_utils/f5.py
on line 7, but no encoding declared; see http://www.python.org/peps/pep-0263.html
for details
2015-09-01 08:10:23 -07:00
James Cammarata
a7da25d48b Submodule update 2015-09-01 11:03:19 -04:00
James Cammarata
3d282cd1b0 Also always post_validate Handler class as well
Fixes #12154
2015-09-01 11:02:42 -04:00
Toshio Kuratomi
12edbfeb0b Merge pull request #12177 from mgedmin/py3k
Make combine_vars() compatible with Python 3
2015-09-01 08:00:08 -07:00
Brian Coca
66e2eb2231 removed as it does not fool setup.py to include data and it must be specified in setup.py 2015-09-01 10:58:58 -04:00
Marius Gedminas
54dbfba8f8 Make combine_vars() compatible with Python 3
Fixes

  TypeError: unsupported operand type(s) for +: 'dict_items' and 'dict_items'

on Python 3.
2015-09-01 09:39:59 +03:00
James Cammarata
5adcd7054b Allow setup to run when using --start-at-task
Fixes #12147
2015-08-31 22:10:34 -04:00
Brian Coca
7458331539 package and service now check that module exists before trying to execute it 2015-08-31 20:34:20 -04:00
Toshio Kuratomi
9d193d8fb4 Merge pull request #12173 from ansible/pr/10204
Rebase of 10204 - Add host key for ssh url only.
2015-08-31 13:50:40 -07:00
James Cammarata
fca27c29f4 Properly fail if slurp fails during fetch 2015-08-31 16:45:03 -04:00
Desmond O. Chang
58c3539196 Add host key for ssh url only.
Rewrite function `get_fqdn`.  It returns fqdn for all kinds of urls now.

`add_git_host_key` determines whether a url is ssh and whether its host
key should be added.
2015-08-31 13:42:32 -07:00
James Cammarata
66a2f2923e Look for proper values in slurp result during fetch with become enabled 2015-08-31 16:36:07 -04:00
Toshio Kuratomi
7f5080f64a Fix backslash escaping inside of jinja2 expressions
Fixes #11891
2015-08-31 13:17:26 -07:00
Toshio Kuratomi
5ae300a084 Update module refs 2015-08-31 08:05:45 -07:00
Brian Coca
6b73cac35a corrected skipped_hosts constant usage, thanks @benjixx 2015-08-30 20:21:15 -04:00
Brian Coca
5a65dce6fb fix issues with csh redirection 2015-08-30 17:49:16 -04:00
Brian Coca
b525eedb8e less misleading message for when someone looks up vars for a host not in inventory 2015-08-30 12:41:21 -04:00
Brian Coca
6154ed1dda Merge pull request #12146 from thekarlbrown/patch-1
Fixed Spelling Error on Line 67
2015-08-28 20:10:47 -04:00
James Cammarata
f0257683b0 Fixed missing constants import in default callback
Fixes #12145
2015-08-28 16:54:56 -04:00
James Cammarata
057712c129 Also move action/connection plugins to shared plugin loader code
Fixes #12099
2015-08-28 16:32:09 -04:00
James Cammarata
0859ba7726 Adjust field loading order for vars and tweak post_validate exclusion logic
FieldAttributes will now by default not be post_validated unless a flag
is set on them in the class, as a large number of fields are really there
simply to be inherited by Task/PlayContext and shouldn't be templated too
early.

The other (unrelated to the base issue) in #12084 is also fixed here, where
the roles field is loaded before vars/vars_files, meaning there are no vars
yet loaded in the play when the templating occurs.

Fixes #12084
2015-08-28 15:56:42 -04:00
Karl Brown
9aae1d5810 Fixed Spelling Error on Line 67
Noticed while running Ansible from Tip.
Throws: NameError: global name 'tself' is not defined
2015-08-28 15:45:49 -04:00
James Cammarata
4c65306e73 Merge branch 'hostrange' of https://github.com/amenonsen/ansible into amenonsen-hostrange 2015-08-28 13:48:25 -04:00
Toshio Kuratomi
120243d36d Fix python3.4 syntax 2015-08-28 10:30:27 -07:00
James Cammarata
2043fcd5db Merge pull request #12083 from resmo/for-ansible
cloudstack: implement general api_region support, update docs
2015-08-28 13:14:50 -04:00
Brian Coca
b6c6ed91fe implemented not showing skipped hosts config 2015-08-28 12:32:50 -04:00
Brian Coca
514fa73fcd galaxy fixes 2015-08-28 12:32:50 -04:00
James Cammarata
66ed397360 Fix redis fact_caching_timeout=0 bug
Fixes #12018
2015-08-28 11:47:06 -04:00
James Cammarata
5a5b9f211b Validate variable names when loading 'vars:' blocks
TODO: add this to VariableManager to validate vars loaded from files too

Fixes #12022
2015-08-28 11:36:31 -04:00
James Cammarata
266a069a73 Merge pull request #12107 from TravisPaul/devel
Update "smart" transport to handle Sun_SSH_1.5 on SmartOS
2015-08-28 10:43:48 -04:00
Brian Coca
48aa0dd1c7 now acknowledges ask_pass setting from ansible.cfg
fixes #12111
2015-08-27 18:22:36 -04:00
James Cammarata
399d215f5a Merge pull request #12122 from maty0609/devel
Adding support for Archlinux and Slackware in fallback
2015-08-27 16:55:43 -04:00
Marius Gedminas
eb99aa8c68 Fix to_bytes(None) on Python 3
You cannot call bytes(obj) to get a simple representation of obj on
Python 3!  E.g. bytes(42) returns a byte string with 42 NUL characters
instead of b'42'.
2015-08-27 22:15:56 +03:00
Marius Gedminas
df1b41d3d3 Avoid types.NoneType
types.NoneType was removed in Python 3.

None is a singleton in Python, so 'x is None' is equivalent to
'isinstance(x, NoneType)'.
2015-08-27 22:15:56 +03:00
Marius Gedminas
da1e611b26 Support print as a function
I neglected the __future__ import because

  print(one_thing)

works the same way even when print is a statement.
2015-08-27 22:15:56 +03:00
Marius Gedminas
39196ec91e Drop the L suffix on numerical constants
Python has had automatic int-to-long promotion for a long long time now.
Even Python 2.4 does that automatically.

Python 3 drops support for the L suffix altogether.
2015-08-27 22:15:04 +03:00
Marius Gedminas
0eb538df03 Use 0oNNN octal syntax
This syntax is valid in Python 2.6+ and 3.x.
2015-08-27 22:15:04 +03:00
Marius Gedminas
47b088504d Don't mix tabs and spaces
It's not allowed in Python 3 and merely a bad idea in Python 2.
2015-08-27 22:15:04 +03:00
Marius Gedminas
0c6ce31f76 Use 'except ... as' syntax
This syntax works on Python 2.6 through 3.x.  lib/ansible/module_utils
(and lib/ansible/modules) need to support Python 2.4, so I didn't touch
those.
2015-08-27 22:15:04 +03:00
Brian Coca
2ac931d6c9 ported module_docs to use display 2015-08-27 14:57:50 -04:00
Brian Coca
2b28cdc0dd be more tolerant with non list descriptions 2015-08-27 14:57:50 -04:00
Toshio Kuratomi
86b2982005 Merge pull request #12112 from amenonsen/vault-stdio
Implement cat-like filtering behaviour for encrypt/decrypt
2015-08-27 11:26:48 -07:00
Toshio Kuratomi
db4a96a8d6 Merge pull request #12078 from amenonsen/hash_merge
Add hash_merge and hash_merge_recursive filters with documentation
2015-08-27 11:12:49 -07:00
Abhijit Menon-Sen
b328bc023d Add a combine filter with documentation
This is based on some code from (closed) PR #7872, but reworked based on
suggestions by @abadger and the other core team members.

Closes #7872 by @darkk (hash_merge/hash_replace filters)
Closes #11153 by @telbizov (merged_dicts lookup plugin)
2015-08-27 23:29:12 +05:30
James Cammarata
2df6513f8d Version bump for v2.0.0-0.1.alpha1 and submodule updates 2015-08-27 13:43:37 -04:00
Brian Coca
6c9dc78d8c Merge pull request #12126 from amenonsen/vault-aes-deprecate
Remove deprecated and unused VaultAES encryption code
2015-08-27 13:09:28 -04:00
James Cammarata
1170a453c8 Merge pull request #12114 from ilya-epifanov/devel
fixed hostvars access in conjunction with --limit usage
2015-08-27 12:54:23 -04:00
Abhijit Menon-Sen
090cfc9e03 More helpful prompts from ansible-vault encrypt/decrypt
Now we issue a "Reading … from stdin" prompt if our input isatty(), as
gpg does. We also suppress the "x successful" confirmation message at
the end if we're part of a pipeline.

(The latter requires that we not close sys.stdout in VaultEditor, and
for symmetry we do the same for sys.stdin, though it doesn't matter in
that case.)
2015-08-27 22:04:18 +05:30
Abhijit Menon-Sen
b6de6e69a6 Also support output to stdout with no arguments
This allows "cat plaintext|ansible-vault encrypt > ciphertext".
2015-08-27 22:04:18 +05:30
Abhijit Menon-Sen
e7eebb6954 Implement cat-like filtering behaviour for encrypt/decrypt
This allows the following invocations:

    # Interactive use, like gpg
    ansible-vault encrypt --output x

    # Non-interactive, for scripting
    echo plaintext|ansible-vault encrypt --output x

    # Separate input and output files
    ansible-vault encrypt input.yml --output output.yml

    # Existing usage (in-place encryption) unchanged
    ansible-vault encrypt inout.yml

…and the analogous cases for ansible-vault decrypt as well.

In all cases, the input and output files can be '-' to read from stdin
or write to stdout. This permits sensitive data to be encrypted and
decrypted without ever hitting disk.
2015-08-27 22:04:18 +05:30
Abhijit Menon-Sen
32b38d4e29 Fix add_option indentation for consistency before adding another option 2015-08-27 22:04:18 +05:30
Abhijit Menon-Sen
8fc8bf9439 Simplify VaultEditor methods
We don't need to keep creating VaultLibs everywhere, and we don't need
to keep checking for errors because VaultLib does it already.
2015-08-27 22:04:18 +05:30
Abhijit Menon-Sen
e99395f0c0 Don't create a VaultLib in each method; do it in __init__ instead 2015-08-27 22:04:18 +05:30
Abhijit Menon-Sen
159887a6c9 Remove deprecated and unused VaultAES encryption code
Now that VaultLib always decides to use AES256 to encrypt, we don't need
this broken code any more. We need to be able to decrypt this format for
a while longer, but encryption support can be safely dropped.
2015-08-27 16:54:39 +05:30
maty0609
52e94468c9 Merge remote-tracking branch 'ansible/devel' into devel 2015-08-27 10:29:48 +01:00
maty0609
6f24e6f994 Adding support for Archlinux and Slackware in fallback
In some cases Archlinux and Slackware is not detected by
platform.dist(). This should solve the issue.
2015-08-27 10:22:02 +01:00
Brian Coca
b2bfe3502b make sure delimiter is basestring for cvsfile
fixes #12062
2015-08-26 18:38:39 -04:00
Ilya Epifanov
81bf88b6e0 fixed hostvars access in conjunction with --limit usage 2015-08-27 00:15:26 +03:00
James Cammarata
0441a7a217 Finishing off porting of chroot connection plugin 2015-08-26 16:43:06 -04:00
Toshio Kuratomi
017bd7b1cd Fix synchronize lookup of localhost info 2015-08-26 13:36:50 -07:00
James Cammarata
50448d68e1 Implement max_fail_percentage and any_errors_fatal support
Fixes #11997
2015-08-26 12:03:47 -04:00
James Cammarata
af41ba929c Add float and percent types for FieldAttributes
Also sets the max_fail_percentage value to the percent type.
2015-08-26 12:03:47 -04:00
Brian Coca
b2ae6945c4 always load vars plugins
fixes #12104
2015-08-26 11:40:53 -04:00
Travis Paul
604f825a8e Update "smart" transport to handle Sun_SSH_1.5 on SmartOS 2015-08-26 15:00:45 +00:00
Toshio Kuratomi
111c0cc204 Merge pull request #12106 from amenonsen/vault-cleanups
Vault cleanups, pass #1
2015-08-26 07:30:13 -07:00
Abhijit Menon-Sen
b84053019a Make the filename the first argument to rekey_file 2015-08-26 19:54:59 +05:30
Toshio Kuratomi
5df5a14edc Merge pull request #12101 from tquenolle/devel
Synchronize fix error
2015-08-26 07:03:13 -07:00
Abhijit Menon-Sen
20fd9224bb Pass the filename to the individual VaultEditor methods, not __init__
Now we don't have to recreate VaultEditor objects for each file, and so
on. It also paves the way towards specifying separate input and output
files later.
2015-08-26 19:17:37 +05:30
Brian Coca
82603bb2a0 avoids running abspath on None 2015-08-26 09:28:23 -04:00
Abhijit Menon-Sen
a27c5741a1 Remove inaccurate outdated comment 2015-08-26 18:31:45 +05:30
Abhijit Menon-Sen
f91ad3dabe Don't pass the cipher around so much
It's unused and unnecessary; VaultLib can decide for itself what cipher
to use when encrypting. There's no need (and no provision) for the user
to override the cipher via options, so there's no need for code to see
if that has been done either.
2015-08-26 18:31:45 +05:30
Abhijit Menon-Sen
017566a2d9 Use AES256 if the cipher is not write-whitelisted 2015-08-26 18:09:21 +05:30
Abhijit Menon-Sen
47bcdf5952 Remove incorrect copy-pasted comment 2015-08-26 18:09:21 +05:30
Thomas Quenolle
c948af3b1e Synchronize fix error
Fix the error:
 "RuntimeError: dictionary changed size during iteration"
2015-08-26 11:01:00 +02:00
James Cammarata
601a1cc6d9 Multiple fixes for include statements and blocks in general
Fixes #11981
Fixes #11995
Fixes #12039
Fixes #12077
2015-08-26 02:23:22 -04:00
Brian Coca
154754ae50 pushed module_loader to task_queue_manager so all cli's can benefit from it
also normalized -M option across all cli
fixes #12016
2015-08-25 18:14:03 -04:00
Toshio Kuratomi
d2c948dd6a Remove decrypted vault temp_file mistakenly left from patch making vault edit idempotent
This bug was introduced in commit f8bf2ba on July 27.  Hasn't gone out
in a release yet.
2015-08-25 14:51:32 -07:00
Toshio Kuratomi
56ae3a032f Merge pull request #12075 from ansible/fix-vault-unicode
Unicode and other fixes for vault
2015-08-25 14:49:15 -07:00
Toshio Kuratomi
a3fd4817ef Unicode and other fixes for vault 2015-08-25 12:43:09 -07:00
Toshio Kuratomi
16e8a7dd67 Merge pull request #11767 from amenonsen/vault-new-password-file
add option to ansible-vault to read new password from file for rekey
2015-08-25 10:15:27 -07:00
Toshio Kuratomi
156feec264 Merge pull request #11650 from objectified/feature-docker-connection
allow ansible to connect to docker containers (without using ssh)
2015-08-25 09:28:25 -07:00
Abhijit Menon-Sen
8bf0dbb7a9 Use [x:y] host ranges instead of [x-y]
This commit deprecates the earlier groupname[x-y] syntax in favour of
the inclusive groupname[x:y] syntax. It also makes the subscripting
code simpler and adds explanatory comments.

One problem addressed by the cleanup is that _enumeration_info used to
be called twice, and its results discarded the first time because of the
convoluted control flow.
2015-08-25 21:17:24 +05:30
Abhijit Menon-Sen
73f10de386 Document the behaviour of _match_one_pattern in some detail
The possibilities are complicated enough that I didn't want to make
changes without having a complete description of what it actually
accepts/matches. Note that this text documents current behaviour, not
necessarily the behaviour we want. Some of this is undocumented and may
not be intended.
2015-08-25 21:17:24 +05:30
Abhijit Menon-Sen
fa6ffa1dbd Remove & and ! pattern prefixes as early as possible
Now everything under _match_one_pattern can ignore them. This also means
that we can use the cache to return the same results for 'foo' and '!foo'.
2015-08-25 21:17:24 +05:30
Abhijit Menon-Sen
704c3815d3 Reorder functions into a logical sequence based on usage
There are no code changes; this is committed separately so as to make
the subsequent "real" diffs easier to read.
2015-08-25 21:17:24 +05:30
Richard Poole
3090a45891 add option to ansible-vault to read new password from file for rekey
The --new-vault-password-file option works the same as
--vault-password-file but applies only to rekeying (when
--vault-password-file sets the old password). Also update the manpage
to document these options more fully.
2015-08-25 21:14:49 +05:30
Brian Coca
ae91cdfc98 fixed environment inheritance 2015-08-25 10:15:32 -04:00
Brian Coca
8aa732e0a4 allow for lists, sets and dicts to default to None, now return empty type in post processing
remove defaults from inhertiable fieldattributes to allow for proper detection and override
2015-08-25 10:14:28 -04:00
Marius Gedminas
44c94328c8 Speed up execution
`if method in dir(self):` is very inefficient:

- it must construct a list object listing all the object attributes & methods
- it must then perform a O(N) linear scan of that list

Replace it with the idiomatic `if hasattr(self, method):`, which is a
O(1) expected time hash lookup.

Should fix #11981.
2015-08-25 16:07:21 +03:00
Rene Moser
3db4039ad1 cloudstack: implement general api_region support, update docs 2015-08-25 13:54:21 +02:00
objectified
b1785a0361 replace compare_versions() with distutils.version 2015-08-25 02:18:37 -04:00
objectified
c39fb43ad9 added Maintainer comment header 2015-08-25 02:06:01 -04:00
Toshio Kuratomi
1f7b0fee0a Fixes #12076 2015-08-24 19:07:04 -07:00
Brian Coca
17060f9849 remove +1 from size that was cutting off first char of copied files when a recursive dir
fixes #12055
2015-08-24 21:10:03 -04:00
Toshio Kuratomi
6e107d2f22 Comments pointing the way towards substituting cryptography for pycrypto 2015-08-24 15:50:37 -07:00
Brian Coca
16f3f8e244 now does not error out when notes are not included in module 2015-08-24 13:24:58 -04:00
objectified
d9723069c5 align exec_command() definition with local.py 2015-08-24 12:32:11 -04:00
objectified
3a5522a22c fake being connected for logging purposes 2015-08-24 12:32:11 -04:00
objectified
8f2a6a9fae use docker cp when docker >=1.8.0 2015-08-24 12:32:11 -04:00
objectified
2de773477f allow ansible to connect to docker containers 2015-08-24 12:32:11 -04:00
James Cammarata
21e421ce53 Validate required list items are not None or empty strings
Fixes #12011
2015-08-24 11:44:28 -04:00
James Cammarata
db65503778 Revert "Add PowerShell exception handling and turn on strict mode." 2015-08-23 21:09:16 -04:00
Abhijit Menon-Sen
3aedc0bca9 Don't insist on ansible-vault taking only one filename parameter
Apart from ansible-vault create, every vault subcommand is happy to deal
with multiple filenames, so we can check that there's at least one, and
make create check separately that there aren't any extra.
2015-08-23 17:52:51 -04:00
Brian Coca
f1b8323b62 fixed host/group var loading when inventory is a directory 2015-08-23 17:51:47 -04:00
Brian Coca
af06a97f17 kept vars as alias to hostvars[inventory_hostname] and avoid subtrees into themselves 2015-08-23 17:51:47 -04:00
Brian Coca
3ccfebc9f7 Merge pull request #12047 from cchurch/powershell_common_cleanup
Add PowerShell exception handling and turn on strict mode.
2015-08-23 14:08:18 -04:00
Brian Coca
a4ffa09414 Merge pull request #11880 from bcoca/configurable_squash
made squashable with_ plugin list configurable
2015-08-23 13:32:15 -04:00
Abhijit Menon-Sen
09e4eac2e5 Use rsplit(':',1) for clarity; no functional changes 2015-08-23 22:52:35 +05:30
Ryan Petrello
1886307845 Fix a parsing bug that prevents IPv6 addresses from being used with add_host
Closes #8682
2015-08-23 22:50:47 +05:30
Chris Church
4b2cdadc98 Add PowerShell exception handling and turn on strict mode.
* Add exception handling when running PowerShell modules to provide exception message and stack trace.
* Enable strict mode for all PowerShell modules and internal commands.
* Update common PowerShell code to fix strict mode errors.
* Fix an issue with Set-Attr where it would not replace an existing property if already set.
* Add tests for exception handling using modified win_ping modules.
2015-08-22 18:28:07 -04:00
Brian Coca
47d9e7ca93 Merge pull request #11984 from Alphadelta14/devel
Support any Mapping for with_dict lookup.
2015-08-22 12:39:42 -04:00
James Cammarata
0958edfc7c Submodule pointer update 2015-08-22 12:39:04 -04:00
Brian Coca
e8157eab19 now output works for both search and info 2015-08-22 02:42:21 -04:00
Brian Coca
a6c0661d21 made src more prominent 2015-08-22 02:33:17 -04:00
Brian Coca
6ffd9c3025 draft galaxy cli search
TODO: paging results
2015-08-22 02:28:27 -04:00
James Cammarata
e282309f6d Make sure the inventory restriction is not None 2015-08-21 16:08:21 -04:00
James Cammarata
635fa0757b Several var fixes
* Fixes hostvar serialization issue (#12005)
* Fixes regression in include_vars from within a role (#9498), where
  we had the precedence order for vars_cache (include_vars, set_fact)
  incorrectly before role vars.
* Fixes another bug in which vars loaded from files in the format of
  a list instead of dictionary would cause a failure.

Fixes #9498
Fixes #12005
2015-08-21 12:02:23 -04:00
Brian Coca
144da7e7d1 Merge pull request #11765 from ldx/vault_pbkdf2hmac
Use PBKDF2HMAC() from cryptography for vault keys.
2015-08-21 11:06:00 -04:00
Brian Coca
f150fe2c23 moved mandatory back to filters as it does not always return a boolean, it does an exception on failure 2015-08-21 09:54:56 -04:00
Brian Coca
2787b3acac ported consul_kv lookup from v1 2015-08-21 00:22:20 -04:00
Brian Coca
74079db8d2 ported dig lookup from v1 2015-08-21 00:22:01 -04:00
Brian Coca
9bb95b5235 Merge pull request #12031 from amenonsen/deadcode
Remove unused (copied) _before_comment method
2015-08-20 23:36:56 -04:00
Brian Coca
f6b6ed530b added file tests 2015-08-20 22:04:21 -04:00
Brian Coca
cd4a0c70b0 isnotanumber is not needed as jinja2 has builtin number test 2015-08-20 22:04:20 -04:00
Brian Coca
fe06577ac2 fixed mandatory test 2015-08-20 22:04:20 -04:00
Abhijit Menon-Sen
599ad9cb51 Remove unused (copied) _before_comment method
This was copied from inventory/ini.py, but the rewritten version doesn't
use it, and shows that it isn't needed.
2015-08-21 06:58:23 +05:30
Toshio Kuratomi
b5a078a385 update submodule refs 2015-08-20 15:41:05 -07:00
Abhijit Menon-Sen
745ecd4845 Sanitize IPv6 hostname/port handling
Now we accept IPv6 addresses _with port numbers_ only in the standard
[xxx]:NN notation (though bare IPv6 addresses may be given, as before,
and non-IPv6 addresses may also be placed in square brackets), and any
other host identifiers (IPv4/hostname/host pattern) as before, with an
optional :NN suffix.
2015-08-20 22:06:44 +05:30
Abhijit Menon-Sen
74aab6f726 Use a self._raise_error helper and avoid passing the lineno around
Based on a patch by @Richard2ndQuadrant.
2015-08-20 22:05:17 +05:30
Abhijit Menon-Sen
9133cd409c Make _parse take an array of input lines as an argument
(There's no compelling reason to do this right now, but should be parser
need to be called multiple times in future, this makes it easier.)
2015-08-20 22:05:17 +05:30
Abhijit Menon-Sen
98a1905796 Rename 'section' to 'groupname' to better reflect its purpose 2015-08-20 22:05:17 +05:30
Abhijit Menon-Sen
1284c49bd7 Rewrite the INI InventoryParser
The new code parses INI-format inventory files in a single pass using a
well-documented state machine that reports precise errors and eliminates
the duplications and inconsistencies and outright errors in the earlier
three-phase parsing code (e.g. three ways to skip comments). It is also
much easier now to follow what decisions are being taken on the basis of
the parsed data. The comments point out various potential improvements,
particularly in the area of consistent IPv6 handling.

On the ornate marble tombstone of the old code, the following
inscription is one last baffling memento from a bygone age:

-    def _before_comment(self, msg):
-        ''' what's the part of a string before a comment? '''
-        msg = msg.replace("\#","**NOT_A_COMMENT**")
-        msg = msg.split("#")[0]
-        msg = msg.replace("**NOT_A_COMMENT**","#")
-        return msg
2015-08-20 22:05:17 +05:30
Jon Hawkesworth
a46b500851 Add win_splitdrive filter for windows users 2015-08-20 13:54:54 +01:00
Toshio Kuratomi
4f32a61504 Merge pull request #10957 from feanil/feanil/retain_nonetypes
Don't convert nulls to strings.
2015-08-19 19:43:27 -07:00
Brian Coca
e8b86f448d fix issue with improper connection override in delegation 2015-08-19 20:36:08 -04:00
Feanil Patel
892e230514 Don't convert nulls to strings.
This change is similar to https://github.com/ansible/ansible/pull/10465

It extends the logic there to also support none types.  Right now if you have
a '!!null' in yaml, and that var gets passed around, it will get converted to
a string.

eg. defaults/main.yml
```
ENABLE_AWESOME_FEATURE: !!null # Yaml Null
OTHER_CONFIG:
  secret1: "so_secret"
  secret2: "even_more_secret"

CONFIG:
  hostname: "some_hostname"
  features:
    awesame_feature: "{{ ENABLE_AWESOME_FEATURE}}"
  secrets: "{{ OTHER_CONFIG }}"
```

If you output `CONFIG` to json or yaml, the feature flag would get represented in the output
as a string instead of as a null, but secrets would get represented as a dictionary.  This is
a mis-match in behaviour where some "types" are retained and others are not.  This change
should fix the issue.

I also updated the template test to test for this and made the changes to v2.

Added a changelog entry specifically for the change from empty string to null as the default.

Made the null representation configurable.

It still defaults to the python NoneType but can be overriden to be an emptystring by updating
the DEFAULT_NULL_REPRESENTATION config.
2015-08-19 18:35:07 -04:00
Brian Coca
22a69e2498 fixes to delegation code 2015-08-19 15:49:37 -04:00
Brian Coca
36cbd771a4 changed fixme to deprecated 2015-08-19 15:49:37 -04:00
Brian Coca
961bee00d5 centralized the definition of 'localhost' 2015-08-19 15:49:37 -04:00
Rene Moser
d16429b59c cloudstack: rename returns for consistency 2015-08-19 21:25:19 +02:00
Abhijit Menon-Sen
2641f70e47 Reset self._groups_cache in refresh_inventory 2015-08-19 11:35:27 +05:30
Harald Laabs
73d6da757f Make get_group run in O(n*log(n)) instead of O(n^2) by using a cache 2015-08-19 11:35:27 +05:30
Brian Coca
1b810e3101 Merge pull request #12000 from bcoca/local_action_connect
changed local_action to alias to connection=local vs delegate_to=locahost
2015-08-19 00:34:03 -04:00
Will West
b8865314ec improve ansible start up time for very large inventory
first off, we add an oddly slow basic test of 10k item inventory

Before:
```
Ran 229 tests in 13.214s

OK

real    0m13.403s
user    0m12.106s
sys 0m1.155s
```

After:
```
Ran 230 tests in 21.328s

OK

real    0m21.516s
user    0m20.099s
sys 0m1.275s
```

since that seems like a bit long for the test to add to runtime, lets profile

`python -m cProfile -s time ./bin/ansible all -i test/units/inventory_test_data/huge_range --list-hosts`

Before:
```
         1272607 function calls (1259689 primitive calls) in 8.497 seconds

   Ordered by: internal time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
    10000    4.393    0.000    4.396    0.000 __init__.py:395(_get_host)
    20000    2.695    0.000    2.697    0.000 __init__.py:341(__append_host_to_results)
    40369    0.113    0.000    0.113    0.000 {posix.lstat}
    50006    0.102    0.000    0.153    0.000 __init__.py:1490(combine_vars)
    40008    0.089    0.000    0.202    0.000 __init__.py:1546(_load_vars_from_path)
    20195    0.088    0.000    0.088    0.000 {posix.stat}
    10011    0.087    0.000    0.087    0.000 {posix.getcwd}
```

The top two lines are promising optimization targets

- populate Inventory's host cache more in _get_host, as we are looping
  over all the groups anyways.

- eliminate duplicate check of whether we've already included a host
  in the construction around __append_host_to_results we can infer
  presence of a host in the results list implies the presence of its
  name in the hostnames set, allowing us to only to the less expensive
  of the two checks

After:
```
         1252610 function calls (1239692 primitive calls) in 1.320 seconds

   Ordered by: internal time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
    40369    0.105    0.000    0.105    0.000 {posix.lstat}
    50006    0.094    0.000    0.141    0.000 __init__.py:1490(combine_vars)
    40008    0.081    0.000    0.184    0.000 __init__.py:1546(_load_vars_from_path)
    10011    0.080    0.000    0.080    0.000 {posix.getcwd}
    20195    0.074    0.000    0.074    0.000 {posix.stat}
    10002    0.069    0.000    0.261    0.000 __init__.py:1517(load_vars)
```
2015-08-19 09:45:02 +05:30
Brian Coca
7a4a156d91 changed local_action to alias to connection=local vs delegate_to=localhost
fixes #11998, but still leaves issue of delegate_to: localhost not working
2015-08-18 18:31:29 -04:00
Brian Coca
f2c6785897 Merge pull request #11989 from bcoca/osx_queue_fix
changed check to avoid OS X broken sem_getvalue()
2015-08-18 09:58:21 -04:00
Brian Coca
26ed50ecdf fixed indent 2015-08-18 09:58:25 -04:00
Brian Coca
2198f48f54 changed check to avoid OS X broken sem_getvalue()
fixes #11988
2015-08-18 03:46:20 -04:00
Brian Coca
e081a73aa1 make new inventory config take precedence over old hostfile config
fixes #11907
2015-08-18 03:29:14 -04:00
Brian Coca
17b4b1f85c added ability to limit in ansilbe pull
refactored the options a bit, new inventory_opts made sense to always group
fixes #7917
2015-08-18 03:17:58 -04:00
Brian Coca
1acb29ff9b sequence will now run once for start=end, added test to suite
fixes #11979
2015-08-18 02:33:23 -04:00
Brian Coca
ee21ebaffc Merge pull request #11975 from mutemule/become_doas
Add become support for OpenBSD doas
2015-08-17 21:36:03 -04:00
Damian Gerow
1c5611100e Add become support for OpenBSD doas 2015-08-17 21:31:18 -04:00
Alphadelta14
77b60a1a67 Support any Mapping for with_dict lookup.
This resolves 3939348286 breaking `with_dict: hostvars`.
2015-08-17 20:11:24 -04:00
Brian Coca
c419cacb04 check if host task is none before continuing
fixes #11982
2015-08-17 18:56:04 -04:00
James Cammarata
e7b2308b66 Performance improvements
* Speed up serialization of hostvars by simply using the internal
  dictionary used for cached lookups
* Use blocking gets/puts on queues instead of spin locking
* Merge sequential implicitly created blocks
2015-08-17 13:46:57 -04:00
Brian Coca
4068598c15 Merge pull request #11977 from resmo/for-ansible
cloudstack: add more common returns
2015-08-17 12:32:44 -04:00
Rene Moser
2913d2b44d cloudstack: add more common returns 2015-08-17 08:21:37 +02:00
Brian Coca
6058eaa92f removed unused poller 2015-08-16 20:12:06 -04:00
Brian Coca
9b61cf5840 implemented async tasks in adhoc v2 2015-08-16 20:05:10 -04:00
Brian Coca
ee2e31b37a now passes the test of skipping list when dict attribute is undefined, added deprecation warning as this seems like bad behaviour 2015-08-16 10:16:02 -04:00
Brian Coca
950622cebd made sure they all look in files/vars/template dirs also when executed in play and not only from task 2015-08-16 02:37:21 -04:00
Brian Coca
861fdfc5ba updated callbacks to properly test diff no matter if dict or list 2015-08-16 02:37:21 -04:00
Brian Coca
79ea6d3a1e copy now passes a list of diffs 2015-08-16 02:37:21 -04:00
Brian Coca
c3372936aa diff can now be a list 2015-08-16 02:37:21 -04:00
Brian Coca
13c91ef9d4 actually use the read source contents for the diff 2015-08-16 02:37:21 -04:00
Brian Coca
45cebd283f added remote_src to copy, now allows copying to be done on the target server 2015-08-16 02:37:21 -04:00
Brian Coca
1b7369cc8d added diff to assemble for remote_src=false 2015-08-16 02:37:21 -04:00
Brian Coca
f048aca5f6 runas placeholder 2015-08-16 02:37:21 -04:00
Brian Coca
49eb95e2d1 some fixes to become/sudo
* now it uses -n to get immediate error if no password is supplied and one is needed,
   this should fix the issue with sudo hanging waiting for input.
 * made -k configurable, this can break changing become_users in play if left out,
   but opens up the possiblity of OTP support.
2015-08-15 12:17:40 -04:00
James Cammarata
4836641683 Use ansible_python_interpreter value for remote checksums
Fixes #11968
Fixes #11969
2015-08-15 12:00:55 -04:00
Brian Coca
7a51836530 check for failure in fact gathering 2015-08-15 11:29:10 -04:00
Brian Coca
1edae51e05 added generic service module, step #1 to separating services to their own modules
falls back to current service module and requries service mgr facts and new service modules
2015-08-15 11:00:26 -04:00
Brian Coca
172e0c328c fixed adhoc fact gathering 2015-08-15 11:00:10 -04:00
Brian Coca
0381923333 fixed call to setup module 2015-08-15 10:50:22 -04:00
Brian Coca
92e2f54228 fixed issues with utf-8 encoding in docs, moved pager to use display class instad of bare prints 2015-08-14 22:00:48 -04:00
Brian Coca
245e0dd4b7 made returns from next task consistent to avoid typeerrors, also linear now checks for none
fixes #11965
2015-08-14 18:07:14 -04:00
Brian Coca
9f5e4c0ef6 lookup plugin that does no flattening 2015-08-14 17:05:41 -04:00
Abhijit Menon-Sen
8f231ec469 Tweak deprecation warning, and apply it to --limit also 2015-08-14 10:55:13 +05:30
James Cammarata
4714cbeec8 Override post validation of environment to allow bare variables
Also prints a deprecated warning if a bare variable is detected, so
that we can remove this in a future version.

Fixes #11912
2015-08-14 00:33:36 -04:00
James Cammarata
4dba30ccd0 Cleanup missed merge conflict sections 2015-08-13 15:05:58 -04:00
Abhijit Menon-Sen
d41db8edd6 Don't accept undocumented "p1;p2" patterns; note in changelog
The correct (and now only) way to say p1 OR p2 is "p1:p2".
2015-08-13 14:54:12 -04:00
Abhijit Menon-Sen
1437b8e120 Introduce _split_pattern to parse an "x:y:z" pattern
This function takes a string like 'foo:bar[1:2]:baz[x:y]-quux' and
returns a list of patterns ['foo', 'bar[1:2]', 'baz[x:y]-quux'], i.e.
splits the string on colons that are not part of a range specification.
2015-08-13 14:54:12 -04:00
James Cammarata
32034feec5 Add deprecation warning regarding host patterns 2015-08-13 14:51:08 -04:00
Abhijit Menon-Sen
6bf6b9fdbb Rename some internal functions, clarify what they do
get_hosts → used externally, not changed
_get_hosts → _evaluate_patterns (takes a list, evaluates ! and &)
__get_hosts → _match_one_pattern (takes one pattern only, ignores !&)
2015-08-13 14:51:08 -04:00
Abhijit Menon-Sen
eff33bac49 Don't accept undocumented "p1;p2" patterns; note in changelog
The correct (and now only) way to say p1 OR p2 is "p1:p2".
2015-08-13 14:51:08 -04:00
Abhijit Menon-Sen
8aaa06dd50 Introduce _split_pattern to parse an "x:y:z" pattern
This function takes a string like 'foo:bar[1:2]:baz[x:y]-quux' and
returns a list of patterns ['foo', 'bar[1:2]', 'baz[x:y]-quux'], i.e.
splits the string on colons that are not part of a range specification.
2015-08-13 14:51:08 -04:00
Abhijit Menon-Sen
baf637b9ae Remove dead code: Inventory.also_restrict_to/lift_also_restriction
This was used earlier to implement serial, but that's now done using
restrict_to_hosts() (whose docstring is also suitably adjusted here)
and there are no more callers.
2015-08-13 14:51:08 -04:00
James Cammarata
6c036c3633 Template parent include file paths
Fixes #11955
2015-08-13 13:01:45 -04:00
Brian Coca
b905f51341 fixed typo 2015-08-13 11:05:20 -04:00
Brian Coca
8af0ff4a58 Merge pull request #11567 from lekum/shelvefile_lookup
Add shelvefile lookup plugin
2015-08-13 10:47:44 -04:00
Brian Coca
fbc7224066 Merge pull request #11643 from bcoca/meta_inventory_and_fixes
Meta inventory and fixes
2015-08-13 10:36:57 -04:00
James Cammarata
eb381bd522 Add one more search path to path_dwim_relative 2015-08-13 09:53:09 -04:00
Brian Coca
c6733cc1a7 Merge pull request #9225 from qvicksilver/aix_unprivileged
AIX unprivileged facts collection
2015-08-12 23:48:44 -04:00
Brian Coca
5027f66562 Merge pull request #11864 from jhawkesworth/win_path_filters
add win_basename and win_dirname filters
2015-08-12 23:46:15 -04:00
James Cammarata
a498876bec Make sure playbook includes use unique var dictionaries before modification 2015-08-12 23:38:47 -04:00
Brian Coca
5fec11f513 capture parsing exceptions and give nice error and location 2015-08-12 23:27:00 -04:00
Brian Coca
621b18c6ef fixed source path discovery for unarchive in roles
fixes #11943
2015-08-12 22:50:30 -04:00
Brian Coca
70d024ffce show errors when missing vars file or when there is syntax issue in the file
fixes #11945
2015-08-12 22:39:06 -04:00
Brian Coca
3d9875773b Merge pull request #11947 from resmo/for-ansible
cloudstack: refactor get_result()
2015-08-12 17:46:18 -04:00
Brian Coca
2c34a5bdbd pass list correctly to lookup 2015-08-12 17:42:06 -04:00
James Cammarata
dd67b1e4d6 Adjust relative include searches when roles are involved
Fixes #11895
2015-08-12 17:15:52 -04:00
Rene Moser
4f3c863b42 cloudstack: refactor get_result()
* A commen dict of keys has been defined, which we look in results returned from the API.
* self.returns dict can be use in subclass to extend this dict.
* Optionally the key name can be replaced with a new key name, often used to make the return keys identical to the arguments passed.
* Use new style class
2015-08-12 23:14:17 +02:00
James Cammarata
d9833f227f Make sure cached data from file loads isn't impacted by modifications
Fixes #11893
2015-08-12 14:30:43 -04:00
Brian Coca
6bceee9a93 now lvs/vg facts are only attempted if binary found 2015-08-12 10:53:13 -04:00
James Cammarata
c7dde72aa0 Default listify to converting bare variables again
Since we explicitly set convert_bare=False in the template lookup
code, but still want individual looks that call listify directly to
convert bare variables if needed.
2015-08-12 10:49:46 -04:00
James Cammarata
ac66e4001c Fix for variable precedence with tasks/includes
Fixes #11881
2015-08-12 10:49:45 -04:00
Brian Coca
2688edb32b Merge pull request #11940 from alxgu/fix_lvm_facts
bugfix: missing path for lvm facts
2015-08-12 10:49:14 -04:00
Brian Coca
39f81a8fa5 removed unused imports 2015-08-12 10:35:49 -04:00
Brian Coca
c27978fa93 minor fixes to pull 2015-08-12 10:35:49 -04:00
Brian Coca
9f29e39dea give more matching options for ansible-pull 2015-08-12 10:35:49 -04:00
Brian Coca
e46b1e8d2b adjusted tree to work more like v1, also now skips when dir not supplied 2015-08-12 10:35:49 -04:00
Alexander Gubin
1ea1b9fb13 bugfix: missing path for lvm facts 2015-08-12 16:35:31 +02:00
Brian Coca
49d88cef9c meta: refresh_inventory and several inventory fixes 2015-08-12 10:35:12 -04:00
Brian Coca
8e30e3791e Merge pull request #11811 from amenonsen/fixme-range
FIXME in host range parsing
2015-08-12 09:06:39 -04:00
Brian Coca
ae9d264b86 Merge pull request #11762 from amenonsen/9795-rebase
Add LVM facts to setup module
2015-08-12 08:55:08 -04:00
James Cammarata
829a88b906 Disable undefined error failures during conditional templating
This allows us to properly catch the 'is defined' and 'is undefined'
checks and return the correct boolean result.

Fixes #11892
2015-08-12 07:37:03 -04:00
James Cammarata
e0b074000e Merge pull request #11764 from lpirl/devel_v2
fixes remote code execution for su/sudo with strict remote umasks
2015-08-11 22:30:44 -04:00
James Cammarata
38eb53de1d Fix bug in vars using correct temp value for vars
Fixes #11877
2015-08-11 21:23:37 -04:00
Brian Coca
4d853a5d3c implemented for v2, missing --tree option for adhoc 2015-08-11 19:18:10 -04:00
Brian Coca
79a1bca010 avoid circular import 2015-08-11 17:20:48 -04:00
Brian Coca
a83b8220ef added import back 2015-08-11 16:42:51 -04:00
Brian Coca
6e825e8c22 fixed listify for lookups, made sure convert_bare is only on with_ 2015-08-11 16:42:09 -04:00
James Cammarata
adb9d7e461 Track role execution per-host, not overall in the role
Fixes #11863
Fixes #11878
2015-08-11 16:34:58 -04:00
Rene Moser
e62fbf5fba cloudstack: add get_result() in utils to return common results 2015-08-11 18:03:50 +02:00
James Cammarata
f904acbd14 Fixing bug related to listify changes 2015-08-11 01:33:43 -04:00
James Cammarata
169d316704 Fixing bugs in include + loops
Fixes #11872
2015-08-11 01:33:43 -04:00
Brian Coca
7666bde666 updated hashi_vault to new listify, added to changelog 2015-08-10 21:10:00 -04:00
Brian Coca
4399ddc7da Merge pull request #11674 from defionscode/hashi_vault_lookup
Hashicorp Vault lookup Plugin
2015-08-10 21:07:22 -04:00
Jonathan Davila
175068fdae Hashicorp Vault lookup Plugin 2015-08-10 19:35:28 -04:00
Brian Coca
7e7b546c34 reinstated listify 2015-08-10 17:38:20 -04:00
Brian Coca
3e5dbd045f fixed ref to removed var 2015-08-10 14:02:42 -04:00
Brian Coca
5c1d850fbb now fixed to actually work 2015-08-10 13:51:56 -04:00
Brian Coca
ee365c881f fixed typo 2015-08-10 13:44:52 -04:00
Brian Coca
c08305a31f set script command itself to be sudable and not use the chmod sudoable settings as it can
ignore sudo settings for script when become_user is not root
fixes #11902
2015-08-10 13:19:37 -04:00
Toshio Kuratomi
d35b956900 listify lookup plugin terms when they're specified as "{{ lookup(terms) }}"
Before this, they were not listified there but they were listified when
specified like this:

with_lookup: terms
2015-08-10 09:07:37 -07:00
Brian Coca
dbab703265 fine tuned password handling as we were getting false positives, probably caused by other changes up the stack that now call these functions in more cases. 2015-08-07 16:27:25 -04:00
Brian Coca
6fcfebd21d made sure we need becoem before we format the command, added debug entry also 2015-08-07 16:27:25 -04:00
Brian Coca
df768e0db4 fixed debug statement 2015-08-07 16:27:25 -04:00
Brian Coca
177499476b fixed warning 2015-08-07 16:27:25 -04:00
Toshio Kuratomi
3ef49844db Update core submodule ref 2015-08-07 12:28:56 -07:00
Brian Coca
8f106c9a58 Merge pull request #11078 from Yannig/devel
New lookup plugin : ini
2015-08-07 09:46:54 -04:00
Yannig Perré
07fcb50b9b Porting ini lookup plugin against ansible v2. 2015-08-07 09:40:24 +02:00
Toshio Kuratomi
f1144752c4 Pull in docs fix from core modules 2015-08-06 21:11:49 -07:00
James Cammarata
e7d0c9f820 Re-add vars to Base and standardize var processing
Fixes #11779
2015-08-07 00:06:30 -04:00
Brian Coca
dbe7a9fe2f Merge pull request #11857 from quinot/bug/playbook-init-comment
Minor comment fix
2015-08-06 23:39:08 -04:00
Brian Coca
3c57018a10 Merge pull request #11778 from Ensighten/add_credstash_plugin
add credstash lookup plugin
2015-08-06 23:27:18 -04:00
Brian Coca
d47d0b1d7f now continue/abort mode allows ignoring other input 2015-08-06 22:16:30 -04:00
Brian Coca
a555a0652e allow for vars_prompt and pause prompt to be skipped in non interactive settings
ansible-pull users rejoice
2015-08-06 19:20:45 -04:00
Toshio Kuratomi
ce52fdebe8 Pull in get_url checksum change 2015-08-06 15:45:23 -07:00
Brian Coca
29cd72b7d8 even simpler condition tree for pause 2015-08-06 18:40:15 -04:00
Brian Coca
dc80bc8929 now pause behaves like v1 pause 2015-08-06 18:09:59 -04:00
Brian Coca
f7707d8850 brought user_input back to pause 2015-08-06 17:49:14 -04:00
Toshio Kuratomi
00b1a2c865 Restore ValueError in md5 method and change finding the available hash algorithms so we only have to do it once 2015-08-06 14:40:28 -07:00
Brian Coca
15a20e814b added tags back to ansible-pull 2015-08-06 17:37:05 -04:00
Brian Coca
5f0359c119 keep banners at 79 2015-08-06 17:37:05 -04:00
Brian Coca
25e67bb716 text wrap now adapts to terminal 2015-08-06 17:37:05 -04:00
Toshio Kuratomi
80cb69214b Merge pull request #11840 from muffl0n/module_utils_hash_algorithms
Add get_available_hash_algorithms()
2015-08-06 14:29:31 -07:00
James Cammarata
d44daf53cc Allow wrapped text in deprecated messages 2015-08-06 17:21:02 -04:00
James Cammarata
5eb092b331 Handle top-level vars for include tasks to match v1 syntax
The "streamlined" syntax will be deprecated at some point in the future.

Fixes #11882
2015-08-06 17:21:02 -04:00
Toshio Kuratomi
e16b24c01e Update submodule ref 2015-08-06 08:45:09 -07:00
Toshio Kuratomi
e8452c864e Restore the relative path handling portion of #11865 2015-08-06 07:28:22 -07:00
James Cammarata
26d5a17b59 Make sure inventory loads files with non-relative paths
This is a slightly different fix than we originally committed, but fixes
the problem in a less invasive way (and I believe it's generally better
that we don't deal with relative paths internally past this point)

Fixes #11789
2015-08-06 10:18:58 -04:00
Brian Coca
b9433650d1 Revert "Path of group_vars and host_vars were getting the basedir added twice."
in view of simpler solution incomming from james
This reverts commit bae7a02be5.
2015-08-06 10:09:43 -04:00
Brian Coca
9f156e5550 updated submodule refs 2015-08-06 09:42:35 -04:00
Brian Coca
7bea04141b Merge pull request #11865 from ansible/fix-group_vars_path
Path of group_vars and host_vars were getting the basedir added twice.
2015-08-06 09:40:13 -04:00
Brian Coca
08e6c1d82b avoid possible errors with new broadcast handling in linux 2015-08-06 09:00:52 -04:00
Brian Coca
cb2cfaebda started porting chroot to v2 2015-08-06 08:55:22 -04:00
Brian Coca
262c75c253 Merge pull request #10971 from mightydok/debbraoadcastfix
Add missed broadcast address to linux network facts.
2015-08-06 08:52:55 -04:00
Scott Cunningham
87ef53c962 credstash lookup plugin: python 2.6-compatible string.format() 2015-08-05 23:40:43 -07:00
Scott Cunningham
c4629b72e0 credstash lookup plugin: error out in run function when credstash not installed, not at module scope 2015-08-05 23:37:10 -07:00
Toshio Kuratomi
bae7a02be5 Path of group_vars and host_vars were getting the basedir added twice.
Fix inventory so this won't happen and fix DataLoader so that it will
test relative paths relative to self._basedir

Fixes #11789
2015-08-05 17:41:17 -07:00
Toshio Kuratomi
e7b5cb8782 Fix synchronize source path with roles and local connection
Fixes #8261
2015-08-05 13:32:12 -07:00
Toshio Kuratomi
dd7fa07038 Update submodule refs so synchronize plugin works 2015-08-05 13:19:28 -07:00
Toshio Kuratomi
308bf80055 Cleanups to synchronize including:
* Better comments
* Reorganize code so related settings are close to each other
* Add ::1 to the "localhost" patterns we look for
* Make the dest_port parameter override the ansible_ssh_port setting
* Fix dest_port (wasn't being set)
* more complete detection of delegate_to
* Fix set_remote_user (wasn't being looked for in parameters)
* Instead of removing mode here, have the ansible module accept it
  (better documents the parameters doing it htat way)
2015-08-05 13:16:08 -07:00
James Cammarata
37e38924de Allow field attributes to have priorities
So that roles are loaded ahead of all other play fields, meaning any
plugins contained within the roles are loaded first before tasks.

Fixes #11858
2015-08-05 13:54:00 -04:00
Jon Hawkesworth
f69da544f7 add win_basename and win_dirname filters 2015-08-05 18:38:15 +01:00
James Cammarata
fad44862a5 Implementing includes in the free strategy 2015-08-05 11:53:04 -04:00
Brian Coca
2b9b3a08a1 make sure you only update pci data if there is a match 2015-08-05 09:44:37 -04:00
Yannig Perré
09d257e637 Porting ini lookup plugin against ansible v2. 2015-08-05 12:07:16 +02:00
Thomas Quinot
5d3cb636ad Minor comment fix 2015-08-05 11:30:26 +02:00
Yannig Perré
47db352725 Merge remote-tracking branch 'ansible/devel' into devel 2015-08-05 11:20:41 +02:00
Yannig Perré
733d40a77c When value does not exist, return default value instead of stopping ansible with an exception. 2015-08-05 10:54:24 +02:00
James Cammarata
faf4c3bb6c Merge pull request #11816 from amenonsen/ssh-ipv6
Fix ssh connections to IPv6 addresses
2015-08-05 00:10:34 -04:00
James Cammarata
dbd755e0f4 Fix jinja2 template search pathing
Fixes #9933
2015-08-04 22:50:16 -04:00
Scott Cunningham
934ce86d35 update credstash lookup plugin to use Python 2.4-compatible exception catching 2015-08-04 18:29:37 -07:00
James Cammarata
61e76fd707 Allow conditionals on PlaybookInclude statements
Fixes #11852
2015-08-04 15:24:28 -04:00
James Cammarata
b6c3e5d797 Validate variable names given in set_fact
Fixes #11851
2015-08-04 13:30:47 -04:00
James Cammarata
5266679964 Use templar all the way down
Fixes bugs related to creating Templar() objects on the fly, where
the shared loader objects (serialized to TaskExecutor) aren't used
so information loaded into plugin loaders after forking is lost.

Fixes #11815
2015-08-04 12:25:53 -04:00
muffl0n
8d6d711a5c move get_available_hash_algorithms() from get_url 2015-08-04 08:57:36 +02:00
James Cammarata
c3ce140dd2 Exclude loop_args from post_validation for tasks
This field is templated specially during the TaskExecutor's loop
calculation, so there's no need to post validate it again.

Fixes #11481
2015-08-04 01:12:27 -04:00
Brian Coca
015b922c1f fix quoting for become commands
fixes #11808
2015-08-03 18:49:23 -04:00
Toshio Kuratomi
ca941ec632 style cleanup because -ECANNOTUNDERSTAND without it 2015-08-03 15:05:26 -07:00
Toshio Kuratomi
f86245dcb0 Add a warning about python3 in the synchronize plugin 2015-08-03 15:05:26 -07:00
Toshio Kuratomi
f0431eaea9 Make ansible_python_interpreter work with synchronize
Fixes #11836
2015-08-03 13:32:24 -07:00
James Cammarata
8279557e8f Allow role names to be templated
Fixes #10858
2015-08-03 16:26:13 -04:00
James Cammarata
ed603f7030 Fix free strategy only running first play in a multi-play playbook
Fixes #11839
2015-08-03 14:40:16 -04:00
James Cammarata
c2435fab7e Inject the play context vars into the variables used for loop item templating 2015-08-03 12:12:45 -04:00
James Cammarata
bcbcfc79be Fix relative paths for included files
Also modifies the Play class to not include become* fields in the
post-validation step.

Fixes #11353
2015-08-03 12:04:31 -04:00
James Cammarata
2673eb0afb Add option to fail on undefined variables to listify
And use it in the call to get the loop items for a task.
2015-08-03 12:04:31 -04:00
James Cammarata
a586c74967 Merge pull request #11838 from cchurch/stringify_powershell_unquote_value
Fix for PowerShell unquote method when passed None.
2015-08-02 22:57:27 -04:00
James Cammarata
f6d1b5e233 Merge pull request #11835 from cchurch/raw_is_not_raw_enough
Raw is not raw enough
2015-08-02 22:56:45 -04:00
James Cammarata
7b9aee7077 Merge pull request #11832 from amenonsen/zeroforks
Disallow --forks 0
2015-08-02 22:39:21 -04:00
Chris Church
cafc35fd5b Fix for PowerShell unquote method when passed None. 2015-08-02 18:38:29 -04:00
Abhijit Menon-Sen
7d9689c1c5 Slice ascii_letters directly instead of using 'for x in range()' 2015-08-02 23:47:18 +05:30
Abhijit Menon-Sen
bfe708a189 Make host range parsing errors issue better messages
Now we always say "host range must …specific thing…"
2015-08-02 23:47:18 +05:30
Abhijit Menon-Sen
1413496292 Implement step for alphabetic ranges: [a:e:2] => a,c,e 2015-08-02 23:47:18 +05:30
Abhijit Menon-Sen
72715c6add Fix ssh connections to IPv6 addresses
We can unconditionally wrap remote_addr in square brackets for scp and
sftp (both of which require them for IPv6 addresses), but not wrap them
at all for ssh (which doesn't accept them). This way, we don't have to
detect and treat IPv6 addresses specially. This works for hostnames,
IPv4 addresses, and IPv6 addresses.

The earlier code seemed to intend to wrap all IPv6 addresses in square
brackets, which would have broken ssh, but it actually made no attempt
to detect IPv6 addresses at all (so it broke only with IPv6 addresses
for scp and sftp).

Based on a review of PR #11677 by @JuiceBoxSingularity
2015-08-02 23:46:01 +05:30
Chris Church
6969b5ac8b Make sure raw doesn't eat key=value arguments. 2015-08-02 11:57:32 -04:00
Abhijit Menon-Sen
861da614cc Make 'pause: prompt=…' print the prompt
In stable-1.9, the prompt string is passed to raw_input(), which prints
it without an extra \n. Here we're just print()ing it, so the \n would
be doubled.
2015-08-02 20:08:28 +05:30
James Cammarata
9936c5f9f6 Fixing the pause module for devel 2015-08-02 09:29:13 -04:00
Abhijit Menon-Sen
8de70fa657 Disallow --forks 0
Without at least one worker process, things break:

Traceback (most recent call last):
  File "/home/ams/extern/ansible/ansible/lib/ansible/executor/process/result.py", line 103, in run
    result = self._read_worker_result()
  File "/home/ams/extern/ansible/ansible/lib/ansible/executor/process/result.py", line 69, in _read_worker_result
    (worker_prc, main_q, rslt_q) = self._workers[self._cur_worker]
IndexError: list index out of range
2015-08-02 14:10:45 +05:30
Toshio Kuratomi
cf35bdbdf9 Merge pull request #11827 from amenonsen/trivial-fixmes
Remove TODO: the play already overrides options
2015-08-01 07:40:15 -07:00
Abhijit Menon-Sen
a9b020d6de Remove TODO: the play already overrides options 2015-08-01 20:09:02 +05:30
Abhijit Menon-Sen
1f2adb5e14 Show a better message when ansible.cfg is not found
Earlier we would say «Using  as config file» if we didn't find one.
2015-08-01 19:44:20 +05:30
Abhijit Menon-Sen
2cb7cd8379 Remove outdated FIXME; _compute_delegate is called below 2015-08-01 09:35:32 +05:30
Abhijit Menon-Sen
7b3cb2126c Remove outdated FIXME; ROLE_CACHE is already implemented below 2015-08-01 09:34:32 +05:30
Toshio Kuratomi
91a77b8603 Fix potential bug in parameter passing 2015-07-31 20:35:01 -07:00
James Cammarata
13b8a57d3d Undo previous travis/tox fixes and fix underlying issue 2015-07-31 23:01:43 -04:00
Toshio Kuratomi
0d72be3953 become protection for local connections no longer needed 2015-07-31 18:26:30 -07:00
Toshio Kuratomi
d1933accc3 Fixes for synchronize with delegate_to 2015-07-31 17:41:41 -07:00
Toshio Kuratomi
3939348286 Fix HostVars to support containment tests 2015-07-31 13:58:09 -07:00
Chris Church
74df17de29 Add an option for PowerShell modules to indicate support for check mode, skip running module if check mode is not supported. 2015-07-31 14:48:51 -04:00
Chris Church
e87cf4a3cc Fixes for WinRM/PowerShell support in v2.
- Add support for inserting module args into PowerShell modules.  Fixes #11661.
- Support Windows paths containing spaces.  Applies changes from #10727 to v2.  Fixes #9999.  Should also fix ansible/ansible-modules-core#944 and ansible/ansible-modules-core#1007.
- Change how execution policy is set for running remote scripts.  Applies changes from #11092 to v2.  Also fixes ansible/ansible-modules-core#1776.
- Use codepage 65001 (UTF-8) for WinRM connection instead of default (CP437), convert command to UTF-8 and results from UTF-8.  Replaces changes from #10024.  Fixes #11198.
- Close WinRM connection when task completes.
- Use win_stat, win_file and win_copy modules instead of stat, file and copy when called from within other action plugins (only when using WinRM+PowerShell).
- Unquote Windows path arguments before passing to win_stat, win_file, win_copy and slurp modules (only when using WinRM/PowerShell).
- Check for win_ping module to determine if core modules are missing (only when using WinRM/PowerShell).
- Add stdout_lines to result from running low level commands (so stdout_lines is available when using raw/script).
- Update copy action plugin to use shell functions for joining paths and checking for trailing slash.
- Update fetch action plugin to unquote source path when using Windows paths.
- Add win_copy and win_template action plugins that inherit from copy and template.
- Support running .bat and .cmd scripts using default system encoding instead of UTF-8.
- Always send PowerShell commands as base64-encoded blobs to allow for running simple PowerShell commands via raw.
- Support running modules on Windows with interpreters other than PowerShell.
- Update integration tests to support above changes and test unicode fixes.
- Add test for win_user error from ansible/ansible-modules-core#1241 (fixed by ansible/ansible-modules-core#1774).
- Add test for additional win_stat output values (implemented by ansible/ansible-modules-core#1473).
- Add test for OS architecture and name from setup.ps1 (implemented by ansible/ansible-modules-core#1100).

All WinRM integration tests pass for me with these changes.
2015-07-31 14:38:31 -04:00
Brian Coca
fa8043c0ba corrected typo 2015-07-31 13:49:48 -04:00
Brian Coca
f16b745f17 now properly uses default port if defined 2015-07-31 12:01:58 -04:00
Brian Coca
496186f5de makes ssh plugin resilient against invalid entries in hosts file
fixes #10238
2015-07-31 12:01:58 -04:00
Mark Chance
437d4deffc change ec2 util to create only requested objects 2015-07-31 09:47:24 -06:00
Toshio Kuratomi
e349004325 Update submodule ref to pull in apt_repo fixes 2015-07-31 08:22:48 -07:00
Jonathan Süssemilch Poulain
02294c52ce Typo 2015-07-31 13:25:42 +02:00
Jonathan Süssemilch Poulain
4614a574ea Allows network network interface facts collection as an unprivileged user and adds more facts 2015-07-31 10:39:02 +02:00
Jonathan Süssemilch Poulain
e181bcf62b Allows to fetch machine architecture as an unprivileged user 2015-07-31 10:35:10 +02:00
Brian Coca
9aa4214417 fixed delegate_to ref in syncronize 2015-07-30 20:53:18 -04:00
Brian Coca
8a00dff989 updated submodule refs 2015-07-30 18:37:41 -04:00
Brian Coca
07e5e98cbf removed jinaj2 override restrictions 2015-07-30 16:53:39 -04:00
Brian Coca
113f709eac brought up to date with default 2015-07-30 16:53:38 -04:00
Brian Coca
51de207197 Merge pull request #11805 from amenonsen/trivial-fixmes
A series of trivial FIXMEs for devel
2015-07-30 16:40:17 -04:00
Scott Cunningham
193e857bc4 credstash lookup plugin: raise AnsibleError when credstash library not installed 2015-07-30 21:04:26 +01:00
James Cammarata
222f04e387 Submodule pointer update 2015-07-30 14:50:53 -04:00
Abhijit Menon-Sen
807079ec2f Remove outdated FIXME; HostVars is imported and used below 2015-07-31 00:09:49 +05:30
Brian Coca
d05c4b82aa Merge pull request #11803 from amenonsen/prompt_encrypt
Uncomment encrypt handling for vars_prompt
2015-07-30 14:21:32 -04:00
Abhijit Menon-Sen
845784b572 Remove outdated FIXMEs; all use combine_vars already 2015-07-30 23:47:41 +05:30
James Cammarata
efcad3aa6d Re-allow vars on tasks, specifically for includes 2015-07-30 14:14:49 -04:00
James Cammarata
0ad52a403f Merge pull request #11804 from amenonsen/fixme
Easy FIXMEs
2015-07-30 13:58:40 -04:00
Abhijit Menon-Sen
1541e331c9 Also fix UTF-8 handling in vars_prompt 2015-07-30 23:27:39 +05:30
James Cammarata
549c204051 Submodule pointer update 2015-07-30 13:48:09 -04:00
Abhijit Menon-Sen
694d2103b1 Remove outdated FIXME code
This is already handled in PlayContext.set_options.
2015-07-30 23:12:06 +05:30
Abhijit Menon-Sen
ff2d160fff Correct invalid reference to global display 2015-07-30 22:52:47 +05:30
Abhijit Menon-Sen
10def3aa54 Uncomment encrypt handling for vars_prompt 2015-07-30 22:42:21 +05:30
Brian Coca
b2dc66c7ea now check stderr also on become for ssh plugin for the cases where sudo or su do not want to prompt/echo on stdin
fixes #11796
2015-07-30 13:11:41 -04:00
Brian Coca
17f659a143 added some debug to galaxy 2015-07-30 12:35:27 -04:00
Brian Coca
29bc8f51d7 made tags display closer to v1 2015-07-30 12:35:27 -04:00
Brian Coca
b37be236d9 Merge pull request #11475 from nibalizer/cfacter_support
Use cfacter instead of facter if possible
2015-07-29 22:46:21 -04:00
Abhijit Menon-Sen
3d581e5306 Don't stat None
Fixes #11794, regression introduced by #11010
2015-07-30 08:02:27 +05:30
Brian Coca
527ae360b0 Merge pull request #10652 from vodik/nspawn
Support querying systemd container information
2015-07-29 21:51:58 -04:00
Brian Coca
4b8e368039 Merge pull request #11010 from sillydong/devel
Add judgment to to fix path0 if ANSIBLE_CONFIG is set to a dir
2015-07-29 21:36:07 -04:00
Brian Coca
0e77871426 fixed non ignore errors path to actually interrupt
fixed cases where missing/inaccessible file gave exception, now you get nice error
2015-07-29 20:13:17 -04:00
Brian Coca
8153c34abf now returns false on bad role_data 2015-07-29 19:48:21 -04:00
Brian Coca
e81ec32719 made galaxy more resilient with bad yaml files and comments/spaces in non yaml files
fixes #10641
2015-07-29 19:28:29 -04:00
Joseph Callen
2f5ced8856 Moving VMware Utilites module
Moved `vmware.py` from v1 to `lib/ansible/module_utils/vmware.py`.

No other changes has been made since these two PRs:
https://github.com/ansible/ansible/pull/10812
https://github.com/ansible/ansible/pull/10760
2015-07-29 17:16:15 -04:00
Brian Coca
ced93d35ca adjusted list hosts across adhoc and playbook cli 2015-07-29 15:46:13 -04:00
James Cammarata
3a50c08c01 Merge branch 'pluggable_jinja_tests' of https://github.com/quixoten/ansible into quixoten-pluggable_jinja_tests 2015-07-29 15:16:27 -04:00
James Cammarata
782c2f75df Make sure role deps inherit conditionals/tags specified via params
Fixes #7353
2015-07-29 14:49:08 -04:00
Brian Coca
bedfe00de8 Merge pull request #11336 from saada/patch-1
Update Vault rekey() in vault.py to validate files passed before input
2015-07-29 12:52:14 -04:00
Toshio Kuratomi
4f1d365a25 Merge pull request #11783 from ansible/synchronize-fix
Synchronize in wasn't running on localhost in the default case which …
2015-07-29 09:33:01 -07:00
Toshio Kuratomi
088682f518 Synchronize in wasn't running on localhost in the default case which meant that rsync was run on the wrong host.
Fixes #11649
2015-07-29 09:10:24 -07:00
Mahmoud Saada
ddd46f6599 Update rekey() in vault.py to validate files passed exist before prompting for password 2015-07-29 09:03:15 -07:00
Brian Coca
0784fa1765 removed import q 2015-07-29 11:00:04 -04:00
Brian Coca
96bcf50a94 implemented requirements file in v2
fixes #11179
2015-07-29 10:59:33 -04:00
James Cammarata
71867f9480 Remove vars attribute from base
Fixes #11779
2015-07-29 09:45:30 -04:00
Scott Cunningham
695e456cb0 add credstash lookup plugin 2015-07-29 11:18:13 +01:00
Brian Coca
132c14eb57 indented hosts 2015-07-28 22:31:40 -04:00
Brian Coca
c0c094c413 now all --list options are working! 2015-07-28 22:30:59 -04:00
Brian Coca
884435a1aa minor cosmetic changes to list options 2015-07-28 22:14:41 -04:00
Brian Coca
056602c424 rearranged --list- options, now they are consolidated when used toghether, less loops, more concise output
list-hosts works
list-tasks works, but needs better task naming (missing role info)
list-tags only shows play tags
2015-07-28 22:05:49 -04:00
Brian Coca
cc85473c1e show role search path when not finding a role
fixes #9770
2015-07-28 19:07:47 -04:00
James Cammarata
42cfacf83b Switch up the task/host overrides for PlayContext to use the compiled vars dict
Fixes #11436
2015-07-28 16:25:44 -04:00
Brian Coca
a8b2b5b0c9 avoids printing blank diffs
fixes #10147 fixes #9471
2015-07-28 15:47:52 -04:00
James Cammarata
5cf2781528 A little more cleanup regarding _compute_environment_string 2015-07-28 15:34:10 -04:00
James Cammarata
467432bef5 Fix incorrect module path for AnsibleError in action plugin base 2015-07-28 15:25:25 -04:00
Brian Coca
f4a997db49 added back but stderr, which was the original itnention 2015-07-28 14:36:06 -04:00
Brian Coca
3b9282fb90 fixed dupe output in raw/command cases 2015-07-28 14:31:49 -04:00
Brian Coca
a78fdde32c better handling for weird doc corner cases (abscense of options, bad text objects, etc)
also updated extras to get some docfixes on the module side
2015-07-28 14:30:46 -04:00
Brian Coca
17103dd4cc update submodule refs 2015-07-28 13:08:05 -04:00
Brian Coca
6cdee94c33 added missing skipped item function to base 2015-07-28 11:02:25 -04:00
Brian Coca
6f93d228f6 made item output closer to v1 2015-07-28 10:59:39 -04:00
Brian Coca
4f9d719b14 removed debug 2015-07-28 10:43:11 -04:00
Brian Coca
d78c2fc212 now reports per task item 2015-07-28 10:41:40 -04:00
James Cammarata
2d90cbf78b Properly fail results with rc != 0
Fixes #11769
2015-07-28 10:15:14 -04:00
Brian Coca
787a0c4e04 fixed indent issues 2015-07-28 10:10:21 -04:00
Vilmos Nebehaj
58cccce384 Use PBKDF2HMAC() from cryptography for vault keys.
When stretching the key for vault files, use PBKDF2HMAC() from the
cryptography package instead of pycrypto. This will speed up the opening
of vault files by ~10x.

The problem is here in lib/ansible/utils/vault.py:

    hash_function = SHA256

    # make two keys and one iv
    pbkdf2_prf = lambda p, s: HMAC.new(p, s, hash_function).digest()

    derivedkey = PBKDF2(password, salt, dkLen=(2 * keylength) + ivlength,
                        count=10000, prf=pbkdf2_prf)

`PBKDF2()` calls a Python callback function (`pbkdf2_pr()`) 10000 times.
If one has several vault files, this will cause excessive start times
with `ansible` or `ansible-playbook` (we experience ~15 second startup
times).

Testing the original implementation in 1.9.2 with a vault file:

In [2]: %timeit v.decrypt(encrypted_data)
1 loops, best of 3: 265 ms per loop

Having a recent OpenSSL version and using the vault.py changes in this commit:

In [2]: %timeit v.decrypt(encrypted_data)
10 loops, best of 3: 23.2 ms per loop
2015-07-28 14:51:36 +02:00
Brian Coca
77fc3ce759 removed unused import 2015-07-28 08:28:52 -04:00
Lukas Pirl
d9aa14feea fixes remote code execution for su/sudo and strict remote umasks
* temporarily changes umask for creating temporary directories
    * otherwise parent directories may not get chmod'ed and end up
      unreadable
refs #9902
2015-07-28 19:24:23 +12:00
Brian Coca
80ecab5317 Merge pull request #11761 from amenonsen/9843-rebase
Add pciid to LinuxNetwork interface fact
2015-07-27 22:20:04 -04:00
Hugh Saunders
f344ec463f Add LVM facts to setup module
This commit adds LinuxHardware.get_device_facts() and calls that from
.populate().

LVM facts are only gathered if the setup module is running as root and
the lvm utilities are available (tested by searching for 'vgs').

If the conditions are met, facts are set for each volume group and
logical volume.

Example:

Test LVM Data:
$ sudo vgs
  VG   #PV #LV #SN Attr   VSize VFree
  test   1   2   0 wz--n- 5.00g 2.00g
$ sudo lvs
  LV      VG   Attr      LSize Pool Origin Data%  Move Log Copy%  Convert
  testlv  test -wi-a---- 1.00g
  testlv2 test -wi-a---- 2.00g

Facts Returned:
$ ansible localhost -i /tmp/inv -m setup -a 'filter=ansible_lvm'
localhost | success >> {
    "ansible_facts": {
        "ansible_lvm": {
            "lvs": {
                "testlv": {
                    "size_g": "1.00",
                    "vg": "test"
                },
                "testlv2": {
                    "size_g": "2.00",
                    "vg": "test"
                }
            },
            "vgs": {
                "test": {
                    "free_g": "2.00",
                    "num_lvs": "2",
                    "num_pvs": "1",
                    "size_g": "5.00"
                }
            }
        }
    },
    "changed": false
}

Test as non-root:
$ ansible localhost -i /tmp/inv-user -m setup -a 'filter=ansible_lvm'
localhost | success >> {
    "ansible_facts": {},
    "changed": false
}

Test without lvm utilities available
$ sudo mv /sbin/vgs{,.bk}
$ ansible localhost -i /tmp/inv -m setup -a 'filter=ansible_lvm'
localhost | success >> {
    "ansible_facts": {},
    "changed": false
}
2015-07-28 07:46:01 +05:30
Brian Coca
5f8db9cd4b changed verbose_override to the new _ansible_verbose_override to keep in line with previous changes
output now defaults back to having indent=4
2015-07-27 22:15:44 -04:00
Trapier Marshall
250620f2ab Add pciid to LinuxNetwork interface fact
This commit adds pciid to the LinuxNetwork fact object.

pciid is gathered if the symlink /sys/class/net/*/device exists.

Example [>>>> emphasis <<<<]:

$ readlink /sys/class/net/eth0/device
../../../0000:01:00.0

$ ansible localhost --ask-pass -i /tmp/hosts -m setup -a "filter=ansible_eth0"
SSH password:
localhost | success >> {
    "ansible_facts": {
        "ansible_eth0": {
            "active": false,
            "device": "eth0",
            "macaddress": "0c:d2:92:5d:6e:8e",
            "module": "alx",
            "mtu": 1500,
       >>>> "pciid": "0000:01:00.0", <<<<
            "promisc": true,
            "type": "ether"
        }
    },
    "changed": false
}
2015-07-28 07:30:03 +05:30
Brian Coca
8746e692c1 changed check to allow for powerpc
fixes #11528
2015-07-27 21:44:17 -04:00
Brian Coca
0c21196633 moved openvz inventory script to new home 2015-07-27 20:53:53 -04:00
Brian Coca
164092a835 optimized module docs 2015-07-27 20:52:53 -04:00
Brian Coca
2575e1540a Merge pull request #11740 from amenonsen/8602-rebase
Encrypt the vault file after editing only if the contents changed
2015-07-27 20:45:03 -04:00
Toshio Kuratomi
d2346fd2e2 Python2.4 compat fix 2015-07-27 15:34:51 -07:00
James Cammarata
d6cafff2f9 Additional changes to fix fileglob relative path lookups 2015-07-27 16:35:57 -04:00
Toshio Kuratomi
6a68be4e28 Handle quoting of values in dict parameters 2015-07-27 12:31:05 -07:00
James Cammarata
cb262449c7 Reworking internal result flags and making sure include_vars hides vault data
Fixes #10194
2015-07-27 14:04:31 -04:00
James Cammarata
eebf437d87 Submodule pointer update 2015-07-27 12:51:58 -04:00
Brian Coca
b2b19a1dc4 Merge pull request #11751 from amenonsen/playwithoutbook
A better error message for «ansible playbook.yml»
2015-07-27 12:42:56 -04:00
James Cammarata
49a6601856 Further cleanup of internal use of ansible_ssh_host 2015-07-27 10:42:39 -04:00
James Cammarata
ee835ff7ad Add a base-level get_basedir method for lookup plugins and fix relative lookups
Fixes #11746
2015-07-27 10:41:28 -04:00
Abhijit Menon-Sen
65d62090c2 A better error message for «ansible playbook.yml»
This is a very conservative change: we add the hint only if we're
definitely going to die already.
2015-07-27 12:43:21 +05:30
James Cammarata
3a4dd523d3 Fix bug where we calculated the relative path of recurisive copies wrong
Fixes #11470
2015-07-27 02:29:38 -04:00
James Cammarata
a1a8997e89 Merge pull request #11663 from whereismyjetpack/fix_ansible_ssh_host
only set ansible_ssh_host if not already set
2015-07-26 23:46:21 -04:00
Brian Coca
a56ff7ae54 now it really is oneline 2015-07-26 23:14:07 -04:00
Brian Coca
5d1d9f1505 fixed diff output to be as it was in 1.x, copy and template now use the same
functions to do difs.
2015-07-26 22:29:56 -04:00
James Cammarata
c56a304ad9 Merge pull request #9195 from reedloden/add-dns-facts
Add several DNS-related facts by parsing /etc/resolv.conf
2015-07-26 14:59:55 -04:00
James Cammarata
ccb7fb3b4c Submodule pointer update 2015-07-26 14:41:49 -04:00
James Cammarata
034c766439 Fixing logic in template.py to not assume 'changed' is in the result 2015-07-26 13:57:25 -04:00
James Cammarata
a78ed39f93 Merge pull request #11743 from renard/regex_escape-filter
Regex escape filter
2015-07-26 13:52:01 -04:00
James Cammarata
db4b3544d7 Fix syntax error in action plugin template.py 2015-07-26 13:49:27 -04:00
Reed Loden
eb1fb41576 Add several DNS-related facts by parsing /etc/resolv.conf
Facts include nameservers, domain, search path, sortlist, and options.
2015-07-26 10:46:59 -07:00
Sébastien Gross
36534668f0 Change name from re_escape to regex_escape to fit existing function names. 2015-07-26 19:03:56 +02:00
Sébastien Gross
c1e4085251 Add regular expression escaping filter. 2015-07-26 19:03:27 +02:00
Brian Coca
0b6fadaad7 started implementing diff
diff now works with template
also fixed check mode for template and copy
2015-07-26 12:22:22 -04:00
Pablo Figue
f8bf2ba1bd Encrypt the vault file after editing only if the contents changed 2015-07-26 14:41:34 +05:30
James Cammarata
73aa5686cc Remove octal escapes from unicode escape handling
Fixes #11673
2015-07-25 16:30:11 -04:00
Brian Coca
5be384bab0 Merge pull request #11733 from amenonsen/csvfile
v2 breakage: lookupfile should lookup the given file=xxx
2015-07-25 11:53:22 -04:00
Brian Coca
b19eb0f4dc minor improvements to display 2015-07-25 09:15:33 -04:00
Abhijit Menon-Sen
8737061a8f lookupfile should lookup the given file=xxx
(Earlier it used to lookup the pre-split term.)
2015-07-25 15:38:26 +05:30
James Cammarata
eca88d4253 Merge pull request #11732 from amenonsen/9212-rebase
Forbid copy: content="" with a directory destination
2015-07-25 02:47:19 -04:00
Mario de Frutos
4ed664f4d0 Forbid copy: content="" with a directory destination
Fixes #9107, closes PR #9212
2015-07-25 11:21:14 +05:30
Brian Coca
b9710b4a34 wrapped new system ssh key lookup in case file does not exist 2015-07-24 23:54:13 -04:00
Patrick Michaud
e4df8c3d36 Have paramiko use /etc/ssh_known_hosts
Fixes an issue with a confusing error: "paramiko: The authenticity of host '[host]' can't be established" when ssh on the command line doesn't complain

Closes PR #7730
2015-07-25 09:09:28 +05:30
Brian Coca
0858d97c44 also captures typeerrors for when not getting a proper string in output 2015-07-24 18:43:40 -04:00
Toshio Kuratomi
8ee3b7384d Guard the PROTOCOL setting so that we work on older pythons 2015-07-24 15:07:02 -07:00
Toshio Kuratomi
36382face9 Add a warning about mode being octal 2015-07-24 14:52:21 -07:00
James Cammarata
eccfb7e0b5 Adding initial support for includes in handlers
Fixes #11694
2015-07-24 16:22:02 -04:00
Brian Coca
7215470c6f implemented galaxy list in v2 2015-07-24 16:18:55 -04:00
Will Thames
9abd9a8f57 Make ansible-galaxy work with galaxy.ansible.com
Now works with role files that use Ansible Galaxy roles
Still work to do on making this work with internal roles
2015-07-24 16:04:10 -04:00
Brian Coca
cff77de917 added todo for future of feature 2015-07-24 12:00:38 -04:00
Brian Coca
0089eb8102 reimplemented logging based on log_path var 2015-07-24 12:00:38 -04:00
James Cammarata
ff49c5adac Make sure we're actually looping before looking at 'results' in TaskResult
Fixes #11696
2015-07-24 11:55:22 -04:00
James Cammarata
0fcd53e887 Make sure the command is sudoable before checking for the become password
Fixes #11714
2015-07-24 11:37:26 -04:00
James Cammarata
e526743b4f Allowing args: "{{some_var}}" for task params again
This is unsafe and we debated re-adding it to the v2/2.0 codebase,
however it is a common-enough feature that we will simply mark it
as deprecated for now and remove it at some point in the future.

Fixes #11718
2015-07-24 10:33:12 -04:00
Brian Coca
681eab1158 fix adhoc that broke with assuming step is always in options 2015-07-24 10:03:43 -04:00
Brian Coca
88e1ef8c9b implemented --step in v2 2015-07-23 20:47:40 -04:00
Brian Coca
3bf1edfd96 Merge pull request #11591 from defionscode/boto3
Connection function for boto3
2015-07-23 15:54:28 -04:00
James Cammarata
7bc789ba64 Properly template task names
Also fixes in the correct way the bug in which the role name was
incorrectly showing up twice in the task name.

Fixes #10347
2015-07-23 15:45:36 -04:00
James Cammarata
698479a623 Add config file info to --version output
Fixes #10348
2015-07-23 15:32:39 -04:00
James Cammarata
37ed756d66 Make sure role names are strings
Fixes #10497
2015-07-23 15:26:31 -04:00
Toshio Kuratomi
f8e4aff4c1 Cleanups:
* Don't reference __class__ when we can use the instance itself
* use isdisjoint() as it can stop once a match is found
* Remove a condtional that was taken care of in the conditonal just above
2015-07-23 12:13:45 -07:00
Brian Coca
4e3f5e3be6 Merge pull request #11708 from bcoca/display_me
adding display to plugins and start moving debug to display
2015-07-23 14:32:18 -04:00
Brian Coca
78df37db8a updated submodule refs 2015-07-23 13:44:47 -04:00
Brian Coca
a6ba149c49 implemented simplified output for adhoc adn command modules as in v1 2015-07-23 13:42:20 -04:00
James Cammarata
65ae9780fa Merge pull request #11079 from amegianeg/fix_broad_except_in_inventory
Avoid too broad except in Inventory
2015-07-23 13:36:02 -04:00
Toshio Kuratomi
e7733a7d3a Update submodule refs 2015-07-23 07:32:54 -07:00
Brian Coca
851ed45bbf adding display to plugins and start moving debug to display 2015-07-23 10:26:12 -04:00
Toshio Kuratomi
b06353791c Don't pass mode from synchronize action plugin to the ansible module
Fixes https://github.com/ansible/ansible-modules-core/issues/1783
2015-07-23 00:42:27 -07:00
Brian Coca
b678b9828c simplified and normalized lookup search path behaviour 2015-07-22 22:32:37 -04:00
James Cammarata
857f584ebf Merge pull request #11699 from ahamilton55/ah/delegate_variable
v2: Fixing delegate_to when using a variable
2015-07-22 22:15:54 -04:00
Brian Coca
b9050ecf18 fixed file lookup pathing in dwim functinos, now does specific paths and priorities and is commented
fixes #11672 as cwd is now not part of thos paths:
if full path is supplied, used that
2015-07-22 20:58:24 -04:00
Andrew Hamilton
7254b22bf4 Fixing delegate_to when using a variable 2015-07-22 17:12:00 -07:00
James Cammarata
d412bc72ef Fall back to paramiko if the smart detection fails to run ssh
Fixes #11695
2015-07-22 16:14:17 -04:00
James Cammarata
dfcf6a2016 Skip hosts with no state while iterating tasks in the linear strategy
Fixes #11693
2015-07-22 15:55:11 -04:00
James Cammarata
206ef27268 Add flag to template() so data is not converted to a datastructure
Fixes #11641
2015-07-22 15:05:51 -04:00
James Cammarata
7a9916422a Fixing up error handling for fetch_file ops in connection plugins
* enable batch mode (configurable with a config option, on by default)
  for sftp transfers, so we can catch errors more easily
* general cleanup in the local connection plugin and fetch action plugin

Fixes #11612
2015-07-22 14:25:47 -04:00
James Cammarata
4b6525fb58 Fix handler flushing to match how v1 worked
Also adds meta tasks to the list of tasks excluded from tag filtering

Fixes #11574
2015-07-22 11:21:38 -04:00
Toshio Kuratomi
d0dcf73716 Update module refs 2015-07-22 07:24:13 -07:00
James Cammarata
135404738e Fix a couple start-at-task issues
* added pattern matching to match v1 functionality
* check the task name, not the task+role name for matches
* make sure the input is unicode

Fixes #11692
2015-07-22 07:45:03 -04:00
James Cammarata
975172c1ef Make sure role name doesn't end up in task name more than once
Fixes #11691
2015-07-22 07:28:25 -04:00
James Cammarata
b09f1f8e0b Account for filters in bare variable conversion
Fixes #11530
2015-07-22 00:08:55 -04:00
Jeff Widman
52716c4dc7 Remove mention of 'apache example'
Removed explicit mention of 'apache'
2015-07-21 18:03:55 -07:00
ZviRackover
628925a77d Fix: add missing import 'locale' 2015-07-22 01:09:31 +03:00
James Cammarata
4c733fe4b7 Fix issues with vars_prompt and vars_files
* Prompt had to be moved up, as it needed to be done before the first
  templating of the play occurs, otherwise vars_files won't be templated
  properly
* Fixed a bug related to an earlier fix of vars_files incorporating
  extra vars to do the templating of the file name

Fixes #11404
2015-07-21 14:52:57 -04:00
Toshio Kuratomi
491a4f2a25 Update extras module pointer for docs fix 2015-07-21 11:21:58 -07:00
James Cammarata
adf1d4d9b9 Submodule pointer update 2015-07-21 14:03:27 -04:00
James Cammarata
66a8864ae9 Fix environment setting and inheritence
Fixes #11401
2015-07-21 13:57:30 -04:00
James Cammarata
91519d1696 Don't filter include tasks based on tags
Fixes #11320
2015-07-21 12:37:22 -04:00
James Cammarata
e64989beb4 Moving ConnectionInformation -> PlayContext
Also making PlayContext a child class of the Playbook Base class,
which gives it access to all of the FieldAttribute code to ensure
field values are correctly typed after post_validation

Fixes #11381
2015-07-21 12:13:50 -04:00
Brian Coca
827b0443c8 now dataloader checkis that you get at least a valid string as a file name 2015-07-21 08:47:13 -04:00
James Cammarata
7124504ccf Incorporate extra vars when templating vars_files
Fixes #11377
2015-07-21 02:10:26 -04:00
James Cammarata
b8b206005c Generalize extra variable parsing and loading
Fixes #11352
2015-07-21 00:18:35 -04:00
Dann Bohn
3e79bfa2d6 only set ansible_ssh_host if not already set 2015-07-20 15:43:55 -04:00
James Cammarata
3de6f264dd Fix bug where spaces in the $HOME directory broke things
Fixes #11332
2015-07-20 15:40:49 -04:00
James Cammarata
91a4b866b0 Fix ssh pipelining 2015-07-20 15:40:49 -04:00
Toshio Kuratomi
ddec06ccfe Detect the old python-json library
Fixes #11654
2015-07-20 12:35:26 -07:00
James Cammarata
5347db2952 Also check the play basedir for the role
Fixes #11328
2015-07-20 14:47:38 -04:00
James Cammarata
dca36c1d16 Reestablishing the use of tags/when for role duplication detection
Not figuring these in can cause problems with "diamond" pattern relationships,
even though this is still not quite optimal.
2015-07-20 14:37:20 -04:00
Toshio Kuratomi
a0a6d12b05 Merge pull request #11603 from ansible/get_url-tls-compat
Have openssl autonegotiate tls protocol on python < 2.7.9
2015-07-20 09:43:59 -07:00
Brian Coca
03d7c8d7ca fixed new HPUX networking facts 2015-07-20 10:27:04 -04:00
Brian Coca
80eb7a20ca Merge pull request #11469 from pilou-/local_variable
Fix pyflakes error: use 'msg' variable
2015-07-20 10:25:58 -04:00
Brian Coca
91f2acb029 Merge pull request #10203 from pdelared/devel
Add HP-UX network facts
2015-07-20 10:16:31 -04:00
Pierre-Louis Bonicoli
8c392a94b7 Play.get_name: remove prefix, return name only 2015-07-20 12:41:39 +02:00
Pierre-Louis Bonicoli
fda8fa77ab Fix pyflakes error: use 'msg' variable
Error was: local variable 'msg' is assigned to but never used
2015-07-20 12:41:39 +02:00
Brian Coca
a09ce4bd87 added callback that skipts 'skipped' 2015-07-19 23:55:39 -04:00
Brian Coca
171c95672e fixed gathering expression as it was triggering when gather_facts was no 2015-07-19 23:16:54 -04:00
Brian Coca
f66ba92745 now vault prompts for password if no password file was given, as in 1.x 2015-07-19 22:24:20 -04:00
Brian Coca
a8ba9cac3f fixed ansible pull bad options ref, removed print in favor of display 2015-07-19 18:28:03 -04:00
Brian Coca
f8905013cd now executes fact search when needed 2015-07-19 18:00:27 -04:00
James Cammarata
2c98b271c8 Make paramiko password detection logic match ssh connection 2015-07-19 02:23:53 -04:00
James Cammarata
3d77723e3d Cleaning up some stuff related to the connection info/become/executable change 2015-07-19 01:12:23 -04:00
James Cammarata
1c185b68be Rearranging some become stuff in relation to action/connection plugins
Moving the make_sudo_cmd() calls back up to the action level so that connection
plugins don't have to know about it at all, and moving some of the become data
(prompt and success_key) into the ConnectionInformation object so they don't
need to be passed around needlessly.
2015-07-19 01:12:23 -04:00
James Cammarata
7a9b5b6fe8 Remove unnecessary make_become_cmd from paramiko exec_command
Fixes #11611
2015-07-19 00:08:09 -04:00
Brian Coca
9dc5607730 Merge pull request #11519 from bcoca/human_readable
new human_readable filter to transform bits and bytes into cake
2015-07-18 23:10:53 -04:00
Brian Coca
115dce028d Merge pull request #11604 from bcoca/faf_deprecated_fixes
fixed first_available_found for template
2015-07-18 23:09:47 -04:00
Brian Coca
4f98fac494 Merge pull request #10914 from bcoca/non_posix_file_copy_fix
hack to prevent tempalte/copy errors on vagrant synced folders
2015-07-18 23:08:08 -04:00
Indrajit Raychaudhuri
4553a41ab5 Add homebrew to package managers' list 2015-07-18 19:46:26 -05:00
James Cammarata
271a7f3281 Cleaning up some of the notify/facts logic added earlier to fix problems 2015-07-17 14:44:19 -04:00
Brian Coca
1aa4155266 generalized warning handling, added it to adhoc also 2015-07-17 14:14:15 -04:00
James Cammarata
d4ac73a1bc Adding back capability to display warnings contained in results
Fixes #11255
2015-07-17 13:44:22 -04:00
James Cammarata
5abdd3b821 Handle notifications when coupled with a loop
Fixes #11606
2015-07-17 12:03:04 -04:00
Serge van Ginderachter
8d1549900c fix AnsibleError object name in subelements plugin
fixes #11624
2015-07-17 17:39:31 +02:00
Brian Coca
bc5a7fce79 Merge pull request #11616 from halberom/ssh_port
fixes 11607, override ansible_ssh_port in group/host_vars
2015-07-17 11:21:17 -04:00
Gerard Lynch
a6c8d30f3e callbacks require a version constant or the v2 code doesn't pass the display param and it gives an error 2015-07-17 15:33:48 +01:00
Brian Coca
6ba706f753 minor doc reformatting
now version_added < 1.3 does not get shown, up from 1.0
option's version_added is also now filterd against this threshold
module version_added is more prominent
exaples now uses pure rst instead of intermingled with html formatting
aliases now shown in description for options
bad version fields now throw warnings instead of exceptions
ansible-doc errors now show traceback in very very verbose mode, for easier debugging
2015-07-17 10:07:22 -04:00
Brian Coca
da890f9328 Merge pull request #11622 from amenonsen/gathering
devel breaks «gathering=explicit» setting in ansible.cfg
2015-07-17 09:04:23 -04:00
Brian Coca
a09f6236a5 adapated to v2 2015-07-17 08:55:22 -04:00
Brian Coca
10e5c2b46d fixed var scope 2015-07-17 08:54:28 -04:00
Tom Paine
097ed1f17b Add plugin that profiles playbook tasks
Resubmission of https://github.com/ansible/ansible/pull/11270 to
correct v2 file location.

[Description and console output
demonstration](https://github.com/aioue/ansible-plugin-profile/blob/mast
er/README.md#features).

Provides per-task timing, ongoing playbook elapsed time and ordered
list of top 20 longest running tasks at end.
2015-07-17 13:04:31 +01:00
Abhijit Menon-Sen
28e2eae902 Make gathering=explicit work again
There was a confusion between the valid values for defaults.gathering
(explicit/implicit/smart) and a play's gather_facts setting (boolean),
which resulted in gathering=explicit being ignored.
2015-07-17 13:05:00 +05:30
Gerard Lynch
d23ab261e1 fixes 11607, allows ansible_ssh_port to be overridden from group or host_vars 2015-07-16 23:00:17 +01:00
Brian Coca
978390693b changed to default 'auto' as it better describes the use= option 2015-07-16 16:45:04 -04:00
James Cammarata
94fa741f96 Make sure files loaded by template action are decoded properly
Fixes #11247
2015-07-16 15:23:40 -04:00
Brian Coca
5ba9fe4748 now supports maintainers and author field for display as MAINTAINERS 2015-07-16 15:18:33 -04:00
Brian Coca
c603caca27 removed extra print now that items are getting passed to callback in result 2015-07-16 15:13:35 -04:00
James Cammarata
86a83c16b8 Remove some dead code from the base load_data method
Was causing an odd error which threw off the error detection code
when the datastructure was a string corresponding to a variable.
2015-07-16 15:10:41 -04:00
James Cammarata
d977dd507c Merge pull request #11609 from ofpiyush/devel
Fix #11369 A result is skipped when all it's children are skipped. Th…
2015-07-16 11:45:04 -04:00
James Cammarata
052f3c2ece Fixing allow_duplicate and variable resolution bugs
Fixes #11205
2015-07-16 11:39:40 -04:00
Piyush
f2bdd9af29 Fix #11369 A result is skipped when all it's children are skipped. This makes it fundamentally different from a result that was changed/failed/unreachable 2015-07-16 17:50:15 +05:30
Brian Coca
5a5b7ff561 fixed first_available_found for template, refactored into common function
added deprecation warning
fixed display.deprecated to make version optional (code already assumed this)
turned warning + 'deprecated' in plugin loader into actual call to deprecated()
2015-07-15 19:47:59 -04:00
Jonathan Davila
6ea772931f Connection function for boto3
Boto3 conn
2015-07-15 16:52:01 -04:00
Toshio Kuratomi
3d3e1c82a2 Have openssl autonegotiate tls protocol on python < 2.7.9
This allows usage of tls-1.1 and tls-1.2 if the underlying openssl
library supports it.  Unfortunately it also allows sslv2 and sslv3 if
the server is only configured to support those.  In this day and age,
that's probably something that the server administrator should fix
anyhow.
2015-07-15 13:17:00 -07:00
James Cammarata
ba7243c5f9 Don't set changed for include tasks
Fixes #11197
2015-07-15 15:11:46 -04:00
James Cammarata
291f07242c Properly return Jinja2 Undefined class for bad hostvars lookups
Fixes #11176
2015-07-15 14:36:42 -04:00
James Cammarata
9fe0f21f6a Allow omit to be used on Playbook-level fields
Fixes #11173
2015-07-15 13:53:59 -04:00
James Cammarata
165fff8a1e Fixing module arg parsing splitting when action is a variable
Fixes #11122
2015-07-15 12:03:02 -04:00
Brian Coca
b76cb8f655 now that invocation is only async again, no need to sanitize 2015-07-15 10:40:37 -04:00
James Cammarata
2d870b7112 Fix logic where invocation details are added to results 2015-07-15 10:20:55 -04:00
James Cammarata
0b035a4e35 Unicode in result debug statements caused a traceback 2015-07-15 01:56:28 -04:00
Brian Coca
ae6d9ebf28 added maintainers (from author field) to ansible-doc 2015-07-14 17:33:27 -04:00
Brian Coca
fbec8bfb90 updated ref to add docfixes 2015-07-14 17:03:57 -04:00
Brian Coca
0e1d771a33 updated submodule refs 2015-07-14 16:47:47 -04:00
Toshio Kuratomi
3e293f524a Merge pull request #11589 from ansible/get_url-sni-tls-fix
Add support for SNI and TLS-1.1 and TLS-1.2 to the fetch_url() helper
2015-07-14 12:49:37 -07:00
Toshio Kuratomi
327b1676a8 Add support for SNI and TLS-1.1 and TLS-1.2 to the fetch_url() helper
Fixes #1716
Fixes #1695
2015-07-14 12:48:35 -07:00
James Cammarata
8d887d8dd3 Adding back --start-at-task feature
Also implemented framework for --step, though it's not used yet
2015-07-14 15:02:20 -04:00
Brian Coca
3c7faa8378 fixed missing self in self.action on rekey in vault
fixes #11584
2015-07-14 10:10:03 -04:00
Brian Coca
42e355f9a3 fragments can now be a list 2015-07-14 10:07:59 -04:00
Brian Coca
ea159ef9de fixed backup and validate fragments 2015-07-14 10:07:59 -04:00
James Cammarata
4e94bb64d8 Fix group/host var loading relative to playbook basedir 2015-07-14 09:26:24 -04:00
James Cammarata
7dd5600839 Allow empty include files again
Fixes #11582
2015-07-14 08:26:11 -04:00
Brian Coca
8793308c39 made md5 into generic checksum function that uses sha now 2015-07-14 07:28:32 -04:00
James Cammarata
6971e92f39 Fixing up some output stuff 2015-07-14 00:23:17 -04:00
James Cammarata
9a586c3512 Properly catch AnsibleError and not all errors 2015-07-13 20:49:11 -04:00
Brian Coca
2b723c6130 added missing re import 2015-07-13 20:42:09 -04:00
Brian Coca
3102469b94 fixing become success string 2015-07-13 20:40:40 -04:00
Brian Coca
a09f44210e now callback errors are not silent but warnings 2015-07-13 19:23:27 -04:00
Brian Coca
e0632cb9a4 Merge pull request #11577 from srvg/yaml_file_extensions
Use YAML_FILENAME_EXTENSIONS for vars files.
2015-07-13 18:29:26 -04:00
Brian Coca
5daa540bc0 Merge pull request #11576 from srvg/combine_empty_vars_file
Do not combine group_vars with an empty file
2015-07-13 18:26:02 -04:00
Serge van Ginderachter
d5fb11d89c Use YAML_FILENAME_EXTENSIONS for vars files.
The v2 codebase didn't use this previously introduced constant yet.

C.YAML_FILENAME_EXTENSIONS
2015-07-14 00:23:35 +02:00
Serge van Ginderachter
9c8f0da327 Do not combine group_vars with an empty file
This addresses a specific case with multiple vars files
in a group_vars/${groupname}/ directory where one of those files
is empty, which returns None instead of an empty dict.
2015-07-14 00:14:13 +02:00
Brian Coca
24b830bbc8 fixed executable for raw module 2015-07-13 16:23:14 -04:00
Brian Coca
c4b6d91275 added skipped to oneline 2015-07-13 15:54:12 -04:00
Brian Coca
8ad52c2e4f readded oneline output feature to adhoc
fixes #11573
2015-07-13 15:43:31 -04:00
Brian Coca
3a768b3b9f removed unused methods, these now live in base class 2015-07-13 15:43:31 -04:00
James Cammarata
c18fdd0c18 Re-implement "conditional imports" for vars_files 2015-07-13 15:18:23 -04:00
James Cammarata
d977da5b41 Fixing up fact_cache use in VariableManager 2015-07-13 11:06:03 -04:00
James Cammarata
932d1e57f7 Removing stray debugging print 2015-07-13 10:56:09 -04:00
James Cammarata
91c9bb96e3 Moving jsonfile cache plugin over and fixing #10883
Fixes #10883
2015-07-13 10:42:10 -04:00
Brian Coca
d8abae71a4 now assemble skips during checkmode
TODO: actually make it check with checkmode
fixes http://github.com/ansible/ansible-modules-core/issues/661
2015-07-13 10:34:44 -04:00
Alejandro Guirao
587a6cb44c Remove v1 code 2015-07-13 15:48:23 +02:00
Alejandro Guirao
6e99023c84 Changed to support Ansible v2 2015-07-13 15:37:27 +02:00
Alejandro Guirao
8efc42d993 Add shelvefile lookup plugin 2015-07-13 10:31:35 +02:00
James Cammarata
f40b66d841 Make sure the basedir is unicode
Fixes #10773
2015-07-12 16:40:00 -04:00
Brian Coca
ba92965670 fix for when invocation data is missing 2015-07-12 16:10:52 -04:00
James Cammarata
c5c1dc2f11 Removing tags/when from role param hash calculation 2015-07-11 21:49:35 -04:00
Brian Coca
4203b699a8 removed dict comprehension as 2.6 does not like 2015-07-11 15:15:46 -04:00
Brian Coca
032690a843 fix read_vault_password_file ref 2015-07-11 15:05:32 -04:00
Brian Coca
d993e7000c added cyan back to ignoring message 2015-07-11 15:01:50 -04:00
Brian Coca
064a34689a now actually continues play on ignore errors 2015-07-11 14:53:23 -04:00
Brian Coca
fe91f7b506 moved read_vault_file to CLI from utils and renamed to clearer read_vault_password_file 2015-07-11 14:24:45 -04:00
Brian Coca
e4097ed279 simplified ansible errors, moved md5 hash import with notes to be more prominent 2015-07-11 14:24:00 -04:00
Brian Coca
1274ce565d added result sanitation to registered var and to callbacks
removed time display as it only is provided by command module
2015-07-11 01:05:29 -04:00
Brian Coca
fdea00880b now default shows time taken when -vv or above 2015-07-11 00:02:40 -04:00
Brian Coca
7a1bce1b5d added verbose option to show callback loaded info
also made mail module print nicer without all those 'u'
2015-07-10 23:48:12 -04:00
Brian Coca
4b9a79d42b removed trailing newline
fix from #10973 by @retr0h
2015-07-10 22:12:46 -04:00
teh 4r9h
705018a417 Misspell in mail.py callback.
Looks like little misspell.
2015-07-11 02:53:32 +02:00
Brian Coca
e9a3a2912d Merge pull request #9281 from woltage/devel
Enables 'force basic auth' -feature globally
2015-07-10 18:20:52 -04:00
James Cammarata
4608897c27 Submodule update 2015-07-10 13:55:44 -04:00
Carlos E. Garcia
657495d13f minor spelling changes 2015-07-10 12:42:59 -04:00
Brian Coca
aaad33ccb6 fixed a couple of bugs 2015-07-10 10:30:33 -04:00
Brian Coca
d0c6d2ff1c poreted log_plays, syslog_json and osx_say callbacks to v2
renamed plugins to contrib (they are not really plugins)
rewrote README.md to reflect new usage
added new dir to setup.py so it gets copied with installation, in views
of making using inventory scripts easier in teh future
2015-07-10 10:30:33 -04:00
Brian Coca
50d54b1be7 ported hipchat callback to v2 (needs testing) 2015-07-10 10:30:33 -04:00
Brian Coca
e92e15b5f6 moved unused functions to base object 2015-07-10 10:30:33 -04:00
Brian Coca
b47d7babe5 removed warning i was using for debug 2015-07-10 10:30:33 -04:00
Brian Coca
834b7a2857 ported context_demo to v2 callbacks 2015-07-10 10:30:33 -04:00
Brian Coca
ba0e5323d6 removed connection info to _verbosity, just needed callbacks to call correct display.verbosity
added v2 methods and made them call v1 when possible by tranforming the data
2015-07-10 10:30:33 -04:00
Brian Coca
a918a1bd16 now calls correct v2_on_any callback method 2015-07-10 10:30:33 -04:00
Brian Coca
f9d817e636 now looks at correct verbosity and removes the need to set a copy of it in _verbosity 2015-07-10 10:30:33 -04:00
James Cammarata
cf2a66ef30 Add ansible_version magic variable
Fixes #11545
2015-07-10 03:22:37 -04:00
James Cammarata
b0e6baf8c3 Fix bug where options may not have the force_handlers value from the cli 2015-07-10 03:19:48 -04:00
James Cammarata
f8ddf2eb04 Move role cache into the play to avoid roles crossing play boundaries 2015-07-10 02:43:53 -04:00
James Cammarata
b520d5bc60 Lots of fixes for integration test bugs 2015-07-10 01:53:59 -04:00
Iiro Uusitalo
4e7542af37 Merge upstream changes 2015-07-10 08:44:20 +03:00
Iiro Uusitalo
403f4881ee Enables 'basic auth force' -feature globally 2015-07-09 23:11:52 +03:00
James Cammarata
a9712bb0fb Fixing some delegate_to bugs
* Moving connection creation until after the task is post_validated,
  to make sure all fields are properly templated (#11230)
* Fixing problems related to the connection method and remote address
  lookup on the delegated-to host

Fixes #11230
2015-07-09 08:25:08 -04:00
Brian Coca
3ba67dd2d0 added ignore_hidden to assemble 2015-07-09 00:27:29 -04:00
Brian Coca
b5f3e84014 now allows for empty vars sections, returns empty dict
fixes #11532
2015-07-08 22:45:01 -04:00
Brian Coca
55366bdc6d ported mail callback plugin to work with v2 2015-07-08 16:33:51 -04:00
Brian Coca
897e098b27 minor fixes to constants 2015-07-08 16:33:51 -04:00
Toshio Kuratomi
dd058a1dc2 Fix required_if (needed to pass list to _count_terms) 2015-07-08 09:45:02 -07:00
James Cammarata
27fcf1a4b5 Fix bug in registered variables related to delegate_to changes 2015-07-08 12:38:24 -04:00
James Cammarata
64a1b1e043 Fix first_available_file: support for copy and template actions 2015-07-08 12:23:42 -04:00
Toshio Kuratomi
ddac6fa9f3 Update exception handling to be python3 compat 2015-07-08 08:59:42 -07:00
James Cammarata
8f0496d7ce Fix usage of set_host_var when registering a result var
Fixes #11521
2015-07-08 09:15:55 -04:00
James Cammarata
2e5dfd57cc Clear flag indicating role had run before each play is run
Fixes #11514
2015-07-07 21:47:48 -04:00
Brian Coca
a02555ad91 Merge pull request #11483 from pilou-/jinja2_header_overrides
implement jinja2 header overrides
2015-07-07 18:02:00 -04:00
James Cammarata
f67949e42c Readd logic for ansible_managed to template action plugin
Fixes #11317
2015-07-07 16:48:19 -04:00
James Cammarata
da307c8bfd Fix bug in logic introduced in 614c626 2015-07-07 16:09:36 -04:00
James Cammarata
293dd38d05 Correctly handle assigning results to the delegated to host 2015-07-07 16:09:36 -04:00
Brian Coca
688088547b new human_readable filter to transform bits and bytes into cake (not really) 2015-07-07 15:58:18 -04:00
Toshio Kuratomi
49a148056c Ensure that we're dealing with byte str when we print or log messages 2015-07-07 12:05:59 -07:00
James Cammarata
614c626ed0 Fix no hosts remaining logic in linear strategy 2015-07-07 14:20:07 -04:00
Toshio Kuratomi
135fa41e3a Update submodules refs 2015-07-07 10:54:36 -07:00
Marc Abramowitz
314bae2a9e Don't wrap text for AnsibleParserError
This allows not messing up the wonderful error reporting that is
carefully created. Instead of:

    $ ansible-playbook foo.yml
     [ERROR]: ERROR! 'foo' is not a valid attribute for a Task  The error appears
    to have been in '/Users/marca/dev/git-repos/ansible/foo.yml': line 4, column 7,
    but may be elsewhere in the file depending on the exact syntax problem.  The
    offending line appears to be:    tasks:     - name: do something       ^ here

we get:

    $ ansible-playbook foo.yml
    ERROR! 'foo' is not a valid attribute for a Task

    The error appears to have been in '/Users/marca/dev/git-repos/ansible/foo.yml': line 4, column 7, but may
    be elsewhere in the file depending on the exact syntax problem.

    The offending line appears to be:

      tasks:
        - name: do something
          ^ here

which is much nicer.
2015-07-07 09:31:00 -07:00
Brian Coca
50efeb13ba made squashable with_ plugin list configurable
partially deals with #11383
2015-07-07 11:59:20 -04:00
Brian Coca
a6aedbcc51 now correctly picks up old become password host vars 2015-07-06 23:24:00 -04:00
Toshio Kuratomi
49e17b8ff6 Get rid of an unused import so that we don't have circular imports 2015-07-06 14:19:13 -07:00
Toshio Kuratomi
5b0b1f8da6 unquote strings in the ansible config file 2015-07-06 14:12:10 -07:00
Toshio Kuratomi
f44f9569e1 Test unquote works as expected and fix two bugs:
* escaped end quote
* a single quote character
2015-07-06 13:16:42 -07:00
James Cammarata
1d8ccfb99f Fixing includes where the included file is "{{item}}" 2015-07-06 14:30:56 -04:00
James Cammarata
46b33152c8 Check for ansible_su*_pass as well as _password
Fixes #11500
2015-07-06 13:49:25 -04:00
Toshio Kuratomi
378c8fd549 Update submodule refs 2015-07-06 10:44:27 -07:00
Brian Coca
2c9d1257ba put type checking before looking against choices array to always get type comparrison correctly 2015-07-05 19:55:11 -04:00
Brian Coca
22a0aa016f pbrun not forced to use local daemon anymore 2015-07-05 15:51:12 -04:00
Brian Coca
2a0cc38922 Merge pull request #11494 from jonhadfield/add_iso8601_basic_datetime
Add facts for datetime 8601 basic and basic short.
2015-07-05 14:55:20 -04:00
Brian Coca
05be30168d return empty string when config file is not used 2015-07-05 12:51:05 -04:00
Jon Hadfield
82e00b1022 add facts for datetime 8601 basic and basic short. 2015-07-05 17:23:22 +01:00
Brian Coca
51efd765be Merge pull request #11415 from msabramo/remove_unnecessary_imports
Remove unnecessary imports
2015-07-05 01:09:28 -04:00
James Cammarata
9155af20e3 Make sure vars in debug tasks aren't templated too early
If the syntax var={{something}} is used, that can be templated too
early in the post_validation, leading the debug module to fail when it
tries to template the same value in turn.
2015-07-05 01:06:54 -04:00
James Cammarata
38cc54b717 Make 'vars' a copy to prevent recursion issues 2015-07-04 23:34:07 -04:00
James Cammarata
bddadc9565 Fix bug in relative path determination 2015-07-04 23:18:54 -04:00
James Cammarata
38c5da9d2a Revert "Backing out vars magic variable due to failed tests"
This reverts commit 388e46a485.
2015-07-04 22:48:20 -04:00
James Cammarata
388e46a485 Backing out vars magic variable due to failed tests 2015-07-04 22:44:45 -04:00
James Cammarata
76c5be3a31 Add 'vars' to magic variables 2015-07-04 21:28:28 -04:00
Marc Abramowitz
0676157897 Remove unnecessary imports 2015-07-04 17:41:36 -07:00
Brian Coca
552715f072 added validate and backup doc fragments 2015-07-04 17:58:23 -04:00
Spencer Krum
3887173c2c Use cfacter instead of facter if possible
CFacter is the facter replacement written in C++. It is available from
the puppetlabs repo.
2015-07-04 09:13:20 -07:00
Brian Coca
5f791329ce now verbose mode shows config file used 2015-07-04 10:23:49 -04:00
James Cammarata
67671e328a Fix callback loading issue a slightly different way 2015-07-04 00:07:17 -04:00
James Cammarata
a51c165157 Revert "load callbacks on init again as they did not seem to load with new call from executor"
This reverts commit cf4ed9a556.
2015-07-03 23:52:59 -04:00
James Cammarata
2ddd83360a Revert "removed 2nd load_callbacks that was causeing dupe output"
This reverts commit de98dc2968.
2015-07-03 23:52:49 -04:00
Brian Coca
4d35d8bd31 properly booleanify copy field 2015-07-03 18:59:49 -04:00
Pierre-Louis Bonicoli
720e184f88 implement jinja2 header overrides 2015-07-03 22:27:49 +02:00
Brian Coca
de98dc2968 removed 2nd load_callbacks that was causeing dupe output 2015-07-03 14:28:10 -04:00
Brian Coca
bdccfa71a8 Merge pull request #11482 from verm666/issue-1627
facts: add aliases to ansible_all_ipv4_addresses on OpenBSD
2015-07-03 13:57:10 -04:00
Brian Coca
5122455db8 ported missing sequence updates from 1.9 2015-07-03 13:54:51 -04:00
Brian Coca
cf4ed9a556 load callbacks on init again as they did not seem to load with new call from executor 2015-07-03 13:01:21 -04:00
Brian Coca
9e37402cb7 added ramfs to selinux ignored filesystems
as reported in #11442
2015-07-02 17:25:05 -04:00
James Cammarata
31239f44cd Show failed result on a retry message
Fixes #10099
2015-07-02 10:33:41 -04:00
verm666
d91947ee96 facts: add aliases to ansible_all_ipv4_addresses on OpenBSD 2015-07-02 15:36:56 +03:00
James Cammarata
08ad05c83b Make sure callbacks are loaded in the tqm a bit earlier
Fixes #11463
2015-07-02 02:51:24 -04:00
Brian Coca
1b74102ab3 Merge pull request #11435 from hfinucane/ipwrap-generator
Treat generators like lists and tuples
2015-07-01 18:34:44 -04:00
Toshio Kuratomi
71f72b655e Merge pull request #11432 from sivel/splitext-filter
Add splitext filter
2015-07-01 13:17:56 -07:00
James Cammarata
9341148f04 Throw an error if with_first_found finds no files by default
Fixes #9976
2015-07-01 16:09:34 -04:00
Toshio Kuratomi
b11e69f3d0 Merge pull request #11452 from soarpenguin/devel
fix type error.
2015-07-01 12:41:05 -07:00
Brian Coca
13ac0ba1fe now setuptools will pull the data dir with templates that are used by galaxy init 2015-07-01 11:12:10 -04:00
Brian Coca
08e981b9f4 corrected api permissions 2015-07-01 11:12:10 -04:00
James Cammarata
cf51d0a790 Fixing up some check-mode stuff 2015-07-01 15:10:25 -04:00
James Cammarata
ad53b6f36a Merge pull request #11461 from pilou-/shell_removed
Fix "AttributeError: 'ActionModule' object has no attribute '_shell'"
2015-07-01 14:35:27 -04:00
James Cammarata
7fa37870c8 Merge pull request #9683 from justinwyer/logical-block-size-and-sectors-9549
Disk size for advanced drives over 2 TB is incorrect
2015-07-01 14:14:04 -04:00
James Cammarata
dcb9b5a69f Make --module-path work and expand tilde's in paths
Fixes #9937
Fixes #9949
2015-07-01 12:39:39 -04:00
Toshio Kuratomi
fffb65d45f Update submodule refs 2015-07-01 09:34:17 -07:00
James Cammarata
2e386deeae Make undefined variables in debug var=foo more obvious
Fixes #9935
2015-07-01 11:55:00 -04:00
James Cammarata
b6c52ce115 Allow role variables to be optionally kept in a private scope 2015-07-01 11:33:14 -04:00
Pierre-Louis Bonicoli
4d4512940d Fix "AttributeError: 'ActionModule' object has no attribute '_shell'"
'_shell' was removed with commit 2a5fbd8570
2015-07-01 17:22:09 +02:00
Brian Coca
dcb06ac7a8 Merge pull request #11445 from emonty/devel
Fix a tiny typo
2015-07-01 09:34:32 -04:00
Brian Coca
0a2a9557b8 now allows for users to use ^D to not input a password
fixes #11413
2015-07-01 05:22:49 -04:00
Benno Joy
4889d04fc6 fixes 11448 , yum with with_items 2015-07-01 10:02:54 +05:30
soarpenguin
c6ed1ff4ad fix type error. 2015-07-01 12:16:01 +08:00
James Cammarata
7c1d569a26 Make sure tags are pulled out of playbook includes properly
Fixes #9862
2015-06-30 16:09:04 -04:00
Toshio Kuratomi
54e7c8a3f7 Add python requirement to the documentation for openstack modules requiring shade 2015-06-30 12:51:20 -07:00
Monty Taylor
e89f1186e7 Fix a tiny typo 2015-06-30 14:46:43 -04:00
James Cammarata
ec4d1b11df Fix some more handler issues
* Only notify handlers when the task is changed
* Don't run handlers on hosts which have failed
2015-06-30 14:44:41 -04:00
James Cammarata
2576f480fd Restoring a state check to play_iterator, which otherwise broke block functionality 2015-06-30 13:57:47 -04:00
Matt Martz
65fdcf8b9d Check for name or pkg when templating squashed items. Fixes #11430 2015-06-30 10:15:25 -05:00
James Cammarata
0cfebb8760 Fixes a bug whereby tags are expected to be a set
Fixes #11424
Fixes #11429
2015-06-30 07:18:41 -04:00
Brian Coca
d149ea5222 ported timer.py callback to v2 2015-06-29 20:45:50 -04:00
Brian Coca
7416e00541 fixed condition for loading whitelisted callbacks 2015-06-29 20:45:50 -04:00
James Cammarata
9785e5397e Fix typo in SharedObjectLoader field basedirs 2015-06-29 22:51:53 -04:00
James Cammarata
927072546b Fixing up some issues with plugin loading 2015-06-29 22:49:25 -04:00
James Cammarata
2a5fbd8570 Winrm fixes for devel
* Include fixes for winrm connection plugin from v1 code
* Fixing shell plugin use
2015-06-29 22:49:25 -04:00
Henry Finucane
2d1cb7f328 Treat generators like lists and tuples 2015-06-29 14:55:11 -07:00
Toshio Kuratomi
8a76371a1c Merge pull request #11394 from dlundquist/ipaddr-slaac-filter
IPv6 SLAAC address computation filter
2015-06-29 14:23:50 -07:00
Matt Martz
4059904a18 Add splitext filter 2015-06-29 15:39:57 -05:00
Toshio Kuratomi
be6db1a730 Refactor the argspec type checking and add path as a type 2015-06-29 08:05:58 -07:00
James Cammarata
21c14363fd Allow callback plugins to be whitelisted 2015-06-29 10:56:28 -04:00
James Cammarata
24226646fc When loading the play hosts list, enforce some consistency
Fixes #9580
2015-06-28 01:00:32 -04:00
James Cammarata
9d9cd0c42c Handle getting the ds for Conditionals which may not be mixed in 2015-06-28 00:30:27 -04:00
James Cammarata
f433e709f2 Fix templating of hostvars values
Also adds play information into the hostvars creation, to assure the
variable manager used there has access to vars and vars_files

Fixes #9501
Fixes #8213
Fixes #7844
2015-06-27 21:04:16 -04:00
James Cammarata
8ef28253e3 Properly catch and report conditional test failures 2015-06-27 15:37:10 -04:00
James Cammarata
0eb1c880dd Use itertools instead of set for tags, as the data may not hash well
The tags field may contain bad data before it is post_validated, however
some methods assumed it would be a simple list or string. Using itertools
gets us around the problem of the data potentially not being hashable

Fixes #9380
2015-06-27 15:19:44 -04:00
Brian Coca
af49944ab2 Merge pull request #11398 from resmo/for-ansible
cloudstack: fixes and updates
2015-06-27 13:28:37 -04:00
James Cammarata
bb8d87ceb6 Allow field attributes which are lists to validate the type of the list items
Starting to apply this for tags too, however it is not correcting things
as would be expected.
2015-06-27 01:01:51 -04:00
James Cammarata
f68223b9ed Don't add module args into variables at all
Getting recursive errors otherwise, so this is probably not something
we want to do. This most likely only worked in v1 due to the fact that
module args were templated earlier than the point in Runner() when
they were fed into the templating engine.
2015-06-27 01:01:51 -04:00
Brian Coca
e153f76c95 now validate that we do get a vault password 2015-06-27 00:02:24 -04:00
Uli Martens
25fc0c7e1b Fixing bug in failed_when results introduced by c3c398c 2015-06-26 16:55:06 -04:00
James Cammarata
b723f9a09a Allow squashed loop items to use name=foo-{{item}}
Fixes #9235
Fixes #11184
2015-06-26 13:56:45 -04:00
Rene Moser
7952723530 cloudstack: fix domain name is not unique, use full path 2015-06-26 09:25:26 +02:00
Rene Moser
b9b1e294d7 cloudstack: add get_or_failback() 2015-06-26 09:25:26 +02:00
Dustin Lundquist
cf7744f2f1 IPv6 SLAAC address computation filter
Jinja2 filter to compute SLAAC address.

Usage:
    {{ '2db8::/64' | slaac(ansible_eth0.macaddress) }}
2015-06-25 13:20:21 -07:00
Toshio Kuratomi
9911a947ed Vendorize match_hostname code so that ansible can push it out to clients along with the code that uses it. 2015-06-25 08:17:58 -07:00
Toshio Kuratomi
00aed57295 Update submodule refs 2015-06-25 07:13:46 -07:00
Toshio Kuratomi
160e71e2cf Some flake8 cleanup 2015-06-25 07:13:37 -07:00
James Cammarata
332ca927d9 Fix parent attribute lookup
Using 'value is None' instead of 'not value', in order to account
for boolean values which may be false

Fixes #11232
2015-06-24 20:57:53 -04:00
James Cammarata
256a323de5 Submodule update 2015-06-24 15:03:34 -04:00
Toshio Kuratomi
548a7288a9 Use BUFSIZE when putting file as well as fetching file. 2015-06-24 01:00:22 -07:00
Toshio Kuratomi
270be6a6f5 Fix exec_command to not use a shell 2015-06-23 22:27:45 -07:00
Toshio Kuratomi
a1a7d6c462 Fix forwarding the user-given params from fetch_url() to open_url() 2015-06-23 15:17:26 -07:00
Toshio Kuratomi
e461241d7b Fix fetch_file() method 2015-06-23 14:45:44 -07:00
James Cammarata
d0d9be30d5 Correctly compile handler blocks for dependent roles 2015-06-23 15:48:48 -04:00
James Cammarata
0b16580567 Add in playbook_dir magic variable 2015-06-23 14:29:39 -04:00
James Cammarata
4c6adcf143 Submodule pointer update 2015-06-23 13:32:50 -04:00
Hugh Saunders
4246777759 Re-implement the ssh connection retry, originally added in 2df690 2015-06-23 12:14:14 -04:00
James Cammarata
006391eb83 Add the improved exception reporting to the minimal callback plugin 2015-06-23 12:14:14 -04:00
Toshio Kuratomi
6aae500a2c Documentation fix 2015-06-23 08:58:26 -07:00
Toshio Kuratomi
125e6f49a1 Update submodule refs 2015-06-23 08:49:01 -07:00
James Cammarata
72d4b40a26 Don't allow empty (none) loop values
Fixes #8593
2015-06-23 10:42:33 -04:00
James Cammarata
24d2202591 Make sure role parsing can handle a few more types in includes/defs 2015-06-23 10:20:09 -04:00
James Cammarata
aa53212a9b Don't use all task params for vars, just the module args 2015-06-23 10:20:09 -04:00
Toshio Kuratomi
952166f48e Fix problem with chroot connection plugins and symlinks from within the chroot. 2015-06-22 20:08:08 -07:00
Toshio Kuratomi
61e367f549 Better error messages when the file to be transferred does not exist. 2015-06-22 20:08:08 -07:00
James Cammarata
7490044bbe Implement play_hosts magic variable (and ansible_current_hosts)
Fixes #8073
2015-06-22 21:03:55 -04:00
James Cammarata
cb5f630f33 Don't post_validate vars and vars_files on Play objects
Fixes #11343
2015-06-22 11:23:23 -04:00
James Cammarata
ff251a0dcc Catch runtime errors due to recursion when calculating group depth
Fixes #7708
2015-06-22 02:06:07 -04:00
James Cammarata
97954ff658 Minor tweak to potentially speed the linear strategy up
* Don't fetch vars for the task unless we're going to use them
2015-06-22 00:53:34 -04:00
Benno Joy
f17bdc4d61 Set the ansible_ssh_port variable instead of saving it internally for Host
Fixes #11330
2015-06-22 00:38:41 -04:00
Brian Coca
b34b606fcf fixed and/or grouping 2015-06-21 01:51:28 -04:00
Brian Coca
68325dbfe2 fixed remote tmp creation when becoem user is not root and '~/' instead of $HOME is the default 2015-06-21 01:43:35 -04:00
Brian Coca
102de96ebf avoid password handling when no password is supplied 2015-06-21 01:24:35 -04:00
Brian Coca
3bad03d57a cleaned up and optimized become handling paths 2015-06-21 01:13:22 -04:00
Benno Joy
be81b650e8 fixes issue 11286 where role handlers are not run 2015-06-21 00:36:37 -04:00
James Cammarata
fc5be30c2f Change the use of a mutable arg for a default value for locals 2015-06-19 23:04:35 -04:00
James Cammarata
0d92599d18 Make exception printing a bit smarter 2015-06-19 22:59:12 -04:00