Commit Graph

183 Commits (919eb1fb98d0dda0dd50e2aea301c94d34e85a16)

Author SHA1 Message Date
Michael DeHaan 7037023aa8 Make debug print things nicer if {{ foo }} didn't interpolate 2013-04-12 15:02:54 -04:00
Michael DeHaan 85099be48f Merge pull request #2656 from dstoflet/first_available_file_fix
Quick fix for first_available_file and role support
2013-04-12 08:56:26 -07:00
Michael DeHaan 251f19263c Remove unneeded import. 2013-04-12 10:23:53 -04:00
Michael DeHaan 8457cf433d Update pause module to not use utils.template 2013-04-12 10:00:20 -04:00
Darryl Stoflet c63207bf75 Quick fix for first_available_file and roles 2013-04-11 20:40:23 -07:00
Michael DeHaan a6777f7e7c Fix template call in group_by module. 2013-04-11 12:43:02 -04:00
Michael DeHaan 81a926547c Some continued work on new-style templates and associated test code changes. Legacy template functions
are marked with "legacy_" for possible future removal.
2013-04-10 19:09:57 -04:00
Michael DeHaan b09ef21ec9 Add code to flag legacy templating like $foo.{bar} as deprecated in favor of Jinja2 {{ foo.bar }} so we
can remove the legacy system at a later date.
2013-04-10 17:52:35 -04:00
Michael DeHaan 892484812e Much requested feature -- allows relative imports of content within roles or relative to any task or handler include (../templates for template ../files for copy) 2013-04-06 12:13:04 -04:00
Michael DeHaan cdaa2085ee Preliminary ability to use Jinja2 {{ }} to replace ${foo.bar} in playbooks. Can't use both at the same time per line. 2013-04-03 01:04:16 -04:00
Michael DeHaan 3c5890f42b Ensure that when transferring a file to a directory the name of the file is the correct basename and not 'source'. 2013-03-25 22:19:35 -04:00
Michael DeHaan e304cc3d8e Simple fix for spaces in filenames with the template module. 2013-03-11 17:13:59 -04:00
Michael DeHaan 6e2ea327d1 A very simple fix to enable spaces in the files sent via the copy module. 2013-03-11 17:11:53 -04:00
Michael DeHaan f2c8df2a93 Clarify an error message 2013-03-17 23:33:13 -04:00
Patrick Pelletier c7c7a63ee5 Add support to directly set content in copy module 2013-03-17 23:33:13 -04:00
Michael DeHaan b2c8ed9cc2 Merge pull request #2279 from dorfsmay/fetch-fail_on_missing
Added a fail_on_missing option to fetch.
2013-03-10 16:18:28 -07:00
Daniel Hokka Zakrisson 76f3351b02 Move complex_args templating to be with module_args
Keeps every action plugin from having to do the same thing.
2013-03-07 11:09:29 +01:00
Michael DeHaan ffbd4b5a2c Template options sooner on complex args copy 2013-03-07 00:35:40 -05:00
Michael DeHaan 2bb305f6d5 Fix args templating for complex args with the copy module. 2013-03-07 00:28:06 -05:00
Michael DeHaan fe8547cac0 Ensure template arguments if complex are still properly templated 2013-03-07 00:04:48 -05:00
Yves Dorfsman e45a0fd61d Added a fail_on_missing option to fetch. 2013-03-02 11:04:48 -07:00
Michael DeHaan 6ad390a92b Revert "Revert "for #2196 now gruopby module invalidates host cached variables so they can be reevaluated with new groups""
This reverts commit dc0515a88a.

