Commit graph

6238 commits

Author SHA1 Message Date
Brian Coca
84f8241ff8 tag the setup task with always
fixes #14228
2016-02-02 16:31:22 -05:00
Toshio Kuratomi
42e312d3bd Change $() into backticks. Backticks should work for both POSIX and non-POSIX compatible shells.
Fixes #14176
2016-02-02 12:38:21 -08:00
Toshio Kuratomi
147dba5d97 Merge pull request #14277 from ansible/default-shell-type
Establish sh as the default shell plugin.
2016-02-02 12:19:00 -08:00
Toshio Kuratomi
5b1d8cfd5c Establish sh as the default shell plugin.
This is a fix for one of the problems pointed out in #14176
2016-02-02 11:46:09 -08:00
Brian Coca
8d4bc2003f better fix for ansible-pull inventory handling
now it mirrors what it did in previous versions
and properly uses inventory and limit options
2016-02-02 14:22:15 -05:00
Brian Coca
197bed6fd8 make executable setting connection dependant
winrm shoudl not use executable, rest should?
fixes #14233
2016-02-02 13:13:02 -05:00
James Cammarata
b2c0abe998 Don't mark host as having gathered facts when peeking at next task
Fixes #14243
2016-02-02 10:22:52 -05:00
Brian Coca
a584ab3420 Merge pull request #11113 from sysadmin75/11104_osx_facts_bridge
Fixes OSX fact gathering for the bridge interface.
2016-02-02 00:46:21 -05:00
Brian Coca
f628704a71 added option groups to make --help readable
Also moved -K to become to keep short option in view of removing the
separate sudo/su prompt options
2016-02-02 00:09:14 -05:00
Brian Coca
eafc31f3f8 Merge pull request #14197 from bcoca/safer_data_load
load now does not modify the incomming data
2016-02-02 00:02:23 -05:00
Brian Coca
dc15eb806e deprecate all bare variable conversions (not debug)
now deprecation message appears with variable name in all spots where this occurs
debug's var= option is excluded as this is only place where bare variables shold actually
be accepted.
2016-02-01 18:59:14 -05:00
Brian Coca
28cf4bc00b fix incorrect environment processing
it was assumed it could only be a dict or string (it starts out as a list)
also a 2nd assumption that bare vars only would appear in one of the dict keys.

removed deprecation warnings from here as they should be signaled in the bare conversion itself.
2016-02-01 18:54:09 -05:00
Brian Coca
6a62ad6c4b hide internal params once used 2016-02-01 15:17:23 -05:00
Brian Coca
e0ed88e668 normalize error message on src != dir when local
now action plugin returns same error as module
2016-02-01 13:43:35 -05:00
Matt Martz
ddfab5faf1 Use isinstance type checks in bool filter so we can handle unsafe proxy objects. Fixes #14240 2016-02-01 12:32:59 -06:00
Peter Sprygada
b2f1c0691d initial add of action plugin ops_template
Adds new local action ops_config for handling openswitch configurations using
either dc or cli based configurations.  Implements the common net_config
local action.

Note this refactors the ops_config plugin to ops_template
2016-02-01 11:54:56 -05:00
Peter Sprygada
4f2a75923e initial add of action plugin ios_template
Adds a new local action ios_config for working with cisco ios configuration
files.  Implements the common net_confing local action

Note this plugin was refactored from ios_config to ios_template
2016-02-01 11:54:02 -05:00
Peter Sprygada
54f7a7b6d2 initial add of action plugin nxos_template
Adds new local action for working with cisco nxos configurations.  Implemements
the net_config local action.

Note this action plugin was refactored from nxos_config to nxos_template
2016-02-01 11:52:50 -05:00
Peter Sprygada
be82caefd2 initial add of action plugin eos_template
Adds a new local action for eos_config module to handle templating configs
and backing up running configurations.   Implements the local action
net_config

