Commit Graph

199 Commits (bda08c8a1b501e0a1ca2d4898b869fa9eca8ef95)

Author SHA1 Message Date
Michael DeHaan 176bf3cbb5 Save extra chmod step if sudoing to root 2012-08-08 19:17:31 -04:00
Will Thames 414eceb138 chmod needs more specific arguments to work with sudo_user
Basically if umask is set to something like 0007 then chmod +r and chmod +x
are not the same as chmod a+r and chmod a+x

Using os.path.basename rather than source.split should make ansible more
portable (and even if never ported, more readable)
2012-08-08 16:12:50 +10:00
Michael DeHaan faed4b5a33 whitespace + remove deprecated YAML parser (migration script lives in examples/scripts and warning was added
in 0.6 release)
2012-08-06 20:07:02 -04:00
Michael DeHaan 08c1f96e4b Fix some subtle behavior of how the get_url module chains into the file module, plus blend the results of daisy chain
operations in the correct order, so the file module results overlay the original module results, not the other way
around (which keeps any failure msg's intact)
2012-08-03 07:02:31 -04:00
Michael DeHaan ce01c3f7e7 Allow unicode transfer by not base64 encoding. Also: faster 2012-08-02 21:20:43 -04:00
Michael DeHaan 05df6464ef Make module args as unicode more or less not choke. 2012-08-02 20:29:18 -04:00
Michael DeHaan b76efa39be Fix some templating issues, needs testing with anti-unicode safeguard around shlex.split 2012-08-02 20:21:59 -04:00
Michael DeHaan fe87a16a3e Make yum module use one-pass with with_items 2012-08-01 22:27:25 -04:00
Michael DeHaan 25acfa8170 Join with_items for the apt module, yum pending, and various fixes to the yum module to support aliases 2012-08-01 20:33:13 -04:00
Petros Moisiadis 2ac4acbf97 fixes for tests 2012-08-01 22:17:16 +03:00
Petros Moisiadis 5f4bf813b1 added an 'ignore_errors' option to tasks
Failed tasks with ignore_errors=True, allow the remaining tasks in the
play to be executed as if no failure happened. A failure notice is still
written to the output as well as an '...ignoring' message.
2012-08-01 19:13:07 +03:00
Timothy Appnel b30f4688cd concatenating stdout and stderr in runner/__init__'s _low_level_exec_command. 2012-07-31 16:59:45 -04:00
Michael DeHaan 17be5537d6 When sudoing to another user, the umask may be set such that the next user might not be able to read/execute
the file.  Deal with this.
2012-07-28 08:48:05 -04:00
Michael DeHaan fcdc281c28 If sudoing to a user other than root, the home directory of the original user is very unlikely to be readable by the
sudoed to user, so just use tmp.  Data will be readable by others (briefly before deletion) but never writeable.
2012-07-27 20:53:50 -04:00
Michael DeHaan aa40c5f3b3 remove commented out debug lines 2012-07-27 20:44:55 -04:00
Michael DeHaan a65b4fef97 Fix up chain invocations of template 2012-07-26 00:39:44 -04:00
Michael DeHaan 19fc8eea80 Things that happen inside multiprocessing shouldn't make side effects, ergo append ansible_facts only
in playbook code.

This technically means with_items calls can't continuously add facts I guess, but I can't see anyone
ever trying that.
2012-07-25 21:30:49 -04:00
Lorin Hochstein b63a3bd0c7 Save module name and args when processing list of items.
This is necessary because daisy-chained modules will overwrite
these values.
2012-07-25 13:26:07 -04:00
Michael DeHaan c16b691883 Copy module needs to use src as transfer path. 2012-07-24 20:35:10 -04:00
Jan-Piet Mens 44a9226ece file mode now correctly set after chaining from copy 2012-07-24 16:43:36 +02:00
Michael DeHaan 3a2df329af Tweak the way chained callbacks work 2012-07-23 22:12:26 -04:00
Michael DeHaan dd6399b5ae Fixup args being passed into file from copy, tweak preservation of changed attribute. 2012-07-23 21:56:21 -04:00
Michael DeHaan 153f3932b5 reinstate delete_remote_files 2012-07-23 21:30:09 -04:00
Michael DeHaan 632a83c79e Remove unused function 2012-07-23 21:28:18 -04:00
Michael DeHaan 479f8b8c26 Templating neccessary here. 2012-07-23 21:10:16 -04:00
Michael DeHaan 9b8793e42e Fix a glitch with daisy chain logic 2012-07-23 21:01:59 -04:00
Michael DeHaan 183330a9fa Merge pull request #662 from tima/regex-cond-tasks
Importing re in runner for doing conditional tasks using pattern matching i.e. re.search(). Also conditionally outputting item when skipping.
2012-07-23 17:52:52 -07:00
Michael DeHaan cbea17e4c5 Fix up async 2012-07-23 20:46:35 -04:00
Michael DeHaan cac7afd700 async is under construction 2012-07-23 20:06:18 -04:00
Michael DeHaan 1f44c07ddf Fix assemble usage, some issues still with async. 2012-07-23 19:40:21 -04:00
Timothy Appnel 4b9b9a8a5b Importing re in runner for doing conditional tasks using pattern matching i.e. re.search(). Also conditionally outputting item when skipping. 2012-07-23 19:36:26 -04:00
Michael DeHaan ec12cc4154 Save the transfer of the module file for new style modules, because we can inject the arguments into the modules.
Module consumers using the API don't have to know how this works.  base64 stuff is only there
because escaping a docstring inside a docstring was a bit of a challenge :)
2012-07-23 19:18:45 -04:00
Michael DeHaan 0b891fc8fb Tweaking daisychain internals to allow get_url to modify the path destination when downloading to a directory.
Minor module refactoring.
2012-07-22 11:08:16 -04:00
Michael DeHaan d76c8c9c85 Various cleanup around runner's constructor and how daisy chaining is invoked. 2012-07-21 16:51:31 -04:00
Michael DeHaan 1682dd06c0 Avoid duplicate call to fetch inventory variables 2012-07-21 16:23:00 -04:00
Michael DeHaan 54c9c1e25c Some streamlining of first_available_file code 2012-07-21 16:15:36 -04:00
Michael DeHaan 2d06ee4c0d Fix some subtle things that were keeping 'hostvars' from being usable in templates. 2012-07-20 12:34:26 -04:00
Michael DeHaan 2b6d8a8be5 Fix some issues with the setup cache 2012-07-20 11:58:08 -04:00
Michael DeHaan 5a67a556cd Script to migrate YAML users to the INI format, so we can deprecate YAML inventory (which we are now doing). 2012-07-20 11:15:57 -04:00
Michael DeHaan dcca08b27b Don't let with_items erase 'hostvars' 2012-07-20 10:02:35 -04:00
Michael DeHaan db1a4d8fac Make 'assemble' use the new daisychain logic 2012-07-20 09:17:42 -04:00
Michael DeHaan 6fb74ae2f9 preserve 'changed' attributes in daisychain logic 2012-07-20 09:13:10 -04:00
Michael DeHaan d72c0c8898 replace module daisy-chaining logic 2012-07-20 08:57:50 -04:00
Michael DeHaan 6e84374c2a Make hostvars work post refactoring 2012-07-20 08:29:44 -04:00
Michael DeHaan b0eedfbf92 Merge pull request #639 from goozbach/issue-627
improved output in with_items fixes: #627
2012-07-20 16:36:49 -07:00
Derek Carter 34e2584220 improved output in with_items fixes: #627 2012-07-20 14:01:54 -04:00
Michael DeHaan 9006d4557d Added code to allow insertion of boilerplate into modules to make them able to share lots of code, the result
should be a huge reduction of total ansible source, at a slight cost of difficulty in original module development.

