Michael DeHaan
2372a3b734
Sudo support operational in both playbooks and main program. Implementation could use some cleanup.
13 years ago
Michael DeHaan
81e3496037
Added preliminary support for --sudo to ansible, playbook support and further testing pending.
13 years ago
Michael DeHaan
72cc99722d
sudo tweaks
13 years ago
Michael DeHaan
7ae75eb14b
Default sudo is false
13 years ago
Michael DeHaan
c2a6e2f97b
Work in progress on sudo, hitting some issues with paramiko saying the connection is closed.
13 years ago
Michael DeHaan
7133734d87
Remove debug statements (WIP on sudo)
13 years ago
Michael DeHaan
4971101f27
Handler doesn't take this param.
13 years ago
Michael DeHaan
706ba9fd9a
Add paramiko/pycrypto atfork workaround (can back out later if not useful), tweak error
...
message text per skvidal's suggestion
13 years ago
Michael DeHaan
b30ddc4520
Expose remote_port option in playbook
13 years ago
Christopher Johnston
68818ad1fe
add support for remote ports in playbooks
13 years ago
Christopher Johnston
15e781eb51
add exception check for paramiko if older then 1.7
13 years ago
Christopher Johnston
f06ec76fdb
add support for using an alternate remote port
13 years ago
Michael DeHaan
b1471bf857
Add more comments to the callbacks file
13 years ago
Michael DeHaan
95670ce6b5
remove unused function
13 years ago
Michael DeHaan
f9da7cb180
remove functions that are no longer used
13 years ago
Michael DeHaan
35d77d0433
Make it an error to try to hit a change handler that doesn't exist
13 years ago
Michael DeHaan
f693759252
Style fixes from pep8 makefile target
13 years ago
Michael DeHaan
f074f1c4c4
Fixes from pyflakes
13 years ago
Michael DeHaan
35c8750bbb
Fix tree view to work with callbacks
13 years ago
Michael DeHaan
45a455a805
Make /usr/bin/ansible output realtime and also delete some code!
13 years ago
Michael DeHaan
eb67a91c57
Merge remote branch 'public/master'
13 years ago
Michael DeHaan
aaafd12b59
rm FIXMEs
13 years ago
Jeroen Hoekx
a370261dce
Playbook: create one task per include instead of per argument.
13 years ago
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)
13 years ago
Michael DeHaan
ab55fa4266
Revert "Only override the pattern if it is ommitted"
...
This reverts commit bb0bf9eef4
.
13 years ago
Michael DeHaan
bb0bf9eef4
Only override the pattern if it is ommitted
13 years ago
Michael DeHaan
9df612f007
Add a "-o" override option so hosts not in a playbook can still be managed by a playbook.
13 years ago
Michael DeHaan
292ac4aad2
Make it such that the 'name' element of each playbook line is optional.
13 years ago
Michael DeHaan
44d4dede92
Split conditional imports in playbook into subfunction, fix small bug in event reporting on playbook
...
actions.
13 years ago
Michael DeHaan
b43019f3a1
In playbooks, a return code (rc) of non-zero should fail the playbook.
13 years ago
Michael DeHaan
6ab615c724
Code cleanup for playbooks, also added 'on_skipped' callback
13 years ago
Seth Vidal
53446d6d45
make sure the setup step in a playbook has the sshpass included
13 years ago
Seth Vidal
89d4bc542c
fix up minor type - AnsibleException should be AnsibleError
13 years ago
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.
13 years ago
Michael DeHaan
94605b811b
Fixes from refactoring
13 years ago
Michael DeHaan
6a7aac38c5
misc cleanup in the runner module, splitting some things out into utils, breaking up functions into smaller functions.
13 years ago
Michael DeHaan
7ed734dfb2
move callbacks to seperate file, anticipating callbacks for Runner() as well
13 years ago
Michael DeHaan
7883f414ce
unused module
13 years ago
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.
13 years ago
Michael DeHaan
a5f4ca50b8
Ratchet up logging a few notches prior to controlling w/ verbosity settings
13 years ago
Michael DeHaan
b5c62ec068
Enhance logging, way to gate verbosity levels pending.
13 years ago
Michael DeHaan
dfbe591cc0
Add "only_if" capability, which allows task steps to be skipped if they do not match a conditional.
13 years ago
Michael DeHaan
149cc57b0f
remove unneeded code
13 years ago
Michael DeHaan
c05e7fd83e
Fix typing issue
13 years ago
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!
13 years ago
Michael DeHaan
5ed2b894d9
Add an additional way to dereference a variable in a playbook, $foo
...
(Using varReplace function originally from yum, thanks Seth)
13 years ago
Michael DeHaan
af9596307d
Move templating into a utils function. Reuse is our friend.
13 years ago
Michael DeHaan
c1fe0dd719
Quote long variables in playbooks when feeding them to the setup command
13 years ago
Michael DeHaan
5371a9e497
Regression tests for playbooks, logging the events they call via callbacks.
13 years ago
Michael DeHaan
45abe3c16b
Add unit tests for playbooks, and fix an error caught by one
13 years ago
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)
13 years ago
Michael DeHaan
9e07b24239
Fix indentation
13 years ago
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.
13 years ago
Michael DeHaan
c861e0de55
Fix "import *" and resultant new things detectable from "make pyflakes"
13 years ago
Michael DeHaan
33aa50eae7
Inside of runner, do not 'import *' from utils, so we can more easily tell where functions come from
13 years ago
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.
13 years ago
Michael DeHaan
5905974737
Fix variable referenced before assignment when not using external variables script
13 years ago
Michael DeHaan
3495d402c7
Default for class variable
13 years ago
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.
13 years ago
Michael DeHaan
f39944b89b
Update example to use correct service state; minor pep8 indent/spacing fixes
13 years ago
Michael DeHaan
24923c2e17
Purge unused imports per pyflakes
13 years ago
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
13 years ago
Michael DeHaan
be55145a1e
Initial crack at the file module
13 years ago
Michael DeHaan
1a0672fd1e
Fix exception type
13 years ago
Michael DeHaan
c909b66864
use iteritems vs items(), probably doesn't matter that much
13 years ago
Michael DeHaan
4bde4926c3
Modules don't have to return JSON, key=value pairs is ok.
13 years ago
Michael DeHaan
40fd778e2c
'shell' is a magic module that executes the command module with shell=True
13 years ago
Michael DeHaan
e8751baaf3
Remove remote log function as it's only used in one place now
13 years ago
Michael DeHaan
696b67f935
Fix async to use the new argfiles method (wrapping brain around rock, really must write module development guide)
13 years ago
Michael DeHaan
3ea9174ed7
Split argsfile handling into subfunction, attempt to apply argsfile logic to setup
13 years ago
Seth Vidal
a9948f97c6
convert runner to use an args file rather than just arguments passed
...
on the command line
13 years ago
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.
13 years ago
Michael DeHaan
4ae98ed92d
Upgrades to error handling, now general try/catch available.
13 years ago
Michael DeHaan
09a7119e74
Annotate more files, fix missing imports messing with playbooks. Hey Tim, please test your stuff :)
13 years ago
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*.
13 years ago
Michael DeHaan
ce85222fa6
What we are running is actually a "play" (multiple plays per playbook) so rename the function to make it more clear
13 years ago
Michael DeHaan
adf1492da2
Add external vars example
13 years ago
Michael DeHaan
e582bd5ec5
Add fire and forget example
13 years ago
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.
13 years ago
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.
13 years ago
Michael DeHaan
49a636d8a0
Fixed up async and polling logic.
13 years ago
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.
13 years ago
Michael DeHaan
60a13cf540
Ignore commented out lines in the ansible setup files.
13 years ago
Michael DeHaan
4c9dd972b4
Fixes for output formatting
13 years ago
Michael DeHaan
bb5e4fad48
Abstracted out transport from implementation so it can be pluggable. Also fixes for output format.
13 years ago
Seth Vidal
b576e389b1
runner buglet and yum module
...
runner: fix buglet causing logger output to include a u for the command
yum: add yum module:
ensure=installed pkg=name/name.arch/name-ver-rel.arch
ensure=removed pkg=name/name.arch/name-ver-rel.arch
list=installed
list=updates
list=available
list=pkgspec
list=repos
13 years ago
Seth Vidal
19b784e480
if we've failed a connection to a host - we cannot set items to the
...
'conn' object since it is not an object on failure - it's a string.
13 years ago
Tim Bielawa
95502c3089
Adding version and author to ansible init.
13 years ago
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)
13 years ago
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.
13 years ago
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.
13 years ago
Michael DeHaan
0935506d6f
Templating as non-root should not require passing in the metadata= parameter.
13 years ago
Michael DeHaan
4ee4ddcd7c
Parameterized include statements can see top level variables and also be passed specific variables!
...
Code needs cleanup, but works
13 years ago
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.
13 years ago
Tim Bielawa
f2c2786a14
Update constants.py to pull module path and the hosts file from the
...
environment (ANSIBLE_{LIBRARY,HOSTS}) if defined.
Update manpages to represent this.
Also update the env-setup script to set ANSIBLE_{LIBRARY,HOSTS}.
13 years ago
Tim Bielawa
b190ea4b62
Fix parse_hosts to not blow up on ungrouped hosts.
13 years ago
Michael DeHaan
fae3a71899
WIP on async tests
13 years ago
Michael DeHaan
369b9cde1c
Add test for template module and make 'dark' errors clearer if we get output back and the JSON
...
is not parseable
13 years ago
Michael DeHaan
8d06c074b1
* Added uptime.py as an example of somewhat minimal API usage & reporting
...
* Pattern in API now has a default
* Fixed bug in template module operation detected from running playbook (tests for that pending)
* Workaround for multiprocessing lib being harmlessly squeaky (feeder thread got sentinel)
13 years ago
Michael DeHaan
db57933614
Allow ":" to be used to split patterns as well as ";" so if you are just using group names or fully explicit names you do not need to use shell quoting at all. Obviously if you use wildcards like "*" you wouldstill.
13 years ago
Michael DeHaan
45c40524ef
Time limit needs to be passed to async_wrapper.
13 years ago
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.
13 years ago
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.
13 years ago
Michael DeHaan
cbfabcd0fb
Add -i, -k, and -M to ansible-playbook CLI to match options in /usr/bin/ansible
13 years ago
Michael DeHaan
e4304a0ac5
Make sure tempdirs are cleaned up after execution steps, fix notifiers, make sure
...
service module is installed by setup.py
13 years ago
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.
13 years ago
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.
13 years ago
Michael DeHaan
0d7a84d591
Some minor refactoring of playbook code, more to go.
13 years ago
Michael DeHaan
c57df6220b
Add pydoc to playbook binary, fix default types for playbook '.get()' call
13 years ago
Michael DeHaan
34cbbfbfe1
Added pydoc for utils.py
13 years ago
Michael DeHaan
e9a24cdad4
Extensive refactoring of bin/ansible, moving most output functions into lib/ansible/utils to
...
encourage readability and make things more maintainable.
13 years ago
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
13 years ago
Michael DeHaan
5040c01640
rename 'pattern' to 'hosts' in playbook format.
13 years ago
Michael DeHaan
687a315a80
Increasing default --forks to 5
13 years ago
Michael DeHaan
847846af0e
-p has been replaced by a required option. Various docs changes.
13 years ago
Michael DeHaan
bed29b7e11
Allow the /etc/ansible/hosts file to contain groups and those group names to be used in place
...
of pattern names.
13 years ago
Christopher Johnston
d15172abdc
add a -T option for setting ssh timeout in seconds
13 years ago
Christopher Johnston
2773234c3f
python 2.5 does not include json so lets try to use simplejson
13 years ago
Michael DeHaan
ab266472be
Trim errors on connection refused messages
13 years ago
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
13 years ago
Michael DeHaan
430f38d54c
minor option consistency
13 years ago
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
13 years ago
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
13 years ago
Michael DeHaan
01e5da6d0b
Make /bin/ansible use the common options from lib/ansible/scripts
...
DRY!
13 years ago
Michael DeHaan
fb531a8dfa
Minor option string relabelling, move one option from common into helper script
13 years ago
Michael DeHaan
7de661dd2c
Add ansible command, fix import error in runner
13 years ago
Michael DeHaan
0321afb1e3
Minor error handling tweaks (yell if no args) for ansible-command and some minor
...
style bits (underscores between compound words, use dest always in optparse)
13 years ago
Michael DeHaan
a3a426b4c5
Add GPLv3 license headers to new files. Approved by all contributors on mailing list.
13 years ago
Michael DeHaan
5eea593af5
Merge branch 'master' of github.com:mpdehaan/ansible
13 years ago
Michael DeHaan
be4cb64c92
Relicensing to GPLv3, all previous committers ok'd on mailing list.
13 years ago
Michael DeHaan
0ed3e87792
Merge pull request #40 from skvidal/master
...
ans-command
13 years ago
Seth Vidal
95706af074
ans-command and scripts.py for the basic cli parser to be imported elsewhere
13 years ago
Michael DeHaan
1caafb7bd9
Stop evaluating a host in a playbook when it encounters the first failure.
13 years ago
Seth Vidal
85f751175d
- make tmp_path be a dir so we can put more than one command in there securely
13 years ago
Seth Vidal
bd7a71bb29
implement manual multiprocessing pools for the runner.
...
this fixes the ctrl-c not-working problem.
implemented this solution: http://www.bryceboe.com/2010/08/26/python-multiprocessing-and-keyboardinterrupt/#georges
also add hosts which do not get a chance to return results to the 'dark' results.
13 years ago
Seth Vidal
1a20b00d1f
If the error is an authentication exception - just report it that way don't dump out an unappetizing traceback which just says the same
13 years ago
Michael DeHaan
f7cff27f3d
Drastically simply playbook syntax
13 years ago
Michael DeHaan
fc4ba46d1a
Add a ton of comments so folks can understand what runner does. More refactoring is
...
certaintly possible too.
13 years ago
Michael DeHaan
c0ac0e9b62
Added comments to explain the playbook code.
13 years ago
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.
13 years ago
Michael DeHaan
61d064d011
Fixed up KV munging in runner, misc fixes to copy, setup, and template modules
13 years ago
Michael DeHaan
e5f62f20b1
make copy & template module take key/value parameters so we're consistent. Only the command
...
module works differently now
starter manpage for modules
allow template file location to be passed into template & setup modules
13 years ago
Michael DeHaan
deb71da91e
trim md5sum string so it does not contain the filename
...
also fix a bug/typo in the reporting from playbook
13 years ago
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.
13 years ago
Michael DeHaan
cb90df2377
Allow multiple patterns to specified, just like Func did.
13 years ago
Michael DeHaan
b44ae0af90
applying indentation patch from skvidal
13 years ago
Michael DeHaan
a5039eec62
Update reporting on playbook runs.
13 years ago
Michael DeHaan
79fdc1b6f4
Notifable handlers only run when something is changed. Awesome.
13 years ago
Michael DeHaan
de80166b6d
Misc refactoring, updated TODO to reflect new templating features being completed
13 years ago
Michael DeHaan
ba9468266f
Can it get an easier? Yes it can! Further simply playbook format.
13 years ago
Michael DeHaan
6d0fd2bfde
Compress the playbook format for readability
13 years ago
Michael DeHaan
b053df4182
Some refactoring of runner.py -- more to come to eliminate repeated code
13 years ago
Michael DeHaan
6cceaa5f6a
Implment copy with an actual minion-side module such that we can get md5sum's and
...
onchange events like Puppet's file providers do.
13 years ago
Michael DeHaan
440bac4a95
Added remote templating engine using jinja2, see examples/playbook.yml for usage.
...
Cleanup is due in runner.py
13 years ago
Michael DeHaan
5d6b0280d5
Added stub for template execution, WIP.
13 years ago
Seth Vidal
160470bc49
- add match_hosts() method to runner.Runner()
...
- add pattern parameter to self._matches() and match_hosts() so you can query
for matches against the host list
- these are useful when writing scripts and you want to tell the user
what hosts you will be running on before actually executing anything.
13 years ago
Seth Vidal
e7bb41ff89
simple logging setup using logger.
...
/usr/bin/logger should probably be a constant or defined in some sort of config as well as the log priority
13 years ago
Michael DeHaan
e25bb2f888
Upgrade output for playbook runs
13 years ago
Michael DeHaan
ee2fa721f1
Kinda have to pass the host list parameter
13 years ago
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.
13 years ago
Michael DeHaan
d079c8e5f3
Move runner out of __init__.py so it's clear what classes live where.
13 years ago
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.
13 years ago
Michael DeHaan
b2e8084c50
Merge pull request #4 from skvidal/master
...
adds an option to ask for and store the ssh password from the cli
13 years ago
Seth Vidal
08b45d6da1
add support to prompt for ssh password on the cli
13 years ago
Jeremy Katz
25df80ff58
Use a mktemp'd path for uploading modules
13 years ago
Michael DeHaan
bd37864242
Comments and fixup on the dark/contacted code
13 years ago
Michael DeHaan
11f7930038
trim unused modules
13 years ago
Michael DeHaan
7be8d134c9
Rename 'successful' to 'contacted' ...
13 years ago
Michael DeHaan
530e54b3e4
Fix multiprocessing pool usage and remove stackoverflow hack
13 years ago
Michael DeHaan
7ce5db97ed
Add explicit calls to close connections
13 years ago
Michael DeHaan
e0e98d10ce
use readlines on stdout so we'll block on long running commands
13 years ago
Michael DeHaan
7eb2dd2dee
Add remote setting to file, update TODO
13 years ago
Michael DeHaan
3da6370a65
use defaults better, improve/fix setup.py
13 years ago
Michael DeHaan
9681e1fa04
Add MIT license headers
13 years ago
Michael DeHaan
3807824c6d
Added file copy support w/ readme updates
13 years ago
Michael DeHaan
145a024d7b
Split CLI into binscript
13 years ago
Michael DeHaan
f31421576b
Genesis.
13 years ago