Note this action was refactored from eos_config to eos_template
2016-02-01 11:51:52 -05:00
Peter Sprygada
1733bf4053 minor update for nxos
This fixes a minor bug in the nxos config module to ensure that both the
cli and nxapi transport return the running config as a string and not
a list object.
2016-01-31 22:59:49 -05:00
Peter Sprygada
633b16d116 add exeception handling for invalid commands over nxapi
This commit will catch invalid commands being send over nxapi and call
fail_json on the module.  The nxos shared module will now return the
failure
2016-01-31 20:10:20 -05:00
Brian Coca
49c15c8137 Merge pull request #14220 from bcoca/ansible_pull_once
harcoding inventory/hosts when pulling from repo
2016-01-30 11:35:12 -05:00
Toshio Kuratomi
9e3932ffca Some attributes of callbacks aren't in v2. Port plugins to the v2 way to do that
Update porting guide with info on callback porting
2016-01-29 19:45:12 -08:00
Toshio Kuratomi
fb57818ea3 Explicitly set validate_certs=False as the boto default is True
Fixes #14089
2016-01-29 16:37:15 -08:00
Brian Coca
7964a35918 harcoding inventory/hosts when pulling from repo
return to pre 2.0 behaviour which did not factor inventory into the repo pull
2016-01-29 18:46:56 -05:00
Brian Coca
1aae6499ca fixed code for v1 callback runtime compatiblity
old exception code obsoleted by exception avoidance
errors on callback produce warnings and don't stop play
2016-01-29 16:55:23 -05:00
James Cammarata
5587b08335 Make sure setup tasks inherit properly from their parent play
Fixes #13602
2016-01-29 15:38:46 -05:00
Toshio Kuratomi
ceef202024 Update submodule refs 2016-01-29 09:59:58 -08:00
Toshio Kuratomi
315fd15f69 Merge pull request #12909 from photoninger/sles11.4-fix_2nd_try
Fix for SLES 11.4, which has now also an /etc/os-release file.
2016-01-29 09:11:51 -08:00
Brian Coca
dd4787701f fix unicode input for template lookup
fixes #14207
2016-01-29 10:42:52 -05:00
James Cammarata
0c237c4531 Merge pull request #14191 from paulcalabro/devel
Added hyphen (-) as a valid character for permissions
2016-01-29 00:55:53 -05:00
Brian Coca
db375c22af load now does not modify the incomming data
also removed json loader as yaml loader can do both
2016-01-28 19:43:17 -05:00
Toshio Kuratomi
2c825539ff When setting up the local connection for the rsync we need to set the shell as well.
Fixes #13490
2016-01-28 16:02:57 -08:00
Paul Calabro
901d349f45 Adding a hyphen in the perms pattern section, since doing something like
go=- is a quick way to strip all permissions for non-owners.
2016-01-28 13:05:10 -07:00
Toshio Kuratomi
5ecfa8ddfc Merge pull request #14189 from ansible/unicode-pager
Changes to convert to unicode at the borders
2016-01-28 11:46:34 -08:00
Toshio Kuratomi
605fb08487 Merge pull request #14168 from ansible/safer-squashing
Squashing was occuring even though pkgs didn't have a template that would be affected by squash
2016-01-28 10:57:43 -08:00
Toshio Kuratomi
fa9822df0f Changes to convert to unicode at the borders
The module docs and vault changes solve issues where tracebacks can
happen.  The galaxy changes are mostly refactoring to be more pythonic
with a small chance that a unicode traceback could have occurred there
without the changes.  The change in __init__.py when we actually call
the pager makes things more robust but could hide places where we had
bytes coming in already so I didn't want to change that without auditing
where the text was coming from.

Fixes #14178
2016-01-28 10:56:46 -08:00
Toshio Kuratomi
e7a9031d61 Update submodule refs 2016-01-28 09:43:29 -08:00
Toshio Kuratomi
0e410bbc8a Squashing was occuring even though pkgs didn't have a template that would be affected by squash
This broke other uses of looping (looping for delegate_to in the
reported bug)