We need to apply this now to all modules, but may need to have some exemptions to things like command, which should
subclass this module.
2012-07-17 22:34:52 -04:00
Michael DeHaan 8bb8314d10 Inject vars need to pushed further up to make with_items work as desired. 2012-07-17 20:09:18 -04:00
Dave Hatton 72ca9e58e7 meaningful messages if the remote md5 fails 2012-07-17 09:14:16 +01:00
Michael DeHaan 0edd0d4736 Fixing template calls 2012-07-16 20:26:39 -04:00
Michael DeHaan 5f69c557b9 Fix for the way host variables were being swallowed, plus some overall simplification. Deciding what
dictionary to use for templating now happens in exactly one place (executor_internal) and the "inject"
dictionary is passed to what needs it.
2012-07-15 14:19:11 -04:00
Dave Hatton c3205595b3 format fixes to make fetch more usable 2012-07-16 11:43:37 +01:00
Michael DeHaan 80edea2934 with_items handling code should apply to all modules, was screwed up in refactoring to only apply to 'normal'
modules.
2012-07-15 12:51:56 -04:00
Michael DeHaan 1754de3335 Misc code cleanup, mostly whitespace preferences, removing unused imports, plus a few fixes here and there. 2012-07-15 12:29:53 -04:00
Michael DeHaan 4b73931351 misc code cleanup, don't pass parameters to the connection object we can already get from Runner 2012-07-15 11:54:39 -04:00
Michael DeHaan 1d8bb17785 misc code cleanup 2012-07-15 10:57:22 -04:00
Michael DeHaan 5a63a48e6b No need to feed variables into the setup module for preservation since the file is no longer saved to disk. 2012-07-15 10:24:38 -04:00
Michael DeHaan 227c500ad7 Misc cleanup/formatting 2012-07-15 10:22:15 -04:00
Michael DeHaan 867b2437cc consolidate output code in callbacks.py, from utils, remove extra functions 2012-07-15 10:12:49 -04:00
Michael DeHaan cb55cd6f8d removed unused function 2012-07-15 09:33:22 -04:00
Michael DeHaan 68a9adc1be Indentation cleanup (partial) 2012-07-15 09:32:47 -04:00
Michael DeHaan 244b923559 No longer need to calculate setup metadata location since we don't write
the setup file to disk.
2012-07-15 09:25:17 -04:00
Michael DeHaan 64c51ade1e Change the way we do with_items to make them happen next to each other in runner, which eliminates the problem of with_items and vars_files sometimes not playing nice with each other.
(Also a fix for the user module error handling when the user
is not present at the time of the return.  This can only really be caused by multiple ansible executions).
2012-07-14 19:18:33 -04:00
Michael DeHaan 931f9f1a61 Setup module no longer saves to disk, as templates are mostly useful in playbooks and this allows lots of simplifications
around file pathing and removes occasional permissions conflicts depending on how things are used.
2012-07-14 11:59:12 -04:00
Dave Hatton 55694db7c3 switch to hashlib.md5 or md5 instead of OS md5 commands 2012-07-09 08:52:00 +01:00
Michael DeHaan 0d28466b22 When sudo'ing to root, keep the setup file location as /etc/ansible/setup 2012-07-07 09:29:03 -04:00
Michael DeHaan c2b8fabf66 Take a remote md5sum before a file transfer to decide whether to transfer the file or not.
Allows for efficient transfer of large files.  Templates do not sample first because they are small.
2012-07-07 09:10:18 -04:00
Michael DeHaan 8220d57690 Clean up md5 functions + make the fetch module stay happy if the remote file does not exist. 2012-07-07 08:47:32 -04:00
Michael DeHaan e3aba7770f Merge pull request #518 from brainpage/devel
adds 'groups' variable, essentially making hosts file accessible as a var
2012-07-04 11:28:46 -07:00
alex f72b1f4fd7 Fixed: pathname for tmp 2012-07-02 22:04:56 +02:00
alex bbf2939063 Fixed: executing templates outside playbooks 2012-07-02 21:34:11 +02:00
Jonathan Palley cedbcfcc0a adds 'groups' variable, essentially making hosts file accessible as a variable 2012-07-01 15:04:53 +08:00
Michael DeHaan efac68b636 Remove the -D module debug flag, which no longer is functional due to sudo pty requirements, and replace with -v/--verbose.
This flag will show playbook output from non-failing commands.  -v is also added to /usr/bin/ansible, but not  yet used.