We didn't need to revert this :)
2013-03-02 10:38:51 -05:00
Daniel Hokka Zakrisson 5d82b4b1b7 group_by needs the untemplated module_args 2013-03-02 16:30:30 +01:00
Michael DeHaan dc0515a88a Revert "for #2196 now gruopby module invalidates host cached variables so they can be reevaluated with new groups"
This reverts commit 2d86671aa5.
2013-03-02 10:21:36 -05:00
Daniel Hokka Zakrisson 43ce2caa4f Fix parse_kv invocation in group_by to use imported name
Fixes #2277.
2013-03-02 15:18:16 +01:00
Michael DeHaan b6f7a22de5 Merge pull request #2261 from bcoca/groupby_2186
now group by module invalidates host cached variables
2013-03-01 15:16:47 -08:00
Brian Coca 2d86671aa5 for #2196 now gruopby module invalidates host cached variables so they can be reevaluated with new groups
Signed-off-by: Brian Coca <bcoca@tablethotels.com>
2013-03-01 18:00:34 -05:00
Daniel Hokka Zakrisson ae8d6ac303 Ensure complex_args is considered in all action_plugins 2013-02-28 14:27:42 +01:00
Stoned Elipot 8816dc7ca7 Make diff header lines more explicit about what the diff is about
This gives a more readable output when producing diff for a task
with multiple items (with_items).
2013-02-26 16:53:59 +01:00
Stoned Elipot 1b8c9bab35 Fix diff when template destination is absent 2013-02-26 16:45:56 +01:00
Stoned Elipot 10e9f1fc1e Implement --diff for the copy module. 2013-02-25 23:32:52 +01:00
Michael DeHaan 6d604469d8 Always adjust file attributes with the template module. 2013-02-20 08:05:59 -05:00
Michael DeHaan ab389d8908 For consistency, add host should take a key named 'name' in addition to 'hostname'. 2013-02-17 20:45:37 -05:00
Michael DeHaan 9cf66f4376 Fixes from 'make pep8'. Partial, more to come. 2013-02-17 19:40:38 -05:00
Kavin Kankeshwar 359ac9a495 Fixing syntax error
running install_lib
byte-compiling /usr/lib/python2.6/site-packages/ansible/runner/action_plugins/add_host.py to add_host.pyc
SyntaxError: ('invalid syntax', ('/usr/lib/python2.6/site-packages/ansible/runner/action_plugins/add_host.py', 37, 92, '    def run(self, conn, tmp, module_name, module_args, inject, complex_args=None, **kwargs)\n'))
2013-02-17 15:35:58 -08:00
Michael DeHaan 1ecf4a6943 Working on complex argument support. 2013-02-17 15:01:49 -05:00
Michael DeHaan b365e04616 Allow add_host to add hosts to multiple groups, groups is now an alias for groupname. 2013-02-17 11:22:50 -05:00
Rob Parrott ef17fc9f20 add the ability to take variables in the add_host module, and be willing to parse a host:port hostname handed to add_host 2013-02-16 20:27:38 -05:00
Daniel Hokka Zakrisson 7e2999ed2d Add directory detection to _remote_md5 and use this in copy
If it is a directory, change the destination path by appending the
basename of the source file, like is done if the destination ends with a
/, and try to get the MD5 of the new path.
2013-02-12 22:39:05 +01:00
Michael DeHaan 72a05ae2a0 Move diff code more into runner code. 2013-02-09 23:24:03 -05:00
Matt Cordial 2ccfc8d2b6 Fix Issue #2025 where templates were not being transfered. 2013-02-08 12:03:54 -07:00
Michael DeHaan a9162a86f2 Very basic --diff option for showing what happens when templates change.
Probably output is not useful if not used with --limit