Fixes #13980
2016-01-27 21:55:00 -08:00
Brian Coca
c857b20043 fixed issue with vars prompt warning causing error
sometimes display object is not magically available, use it explicitly,
no need to be classmethod anymore
fixes #14147
2016-01-27 16:13:06 -05:00
Toshio Kuratomi
3f3e3e3d5b Return an error when synchronize is used with something other than an ssh connection
Suggested in #2832
2016-01-27 12:48:15 -08:00
Brian Coca
6bf2f45ff5 fix for so su works in more cases
should not fail anymore on csh, fish nor the BSDs
fixes #14116
2016-01-27 14:13:01 -05:00
Peter Sprygada
4fa6902c96 address minor bugs in nxos shared module
This addresses two issues with the nxos shared module.  The first issue is
argument precedence checking.  The module should prefer explicit arguments
over arguments passed vi the provider.  This is now fixed to honor that
precedence.  The second issue is collecting output from nxapi and returning
the response.  Prior to this change the entire json structure was returned.
Now just the output is returned to align it better with cli based output
2016-01-27 11:25:56 -05:00
Peter Sprygada
c59916c43d fixes issue with eos shared module argument precedence
The eos shared module should prefer to use explicit task arguments over
arguments provided through the provider.  This fixes a problem where
that was not the case
2016-01-27 11:25:47 -05:00
James Cammarata
a61e51efb7 Don't try to generate retry files if the tqm hasn't been initialized
Fixes #14144
2016-01-27 09:56:50 -05:00
Toshio Kuratomi
cb2b19ced8 Fix for inventory hosts on localhost with alternate ports.
Fixes https://github.com/ansible/ansible-modules-core/issues/2831
2016-01-26 13:53:42 -08:00
James Cammarata
3ed3a5f43a Make retry file generation not use StringIO 2016-01-26 14:52:41 -05:00
James Cammarata
78d499140c Re-implementing the retry file feature for 2.0
Fixes #13944
2016-01-26 14:11:28 -05:00
James Cammarata
07a9a54b0e Fix lookup of parent attribute when parent doesn't have the attr
Fixes #14100
2016-01-26 13:10:23 -05:00
Brian Coca
66104191d1 fixed permissions check for ansible.log
fixes #13990
2016-01-26 11:22:52 -05:00
Brian Coca
46fde754af Merge pull request #14044 from skorochkin/devel
Adding support for scm-based role source urls (ansible-galaxy)
2016-01-26 10:41:05 -05:00
Tobias Wolf
5b293b56d6 Handle the key 'prepared' in the 'diff' result from modules
So far, when a 'diff' dict is returned with module results, it is
checked for 'before' and 'after' texts, which are processed in
_get_diff() by python difflib.  This generates the changes to display
when CLI users specify --diff.

However, some modules will generate changes that cannot easily be
expressed in a conventional diff. One example is the output of the
synchronize module, which presents changed files in a common log format
as in `rsync --itemize-changes`.

Add a check for a diff['prepared'] key, which can contain prepared diff text
from modules.
2016-01-26 09:29:37 +01:00
Toshio Kuratomi
c44110bc81 Update submodule refs to pick up the synchronize internal parameter 2016-01-25 19:57:28 -08:00
Toshio Kuratomi
a23a5d1b93 Merge pull request #13968 from ansible/synchronize-become-is-reversed
synchronize: First cut at not doing sudo on the control machine but on the remote machine instead.
2016-01-25 19:52:03 -08:00
Toshio Kuratomi
d0a062ffa3 python3 doesn't have raw explicit-unicode literals. Workaround it with a raw native string that we make unicode in py2. 2016-01-25 19:46:57 -08:00
Toshio Kuratomi
3cf59d30f7 For synchronize, fix sudo to execute on the remote end of the connection
* In 2.0.0.x become was reversed for synchronize. It was happening on
  the local machine instead of the remote machine. This restores the
  ansible-1.9.x behaviour of doing become on the remote machine.
  However, there's aspects of this that are hacky (no hackier than
  ansible-1.9 but not using 2.0 features).  The big problem is that it
  does not understand any become method except sudo.  I'm willing to use
  a partial fix now because we don't want people to get used to the
  reversed semantics in their playbooks.
* synchronize copying to the wrong host when inventory_hostname is
  localhost
* Fix problem with unicode arguments (first seen as a bug on synchronize)

Fixes #14041
Fixes #13825
2016-01-25 19:33:31 -08:00
Toshio Kuratomi
f4d68b8860 Transform tracebacks into unicode before printing
Fixes #14042
2016-01-25 19:18:59 -08:00
Brian Coca
c063803a91 raise AnsibleError as an 'expected' exception
fixes #14065
2016-01-25 22:20:55 -05:00
Brian Coca
9df0662408 simpler conditional 2016-01-25 22:01:48 -05:00
Jonathan Davila
041e1979c4 Boto3 error handle fix 2016-01-25 17:40:20 -05:00
Brian Coca
ac1d1673be adhoc now respects limit when listing hosts
also removed cruft about localhost as if used it is specified inline
fixes #13848
2016-01-25 17:39:01 -05:00
Jonathan Davila
f95652e7db Merge remote-tracking branch 'upstream/devel' into ec2_util_boto3 2016-01-25 17:35:39 -05:00
Brian Coca
87fe32319f ensure stdout callback alwasy is loaded first
it is now called for every event prior to any other callbacks
fixes #14114
2016-01-25 17:11:36 -05:00
Brian Coca
af88e34831 better error when host inventory script isnt dict 2016-01-25 16:32:09 -05:00
James Cammarata
a8ffa02134 Make sure blocks use their parents dependency chains
Fixes a bug inroduced in fb797a9 where included tasks in a role
were not being executed because the child blocks had no dep chain
set.
2016-01-25 09:02:44 -05:00
James Cammarata
2b02e8e2b4 Allow certain base attributes to be used as role params
Role definitions typically require params to be different from those
which are specified as FieldAttributes on the playbook classes used
for roles, however a certain subset should be allowed (typically those
used for connection stuff).