I also gutted some internals code dealing with 'invocations' which allowed the callback to know what module invoked
it.  This is not something 0.5 does or needed, so callbacks have been simplified.
2012-06-19 21:57:43 -04:00
Daniel Hokka Zakrisson f5ecd075f7 Remove unnecessary parse_json invocation 2012-06-20 14:54:36 +02:00
Michael DeHaan bd653c8f3c Merge pull request #488 from dhozac/jinja2-env
Create a Jinja2 environment allowing includes
2012-06-19 13:09:02 -07:00
Seth Vidal 1ec518543e make Runner options conflict errors raise AnsibleErrors not traceback in general
add catch if -c ssh and -k are passed at the same time since the ssh connection type doesn't
support passwords
2012-06-18 15:48:19 -04:00
Daniel Hokka Zakrisson 9f93839d13 Create a Jinja2 environment allowing includes 2012-06-17 22:18:08 +02:00
Daniel Hokka Zakrisson 13b814a33c Run templating function until the text doesn't change
This allows variables to contain other variables.
2012-06-16 12:51:19 +02:00
Jonte Norman 1b091a7e3e Fixed typo from results to result in _execute_raw method 2012-06-15 22:45:47 +02:00
Fred Alger 834f6a216d Make shell outs to md5sum work on FreeBSD and OS X
Tested with OS X local connection and Linux remote. The paths to the
md5sum and md5 commands are hardcoded to the most common location. This
will definitely fail if the commands are elsewhere, or if the md5
command doesn't support the -q 'quiet' option.
2012-06-15 00:04:01 -04:00
Michael DeHaan 2a8d1f07d4 Merge branch 'mktemp-vanish' of https://github.com/dagwieers/ansible into devel
Conflicts:
	lib/ansible/runner/__init__.py
