Commit Graph

129 Commits (eb41bfd3c81348e6c616f1e7c675c07b0eaf04c5)

Author SHA1 Message Date
Jeroen Hoekx 74ae4b29ad Add a debug attribute to Runner/Playbook.
This prints the stderr of the executed modules on local stderr.
Most methods on Runner now return a fourth "err" parameter.
2012-03-31 09:32:13 +02:00
Jeroen Hoekx fb1a313974 Correct default user and port in playbook.
They are set in the constructor.
2012-03-31 09:11:07 +02:00
Michael DeHaan 3ded27fe35 Treat module args as strings everywhere to avoid unneccessary shlex and requoting 2012-03-30 22:47:58 -04:00
Michael DeHaan f11de2f5c9 --extra-vars option for ansible-playbook
Conflicts:

	lib/ansible/playbook.py

Removed unneccessary shlex and replaced with basic split, some repurcussions in runner
that can be eliminated once we consistently pass args as a string (soon).
2012-03-30 22:29:06 -04:00
Matthew Williams ec6f488d1f shell quoting fixes
(edited author's original commit comment -- MPD)
2012-03-30 21:57:33 -04:00
Matthew Williams 99d5796605 support for quotes strings in command module (via posix=False), related fixes to keep other things from breaking 2012-03-30 21:57:33 -04:00
Michael DeHaan 2372a3b734 Sudo support operational in both playbooks and main program. Implementation could use some cleanup. 2012-03-29 22:59:29 -04:00
Michael DeHaan 4971101f27 Handler doesn't take this param. 2012-03-28 20:33:44 -04:00
Michael DeHaan b30ddc4520 Expose remote_port option in playbook 2012-03-28 19:31:17 -04:00
Christopher Johnston 68818ad1fe add support for remote ports in playbooks 2012-03-28 15:02:50 -07:00
Christopher Johnston f06ec76fdb add support for using an alternate remote port 2012-03-28 14:05:31 -07:00
Michael DeHaan 95670ce6b5 remove unused function 2012-03-26 21:58:28 -04:00
Michael DeHaan 35d77d0433 Make it an error to try to hit a change handler that doesn't exist 2012-03-26 21:31:48 -04:00
Michael DeHaan eb67a91c57 Merge remote branch 'public/master' 2012-03-26 19:36:03 -04:00
Michael DeHaan aaafd12b59 rm FIXMEs 2012-03-26 19:35:53 -04:00
Jeroen Hoekx a370261dce Playbook: create one task per include instead of per argument. 2012-03-26 10:30:48 +02:00
Michael DeHaan 6dda6f12dc Applying callback model to runner, and using that in playbooks, so output can be more immediate in playbooks.
(Runner still does not use callbacks for default output)
2012-03-25 19:05:27 -04:00
Michael DeHaan ab55fa4266 Revert "Only override the pattern if it is ommitted"
This reverts commit bb0bf9eef4.
2012-03-24 16:21:44 -04:00
Michael DeHaan bb0bf9eef4 Only override the pattern if it is ommitted 2012-03-24 16:20:47 -04:00
Michael DeHaan 9df612f007 Add a "-o" override option so hosts not in a playbook can still be managed by a playbook. 2012-03-24 16:19:38 -04:00
Michael DeHaan 292ac4aad2 Make it such that the 'name' element of each playbook line is optional. 2012-03-23 21:06:54 -04:00
Michael DeHaan 44d4dede92 Split conditional imports in playbook into subfunction, fix small bug in event reporting on playbook
actions.
2012-03-23 21:03:25 -04:00
Michael DeHaan b43019f3a1 In playbooks, a return code (rc) of non-zero should fail the playbook. 2012-03-23 20:53:57 -04:00
Michael DeHaan 6ab615c724 Code cleanup for playbooks, also added 'on_skipped' callback 2012-03-23 20:51:26 -04:00
Seth Vidal 53446d6d45 make sure the setup step in a playbook has the sshpass included 2012-03-23 16:41:44 -04:00
Michael DeHaan a8c921cbcc Allow groups to be passed to runner API to make parse_hosts optional, misc fixes as a result of refactoring in Runner.
Cleanup in Playbooks module is next.
2012-03-22 00:30:05 -04:00
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 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 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 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 c861e0de55 Fix "import *" and resultant new things detectable from "make pyflakes" 2012-03-18 17:16:12 -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 c909b66864 use iteritems vs items(), probably doesn't matter that much 2012-03-14 21:56:49 -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 09a7119e74 Annotate more files, fix missing imports messing with playbooks. Hey Tim, please test your stuff :) 2012-03-13 19:19: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 8e20ed3714 src= parameters for template and copy operations can be relative to the playbook (for /usr/bin/ansible-playbook) or current directory (for /usr/bin/ansible) 2012-03-06 21:13:50 -05:00
Michael DeHaan 7eedc3fb1a Breakout includes into seperate functions, allow vars to apply to handlers but handlers
still may not be parameterized because it does not make sense to import them more than
once since they are keyed by name.
2012-03-06 21:01:05 -05: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 0935506d6f Templating as non-root should not require passing in the metadata= parameter. 2012-03-05 22:23:56 -05:00
Michael DeHaan 4ee4ddcd7c Parameterized include statements can see top level variables and also be passed specific variables!
Code needs cleanup, but works
2012-03-05 22:00:22 -05:00
Michael DeHaan 8d57ceecf1 Factoids and push variables via setup are now available to be templated in command args
as well as template files.  PLUS, variables are now expressed in playbooks without having
to know about the setup task, which means playbooks are simpler to read now.
2012-03-05 20:09:03 -05:00
Michael DeHaan ab408b0000 Ability to import task lists and handler lists from a top level playbook file. It is possible
to use multiple import statements to implement 'class' like behavior, and also to share
a common list of handlers between multiple patterns.
2012-03-03 10:53:15 -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 e4304a0ac5 Make sure tempdirs are cleaned up after execution steps, fix notifiers, make sure
service module is installed by setup.py
2012-03-02 22:38:55 -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 3ad9db4966 Some minor from 'pep8', and silencing the PEP8 messages I don't care about.
Also make pep8 show all messages rather than just 1 per code.
2012-03-02 22:03:03 -05:00
Michael DeHaan 0d7a84d591 Some minor refactoring of playbook code, more to go. 2012-03-02 21:43:46 -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 5040c01640 rename 'pattern' to 'hosts' in playbook format. 2012-03-01 22:20:45 -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 bed29b7e11 Allow the /etc/ansible/hosts file to contain groups and those group names to be used in place
of pattern names.
2012-03-01 20:41:17 -05:00
Michael DeHaan de1d0011bc Take darkened hosts out of the playbook rotation, fix error handling in template
module so that if a directory path is specified we get valid output
2012-02-28 02:32:14 -05:00
Michael DeHaan be4cb64c92 Relicensing to GPLv3, all previous committers ok'd on mailing list. 2012-02-28 19:08:09 -05:00
Michael DeHaan 1caafb7bd9 Stop evaluating a host in a playbook when it encounters the first failure. 2012-02-27 22:28:01 -05:00
Michael DeHaan f7cff27f3d Drastically simply playbook syntax 2012-02-26 20:54:51 -05:00
Michael DeHaan c0ac0e9b62 Added comments to explain the playbook code. 2012-02-26 20:18:42 -05:00
Michael DeHaan 78a254fc52 In playbooks, each pattern stanza can reference it's own user to run as, so you can
run things as multiple sets of users (if you want) in the same playbook.
2012-02-26 19:58:56 -05:00
Michael DeHaan 61d064d011 Fixed up KV munging in runner, misc fixes to copy, setup, and template modules 2012-02-26 19:55:26 -05:00
Michael DeHaan deb71da91e trim md5sum string so it does not contain the filename
also fix a bug/typo in the reporting from playbook
2012-02-26 12:10:57 -05:00
Michael DeHaan d308254eae A basic service module with 'ensure' idempotence semantics. Playbook updated to use service
module vs command module for restarting.  May be some bugs and requires the service to implement 'status' -- and probably some better error handling (i.e. return JSON with "failed" element if failed).

Improvements welcome.
2012-02-25 20:27:11 -05:00
Michael DeHaan b44ae0af90 applying indentation patch from skvidal 2012-02-25 17:16:23 -05:00
Michael DeHaan a5039eec62 Update reporting on playbook runs. 2012-02-25 15:21:11 -05:00
Michael DeHaan 79fdc1b6f4 Notifable handlers only run when something is changed. Awesome. 2012-02-25 14:42:41 -05:00
Michael DeHaan ba9468266f Can it get an easier? Yes it can! Further simply playbook format. 2012-02-05 13:05:09 -05:00
Michael DeHaan 6d0fd2bfde Compress the playbook format for readability 2012-02-05 12:52:07 -05:00
Michael DeHaan e25bb2f888 Upgrade output for playbook runs 2012-02-24 02:36:38 -05:00
Michael DeHaan ee2fa721f1 Kinda have to pass the host list parameter 2012-02-24 02:14:22 -05:00
Michael DeHaan 43f7dee247 Added rough sketch of what I want for playbook support. Debug heavy at the moment
as I figure out how logging/output might look.  A couple of major TODO features
also listed in the file.
2012-02-24 01:02:24 -05:00
Michael DeHaan d079c8e5f3 Move runner out of __init__.py so it's clear what classes live where. 2012-02-23 23:28:58 -05:00
Michael DeHaan 6eda2cf383 Added initial stub for where playbooks will go, moved to common
constants file so as to not repeat constants between CLI and lib.
2012-02-23 23:26:16 -05:00