Fixes #14095
2016-01-24 23:04:50 -05:00
James Cammarata
46ede563dd Use templated handler name during callback
Fixes #14082
2016-01-23 09:25:50 -05:00
James Cammarata
fb797a9e77 Fixing role dependency chain creation
The dep chain for roles created during the compile step had bugs, in
which the dep chain was overwriten and the original tasks in the role
were not assigned a dep chain. This lead to problems in determining
whether roles had already run when in a "diamond" structure, and in
some cases roles were not correctly getting variables from parents.

Fixes #14046
2016-01-22 12:54:00 -05:00
James Cammarata
4651155942 Fix bug with any_errors_fatal where task was not available 2016-01-21 16:42:31 -05:00
James Cammarata
d02dee37a1 Disallow setting state on template tasks
Fixes #14056
2016-01-21 15:02:24 -05:00
Toshio Kuratomi
ecf867af6f Update submodule refs 2016-01-21 11:11:05 -08:00
Toshio Kuratomi
f594cc0a5b Merge pull request #13993 from towolf/avoid_json_to_unicode
Avoid recursively checking JSON inventory for Unicode
2016-01-21 08:41:16 -08:00
Tobias Wolf
d6ae9e2c29 Avoid recursively checking JSON inventory for Unicode
by moving to en-bloc unicode conversion to act on scripts stdout

Both python-json and simplejson always return unicode strings when using
their loads() method on unicode strings. This is true at least since
2009. This makes checking each substring unnecessary, because we do not
need to recursively check the strings contained in the inventory dict
later one-by-one

This commit makes parsing of large dynamic inventory at least 2 seconds
faster.

cf: https://github.com/towolf/ansible-large-inventory-testcase
2016-01-21 17:35:40 +01:00
Brian Coca
f26adcc7da avoid shredding empty files, also x/0
also cleaned up unused import and exception var
2016-01-21 10:54:56 -05:00
Sergii Korochkin
1325c21ca0 Adding support for scm-based role source urls (incl. integration test to cover it) 2016-01-21 14:00:29 +02:00
James Cammarata
627dec716b Template the run_once value in the linear strategy as we use it there
This is pre-post_validation, so we have to template it on the fly
as we use it to determine if we bypass the host loop.

Fixes #11876
2016-01-20 20:54:12 -05:00
James Cammarata
365c5b23ce Re-add cache clearing call to Inventory init
This prevents a bug where the existing cache outside of the class
is not cleared when creating a new Inventory object. This only really
affects people using the API directly right now, but wanted to fix it
to prevent weird errors from popping up.
2016-01-20 20:54:12 -05:00
Brian Coca
c2ac1507ea corrected host/group match in inventory_hostnames
now the lookup works when using ! and & operators
fixes #13997
2016-01-20 18:32:39 -05:00
James Cammarata
9b05a670c7 Merge pull request #14031 from selivan/devel
plugins/strategy: added significant details to parser error message.
2016-01-20 15:49:38 -05:00
James Cammarata
54cde0d082 Standardize removal of BECOME-SUCCESS method and use it for async too
Fixes #13965
Fixes #13971
2016-01-20 15:27:28 -05:00
Toshio Kuratomi
61009604e3 Update submodules to bring in yum fix 2016-01-20 12:18:52 -08:00
Toshio Kuratomi
d97d28ecb0 Merge pull request #14025 from ansible/run_command-env-rework
rework run_command's env setting to not change os.environ for the res…
2016-01-20 12:13:43 -08:00
Selivanov Pavel
3201f5d90e plugins/strategy: added significant details to parser error message.
See discussion at
https://github.com/ansible/ansible/issues/13753
2016-01-20 23:12:26 +03:00
Toshio Kuratomi
a68d90a71a rework run_command's env setting to not change os.environ for the rest of the module.
New param to run_command to modify the environment for just this invocation.
Documentation and comment adjustments.
2016-01-20 12:03:32 -08:00
Matt Martz
d49b11e996 Only use os.path.basename if get_file_content returned a value, and ensure that service_mgr has line endings stripped. Fixes #14026 2016-01-20 13:08:16 -06:00
Brian Coca
cc4506b451 Merge pull request #14006 from bcoca/always_shell_again
go back to always wrapping commands in shell
2016-01-20 13:17:34 -05:00
James Cammarata
ac89b0de7a Fix incorrect handling of any_errors_fatal in the linear strategy
Instead of bombing out of the strategy, we now properly mark hosts failed
so that the play iterator can handle block rescue/always properly.