2012-06-13 22:39:58 -04:00
Michael DeHaan 2a49438c37 Merge pull request #461 from dhozac/only_if-early
Evaluate only_if early
2012-06-13 19:19:25 -07:00
Stephen Fromm 9cf182c225 Add assemble module
This adds a module that concatenates (ie. assembles) a file from
fragments in a directory in alphabetical order.  It chains the file
module afterward to fix up ownership and permission.  This also adds
tests for the assemble module with fragments in assemble.d.
2012-06-11 23:09:54 -07:00
Daniel Hokka Zakrisson 7942570411 Fix on_unreachable invocation with non-existing variable 2012-06-11 15:15:29 +02:00
Daniel Hokka Zakrisson eba81ee36f Evaluate only_if early to do as little work as possible 2012-06-11 15:15:29 +02:00
Matt Goodall c1b38f62c8 Search multiple paths for modules.
Minimal change to allow a list of paths (separated by the typical path
separator) to be searched in sequence for the named module.
2012-06-10 16:22:59 +01:00
Michael DeHaan 01387520e9 Merge pull request #451 from phred/fix-fetch-module
Make 'fetch' test for local directories before creating.  Fixes issue #450
2012-06-08 12:06:02 -07:00
Michael DeHaan e265cdfa1d Merge pull request #454 from jhoekx/configure-python-interpreter
Introduce ansible_python_interpreter variable.
2012-06-08 12:03:40 -07:00
Daniel Hokka Zakrisson d0d036fd3f Expand $item for copy and fetch 2012-06-08 01:36:52 +02:00
Jeroen Hoekx 1f63c47738 Introduce ansible_python_interpreter variable.
This allows configuration of the correct python interpreter on the managed system.
2012-06-07 09:50:38 +02:00
Dag Wieërs b3b22c41e9 Get rid of mktemp dependency to support AIX
The function call has been renamed to better reflect what it does, and we
reduced the number of calls from two to one in case the remote user is not
root.

This patch also fixes a string concatenation in _copy_module() that
should use os.path.join() instead.

This closes #436
2012-06-06 14:47:47 +02:00
Fred Alger bee04de26a Fix exception in fetch module when src or dest parameter omitted. 2012-06-05 11:35:19 -04:00
Fred Alger d0c4f4015c Fix remote md5 in fetch module, related to Issue #450 2012-06-05 11:35:19 -04:00
Fred Alger 51b460e8c6 Make 'fetch' test for local directories before creating. Fixes issue #450 2012-06-05 10:38:12 -04:00
Michael DeHaan 16f0d7b333 Revert "Get rid of mktemp dependency to support AIX"
This reverts commit 4ad1b57b52d735393f6c6bcbd5524b947134fbf9.
2012-05-31 21:59:31 -04:00
Michael DeHaan 99430fa0a3 Fix for older version of sudo + some changes to imports so tests are happy 2012-05-31 21:44:56 -04:00
Dag Wieers a8fd6ee9c3 Get rid of mktemp dependency to support AIX
The function call has been renamed to better reflect what it does, and we
reduced the number of calls from two to one in case the remote user is not
root.

This patch also fixes a string concatenation in _copy_module() that
should use os.path.join()

This closes #436
2012-05-31 17:02:10 +02:00
Michael DeHaan ecb944892d Tweaks on previous refactoring of playbook, version bump a 0.4 reference, remove some debug, etc 2012-05-26 01:20:53 -04:00
Michael DeHaan cf9ddf3a30 Reorganizing file structure. Not done. 2012-05-25 19:34:13 -04:00