Works well with --check mode
2013-02-07 22:52:25 -05:00
Daniel Hokka Zakrisson 1becc665b2 Fix missing ) in add_host
Fixes #1980.
2013-02-04 12:21:33 +01:00
Michael DeHaan fed82c2188 This implements a basic --check mode which for now is only implemented on template & copy operations. More detail will be shared with the list
shortly.
2013-02-03 20:34:13 -05:00
Daniel Hokka Zakrisson 4d71b31f7e Ensure destination and source are available before mangling them
Fixes #1918.
2013-01-25 23:14:52 +01:00
Dag Wieers fb802beee7 In PR #1804 the use of C in script was moved to _low_level_execute_command()
So we cannot get rid of this one now.
2013-01-09 15:54:10 +01:00
Daniel Hokka Zakrisson 7782923ea2 Revert #1818 but avoid double-dwim, fixing relative fileglob 2013-01-09 14:52:52 +01:00
Daniel Hokka Zakrisson 891b1e371a Default to not using an executable
For compatibility with older releases as well as avoiding things like
action: raw executable= show status
to communicate with devices that don't have sh.
2013-01-09 14:15:47 +01:00
Daniel Hokka Zakrisson 92ad206b84 Use re instead of shlex.split to find executable
shlex.split will strip quotes and it might not even be sh at this point.
2013-01-09 14:13:53 +01:00
Dag Wieers b781438480 Clean up imports (taken from PR #1804) 2013-01-09 13:51:27 +01:00
Daniel Hokka Zakrisson 1b5d039bf4 Extend executable= support in raw to include no execuable
Useful for managing not-UNIX things.
2013-01-08 17:45:37 +01:00
Daniel Hokka Zakrisson 4955587d8c Merge pull request #1798 from dagwieers/raw-executable
Allow to change executable (shell/interpreter) when using raw
2013-01-08 08:35:08 -08:00
Dag Wieers eb36ff45b9 Make script module use raw module so it does not require python 2012-12-24 00:24:34 +01:00
Dag Wieers 846161a1a4 Allow to change executable (shell/interpreter) when using raw
This patch adds an optional 'executable=' option to the raw command line to override the default shell (/bin/sh), much like the shell module does.
2012-12-23 20:49:02 +01:00
Dag Wieers 988db558b3 Add return code and error output to raw module
Since we use 'raw' heavily on equipment where 'command' and 'shell' are not (yet) working (and python may need to be installed first using raw) these improvements are necessary in order to write more complex scripts (with return code handling and separated stdout/stderr).

This change includes the following changes:

 - exec_command() now returns the return code of the command
 - _low_level_exec_command() now returns a dict, including 'rc', 'stdout' and 'stderr'
 - all users of the above interfaces have been improved to make use of the above changes
 - all connection plugins have been modified to return rc and stderr
 - fix the newline problem (stdout and stderr would have excess newlines)

In a future commit I intend to add assertions or error handling code to verify the return code in those places where it wasn't done. Since only the output was available, the return code was ignored, even though we expect them to be 0.
2012-12-23 18:04:54 +01:00
Daniel Hokka Zakrisson bda08c8a1b Avoid creating temporary directory for some action plugins
This ensures we don't litter remote systems with temporary directories
that don't get cleaned up, as well as speeds things up from not having
to touch every node.
2012-11-28 21:34:55 +01:00
Daniel Hokka Zakrisson f6e7381a71 Evaluate only_if in group_by 2012-11-28 16:22:58 +01:00
Daniel Hokka Zakrisson 0ebf4b2d5a Add destination path to fetch result 2012-11-20 15:39:48 +01:00
Daniel Hokka Zakrisson f89f07871d Fix typo in first_available_file error path 2012-11-19 23:02:26 +01:00
Daniel Hokka Zakrisson 11175781b8 Use slurp for fetch is sudo is enabled and needed
Fixes #1020.
2012-11-18 17:54:00 +01:00
Seth Vidal 70d61fe7e8 need to use the variabled results 2012-11-09 00:16:17 -05:00
Seth Vidal e147ad4213 add add_host action plugin - add hosts to inventory during a playbook
run - lets act on those hosts in the next play
2012-11-09 00:16:17 -05:00
Dag Wieers d8459425a0 Turn 'fail' and 'debug' modules into action_plugins
This makes more sense as there is no purpose in running these remotely.
2012-11-07 23:34:53 +01:00
Daniel Hokka Zakrisson 00aa584c57 Don't double dwim first_available_file in template 2012-11-06 20:34:05 +01:00
Jeroen Hoekx b336d40101 Add a group_by action plugin. 2012-10-29 13:10:23 +01:00
Jeroen Hoekx f963db6c2a Fix output of pause plugin. 2012-10-29 10:57:13 +01:00
Michael DeHaan cbc12f0dba Various performance streamlining and making the file features usable in all modules without daisy chaining. 2012-10-20 22:55:09 -04:00
Michael DeHaan 4104478abd Added 'script', a module that can push and insantly run a remote script. Replaces the need to copy+command.
This is a bit of a rough draft, some error handling still needs to be added.
2012-10-20 12:12:07 -04:00
Michael DeHaan 019f775a93 DWIM the paths for first_available_file 2012-10-20 11:11:31 -04:00
Daniel Hokka Zakrisson 519a1f3f23 Remove debug print statements 2012-10-17 22:45:17 +02:00
Michael DeHaan c5d2f6b0d3 implement lookup plugins for arbitrary enumeration over arbitrary things. See the mailing list for some cool examples. 2012-10-12 20:07:05 -04:00
Tim Bielawa 9f6da7b885 Fix variable injection in pause module args. Closes #1209 2012-10-03 23:52:26 -04:00
Daniel Hokka Zakrisson 66d0acfde3 Remove assemble action plugin, fix daisychaining 2012-09-27 18:30:08 +02:00
Michael DeHaan df147ab921 Merge pull request #1089 from tbielawa/runner_pause
Add 'pause' action plugin and support plugins skipping the host loop.
2012-09-25 17:11:54 -07:00
Michael DeHaan 730b617186 Add init, though it's not really used. 2012-09-25 08:21:59 -04:00
Tim Bielawa 58a4d2f7b4 Add 'pause' action plugin and support plugins skipping the host loop. 2012-09-25 01:13:35 -04:00
Daniel Hokka Zakrisson 34f7e6ffa0 Pass module arguments as argument instead of keeping it in runner 2012-09-23 23:38:26 +02:00
Daniel Hokka Zakrisson cc948f339c Allow including files through variables
$FILE{file} will be replaced with the contents of "file"
$PIPE{cat file} will be replaced with the output of "cat file"
2012-09-19 17:57:17 +02:00
Michael DeHaan b8c4bb9e6e Revert "Allow including files through variables"
This reverts commit bf47bb4753.

Conflicts:

	lib/ansible/utils.py
	test/TestUtils.py
2012-09-19 10:31:23 -04:00
Daniel Hokka Zakrisson bf47bb4753 Allow including files through variables
$FILE{file} will be replaced with the contents of "file"
$PIPE{cat file} will be replaced with the output of "cat file"
2012-09-17 16:03:59 +02:00
willthames f456d999a9 Fix templates for non root sudo_user
When using template module, if a restrictive umask is set, the
sudo_user won't be able to read the /tmp/ansible-dir/source file
after it is copied across following _transfer_str

I wonder if this behaviour shouldn't be abstracted somehow (as
this correction also happens after put_file in the copy module too)
2012-09-07 16:35:53 +10:00
Michael DeHaan 8a09e1281b Fixup modularized template module 2012-09-06 19:04:27 -04:00
Michael DeHaan 633e513a65 Modular server-side actions (squash merge) 2012-09-06 18:57:04 -04:00