Commit Graph

142 Commits (6a7aac38c5d468126ebc45af984a2deb80773616)

Author SHA1 Message Date
Michael DeHaan 6a7aac38c5 misc cleanup in the runner module, splitting some things out into utils, breaking up functions into smaller functions. 2012-03-21 23:39:09 -04:00
Michael DeHaan 7ed734dfb2 move callbacks to seperate file, anticipating callbacks for Runner() as well 2012-03-21 22:18:57 -04:00
Michael DeHaan 7883f414ce unused module 2012-03-21 21:03:32 -04:00
Michael DeHaan e6406fa5a7 Allow variable expressions to be stored as variables themselves, do some things to allow setup strings
to more easily contain spaces without being mangled, which is neccessary because of the above.
2012-03-21 20:00:48 -04:00
Michael DeHaan a5f4ca50b8 Ratchet up logging a few notches prior to controlling w/ verbosity settings 2012-03-20 22:29:21 -04:00
Michael DeHaan b5c62ec068 Enhance logging, way to gate verbosity levels pending. 2012-03-20 21:44:01 -04:00
Michael DeHaan dfbe591cc0 Add "only_if" capability, which allows task steps to be skipped if they do not match a conditional. 2012-03-20 19:55:04 -04:00
Michael DeHaan 149cc57b0f remove unneeded code 2012-03-19 23:54:47 -04:00
Michael DeHaan c05e7fd83e Fix typing issue 2012-03-19 22:46:54 -04:00
Michael DeHaan 4de7bbb169 Allow conditional imports, see examples/playbook3.yml comments for a full explanation. Extensive
refactoring of playbooks now warranted, which we'll do before we move on.   This variable assignment
system makes nearly all possible magic possible, for we can use these variables however we like,
even as module names!
2012-03-19 22:42:31 -04:00
Michael DeHaan 5ed2b894d9 Add an additional way to dereference a variable in a playbook, $foo
(Using varReplace function originally from yum, thanks Seth)
2012-03-19 19:32:38 -04:00
Michael DeHaan af9596307d Move templating into a utils function. Reuse is our friend. 2012-03-19 19:23:14 -04:00
Michael DeHaan c1fe0dd719 Quote long variables in playbooks when feeding them to the setup command 2012-03-18 19:50:22 -04:00
Michael DeHaan 5371a9e497 Regression tests for playbooks, logging the events they call via callbacks. 2012-03-18 19:25:56 -04:00
Michael DeHaan 45abe3c16b Add unit tests for playbooks, and fix an error caught by one 2012-03-18 18:29:11 -04:00
Michael DeHaan 9c5ec886a6 Import cleanup, plus have /bin/ansible remind you if no hosts were matched by a pattern (for instance, assume
there was a typo in the pattern)
2012-03-18 17:53:58 -04:00
Michael DeHaan 9e07b24239 Fix indentation 2012-03-18 17:25:22 -04:00
Michael DeHaan 6777268f4c Fixup the code that allows facter/ohai/other data to bubble up and be used in future action lines. It's a niche
case compared to usage in templates but it should work and will be wanted later for conditional support.
2012-03-18 17:24:09 -04:00
Michael DeHaan c861e0de55 Fix "import *" and resultant new things detectable from "make pyflakes" 2012-03-18 17:16:12 -04:00
Michael DeHaan 33aa50eae7 Inside of runner, do not 'import *' from utils, so we can more easily tell where functions come from 2012-03-18 17:04:07 -04:00
Michael DeHaan 9837a616eb Preserve changed data on file and template ops when the mode operations don't result in a change but the files
were still replaced.
2012-03-18 16:58:00 -04:00
Michael DeHaan 5905974737 Fix variable referenced before assignment when not using external variables script 2012-03-31 11:03:29 -04:00
Michael DeHaan 3495d402c7 Default for class variable 2012-03-31 11:02:10 -04:00
Michael DeHaan 9f6d98844e If the inventory file is EXECUTABLE, treat it as a file returning JSON, if called directly, return the host
and groups list.  If called with an argument of a host name, return the key=value data for that particular
host.
2012-03-30 19:06:14 -04:00
Michael DeHaan f39944b89b Update example to use correct service state; minor pep8 indent/spacing fixes 2012-03-15 23:10:03 -04:00
Michael DeHaan 24923c2e17 Purge unused imports per pyflakes 2012-03-15 23:06:59 -04:00
Michael DeHaan 63818000b4 auto call the file module after copy/template module usage in runner
note some changed=True/False detection bits in file module still need tweaking
2012-03-15 22:32:14 -04:00
Michael DeHaan be55145a1e Initial crack at the file module 2012-03-15 21:53:14 -04:00
Michael DeHaan 1a0672fd1e Fix exception type 2012-03-14 12:51:26 -04:00
Michael DeHaan c909b66864 use iteritems vs items(), probably doesn't matter that much 2012-03-14 21:56:49 -04:00
Michael DeHaan 4bde4926c3 Modules don't have to return JSON, key=value pairs is ok. 2012-03-14 21:16:15 -04:00
Michael DeHaan 40fd778e2c 'shell' is a magic module that executes the command module with shell=True 2012-03-14 20:40:06 -04:00
Michael DeHaan e8751baaf3 Remove remote log function as it's only used in one place now 2012-03-14 20:00:09 -04:00
Michael DeHaan 696b67f935 Fix async to use the new argfiles method (wrapping brain around rock, really must write module development guide) 2012-03-14 19:57:56 -04:00
Michael DeHaan 3ea9174ed7 Split argsfile handling into subfunction, attempt to apply argsfile logic to setup 2012-03-14 19:05:19 -04:00
Seth Vidal a9948f97c6 convert runner to use an args file rather than just arguments passed
on the command line
2012-03-14 18:46:33 -04:00
Michael DeHaan e3b4981feb Various additions to make sure timed out and failed hosts are taken out of the playbook even if failed
during setup, async tasks, or poll operations.  This introduced some redundancy so I've made some
notes in the code where things need to be refactored to remove them.
2012-03-13 21:30:34 -04:00
Michael DeHaan 4ae98ed92d Upgrades to error handling, now general try/catch available. 2012-03-13 20:59:05 -04:00
Michael DeHaan 09a7119e74 Annotate more files, fix missing imports messing with playbooks. Hey Tim, please test your stuff :) 2012-03-13 19:19:54 -04:00
Tim Bielawa dfd2c6dce3 Implement friendlier error handling.
Generic AnsibleError exception + host inventory missing exception.
First shot at catching these in a generic way in bin/ansible*.
2012-03-12 23:11:54 -04:00
Michael DeHaan ce85222fa6 What we are running is actually a "play" (multiple plays per playbook) so rename the function to make it more clear 2012-03-12 22:05:51 -04:00
Michael DeHaan adf1492da2 Add external vars example 2012-03-12 22:03:20 -04:00
Michael DeHaan e582bd5ec5 Add fire and forget example 2012-03-12 21:02:38 -04:00
Michael DeHaan 86e19cd8c8 This adds async poll support to playbooks. See examples. Some more testing due + docs
but this is more or less a mirror of what /bin/ansible does.  It also has a 'fire and
forget' mode if the poll interval is left off or set to 0.
2012-03-12 20:53:10 -04:00
Michael DeHaan db7ba87111 Add polling logic in runner such that all actions get kicked off everywhere then polling
happens only on needed hosts, allowing some hosts to fail and drop out of the running.
2012-03-11 20:54:54 -04:00
Michael DeHaan 49a636d8a0 Fixed up async and polling logic. 2012-03-11 19:27:43 -04:00
Michael DeHaan 5be1a612d3 Add async polling logic to runner. Will add to playbook shortly, have to diagnose why paramiko
is not letting async_wrapper daemonize itself when it does work fine when directly executed.
2012-03-11 18:40:35 -04:00
Michael DeHaan 60a13cf540 Ignore commented out lines in the ansible setup files. 2012-03-10 21:19:41 -05:00
Michael DeHaan 4c9dd972b4 Fixes for output formatting 2012-03-10 13:40:08 -05:00
Michael DeHaan bb5e4fad48 Abstracted out transport from implementation so it can be pluggable. Also fixes for output format. 2012-03-10 13:35:46 -05:00