Fixes #14024
2016-01-20 12:16:27 -05:00
James Cammarata
e3a6accc1d Forward conditionals onto included plays when conditional eval errors
When using a playbook-level include, we now catch any errors raised during
the conditional evaluation step and set a flag to indicate we need to pass
those conditionals on to the included play (most likely because they contain
inventory variables for evaluation).

Fixes #14003
2016-01-20 01:32:45 -05:00
James Cammarata
c8bbdd6b39 Don't assign both parent blocks and task includes to blocks
This causes problems when fetching parent attributes, as the include
was being skipped because the parent block would fetch the attribute
from the parent play first.

Fixes #13872
2016-01-19 22:47:07 -05:00
Brian Coca
c09c01a1f5 go back to defaulting wrapping commands in shell
this was taken out in an effort to default to the user's shell but creates issues as this is not known ahead of time
and its painful to set executable and shell_type for all servers, it should only be needed for those that restrict the user
to specific shells and when /bin/sh is not available. raw and command may still bypass this by explicitly passing None.
fixes #13882

still conditional
2016-01-19 22:09:17 -05:00
Peter Sprygada
981265ac84 adds provider argument to nxos shared module
The provider argument accepts the set of device common arguments as a
dict object.  Individual connection arguments can still be included and
take priority over the provider argument.  This update includes additions
to the nxos doc fragment
2016-01-19 19:02:41 -05:00
Peter Sprygada
9cba1a7c69 adds provider argument to ios shared module
New argument `provider` added to the ios shared module that provides
the ability to pass all of the common ios arguments as a dict.  This commit
includes some minor bugfixes and refactoring of names.   It also includes
udpates to the ios documentation fragment for the new argument
2016-01-19 19:00:52 -05:00
Peter Sprygada
e2ff26a5cf add provider argument to eos shared module
Adds a new argument `provider` to the eos shared module and updates the
eos doc fragment.  This commit includes some additional minor fixes and
code refactors for naming conventions.  The `provider` argument allows the
shared module arguments to be passed as a dict object instead of having
to pass each argument invididually.
2016-01-19 18:57:26 -05:00
James Cammarata
d07d974ad8 Revert "Properly look for parent become attribute"
This reverts commit 1b46a422aa.
2016-01-19 18:17:42 -05:00
Toshio Kuratomi
ca8261ed31 Don't tracback trying to retore settings
Can occur if we exit the timeout before the settings were changed
2016-01-19 14:09:22 -08:00
Peter Sprygada
0f2917fde3 add provider to iosxr shared module
This commit adds a new argument `provider` to the iosxr shared module that
allows common connection parameters to be passed as a dict object.  The
constraints on the args still applies.  This commit also updates the iosxr
doc fragment.
2016-01-19 14:51:06 -05:00
Peter Sprygada
7640eca368 adds provider argument to openswitch shared module
Adds new argument `provider` to the openswitch shared module.  The provider
argument can pass all openswitch connection arguments as a dict object.  This
update includes adding the provider argument to the openswitch doc fragment
2016-01-19 14:50:39 -05:00
Peter Sprygada
33d390fb58 adds provider argument to junos shared module
This commit adds a new argument `provider` to the junos shared module.  The
argument allows the set of common connection args to be passed to the
junos shared module.  This commit also updates the junos doc fragment
2016-01-19 14:50:01 -05:00
Peter Sprygada
5144ee226e adds private key file support to shell shared module
This commit provides an argument to provide a path to the private key
file.  This will allow paramiko to use the key file as opposed to only
username / password combinations for CLI connections.
2016-01-19 14:26:23 -05:00
James Cammarata
1b46a422aa Properly look for parent become attribute
Corrects inheritence of the boolean value, which needs some special
consideration from other (string/int) values.

Fixes #13872
2016-01-19 14:12:27 -05:00