Commit graph

72 commits

Author SHA1 Message Date
Michael DeHaan
7ed734dfb2 move callbacks to seperate file, anticipating callbacks for Runner() as well 2012-03-21 22:18:57 -04:00
Michael DeHaan
e89131a3a2 playbooks -- Ratchet up logging prior to gating things with verbosity controls and upgrading output format 2012-03-20 22:37:51 -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
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
5371a9e497 Regression tests for playbooks, logging the events they call via callbacks. 2012-03-18 19:25:56 -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
fde7de80df Remove "import *" from bin/ansible so we can use pyflakes, and remove unneeded imports in the process 2012-03-18 17:41:44 -04:00
Michael DeHaan
a4b8cdf8b3 Remove "import *"'s from bin/ansible-playbook code so pyflakes will be usable. 2012-03-18 17:32:36 -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
db61e8f346 Fix -t tree mode so it writes out the value for each host, not everything, once again 2012-03-13 21:38:06 -04:00
Michael DeHaan
e6f175e929 Allow the SSH timeout to be passed to playbooks just like it already could with /usr/bin/ansible 2012-03-13 21:35:34 -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
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
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
85e0de5bb2 Move print statements out of playbook.py and back into CLI so we can simplify playbook operations
independent of output, and can also see all the output nicely grouped together if we want
to reformat it or make summaries of statistics.
2012-03-06 19:24:36 -05:00
Michael DeHaan
eaa7714ff8 Laying the groundwork for async mode, async status script still needs to be done, and async_wrapper
still needs to daemonize.  Then, once done, playbook can be taught how to poll async within the
timing window.
2012-03-03 12:25:56 -05:00
Michael DeHaan
cbfabcd0fb Add -i, -k, and -M to ansible-playbook CLI to match options in /usr/bin/ansible 2012-03-02 22:54:25 -05:00
Michael DeHaan
6541f338df add pyflakes target & associated fixes. Also decided to save JSON to --tree file so it can
be better used programatically.  May have to come up with another system of tree logging for
playbook if playbook decides to have tree logging.  Presumably not the highest priority.
2012-03-02 22:10:51 -05:00
Michael DeHaan
c57df6220b Add pydoc to playbook binary, fix default types for playbook '.get()' call 2012-03-02 21:20:37 -05:00
Michael DeHaan
bf967adf83 Added pydoc for functions in Cli() 2012-03-02 21:11:43 -05:00
Michael DeHaan
e9a24cdad4 Extensive refactoring of bin/ansible, moving most output functions into lib/ansible/utils to
encourage readability and make things more maintainable.
2012-03-02 21:08:48 -05:00
Michael DeHaan
b33ef0de60 Add a newline in output here, possibly considering printing top level keys flat 2012-03-02 19:52:43 -05:00
Michael DeHaan
e6a1acf756 Let "all" be an alias for "*" in patterns, fix output bug on non-command execution, make clean now removes the build dir 2012-03-02 19:44:50 -05:00
Michael DeHaan
847846af0e -p has been replaced by a required option. Various docs changes. 2012-03-01 22:10:47 -05:00
Michael DeHaan
4ce1f1dd5e README/doc/example updates to go with group support and CLI option changes.
Minimizing manpage until CLI options stabilize.
2012-03-01 21:18:32 -05:00
Christopher Johnston
d15172abdc add a -T option for setting ssh timeout in seconds 2012-03-01 16:54:17 -08:00
Christopher Johnston
2773234c3f python 2.5 does not include json so lets try to use simplejson 2012-02-29 09:30:02 -08:00
Michael DeHaan
a40ac93716 Plan to merge things back into ansible means we can simplify our code tree
by eliminating the lib/ansible/scripts file.  Ansible-playbook
doesn't have enough options to need it's own thing, and we're going to try
to work most things back into bin/ansible
2012-02-28 04:20:25 -05:00
Michael DeHaan
1427ade3af Have ansible yell if no module name is supplied 2012-02-28 04:00:31 -05:00
Michael DeHaan
edf6da5c38 Rename opts so --help looks cleaner 2012-02-28 03:57:43 -05:00
Michael DeHaan
281f96b8dd merge Seth's ansible-command script with ansible proper, so we can do nice output, one line output,
and treeish saving everywhere.

there are probably some quirks here we'll want to refine further later, for instance, we should
be able to do nicer things with "can't contact host tracebacks".
2012-02-28 03:54:41 -05:00
Michael DeHaan
0356925639 Rename ans-command to ansible-command and ans-playbook to ansible-playbook so my brain
can tab complete better
2012-02-28 22:08:31 -05:00
Michael DeHaan
430f38d54c minor option consistency 2012-02-28 02:41:32 -05:00
Michael DeHaan
ab17f6f44e Because I can't remember which options are supposed to be uppercase and which are not,
rename all of them so we can use non-conflicting lowercase.  Manpage updates pending
2012-02-28 02:38:36 -05:00
Michael DeHaan
79d91e024b Updates to ansible-playbook helper program 2012-02-28 02:25:34 -05:00
Michael DeHaan
42767b30fe Fix output on failed hosts 2012-02-28 02:11:51 -05:00
Michael DeHaan
b9b0240543 Continued ans-command output upgrades, fixed output_dest back again 2012-02-28 02:03:07 -05:00
Michael DeHaan
d6dcaefa9f Some code refactoring + output upgrades 2012-02-28 01:59:21 -05:00
Michael DeHaan
859c572de8 always show return codes (seems like a reasonable thing to do), make one line output slightly more
obvious
2012-02-28 01:46:02 -05:00
Michael DeHaan
cc2d3e0f1a Fix my error from not removing this parameter 2012-02-28 01:40:56 -05:00
Michael DeHaan
7553981ca2 ok I see output_dest was actually used but IMHO this should be something we use the shell for, i.e. output to stdout and redirect, using tee if neccessary 2012-02-28 01:39:47 -05:00
Michael DeHaan
f72bded2e5 Merge branch 'master' of github.com:mpdehaan/ansible 2012-02-28 20:44:24 -05:00
Michael DeHaan
34b72d02ea remove unused option 2012-02-28 20:44:12 -05:00
Michael DeHaan
4ba366c2d1 Require that ansible managed hosts be in the list of hosts to manage to avoid
option overload.
2012-02-28 01:34:28 -05:00
Michael DeHaan
01e5da6d0b Make /bin/ansible use the common options from lib/ansible/scripts
DRY!
2012-02-28 01:33:22 -05:00