Commit Graph

158 Commits (66a83314b9d30c6a139de960e6da8d5554c28544)

Author SHA1 Message Date
Bruno BAILLUET 16108e4a99 Adding a new 'load_callback_plugins' config option, defaults to False
This option, when set to True, allows "ansible" command to load callback plugins
10 years ago
Michael DeHaan 6caad9ac8f No hosts matched goes to stderr. 10 years ago
James Cammarata 4fc8d4b6fe Merge pull request #7649 from sivel/vault-password-script
Allow --vault-password-file to work with a script as well as a flat file
10 years ago
Matt Martz 19f5ce2c9c Allow --vault-password-file to work with a script as well as a flat file 10 years ago
Serge van Ginderachter f6a55a3552 Refactor vars_plugins (host/group_vars)
Split out parsing of vars files to per host and per group
parsing, instead of reparsing all groups for each host. This enhances
performance.

Extend vars_plugins' API with two new methods:
* get host variables: only parses host_vars
* get group variables: only parses group_vars for specific group
The initial run method is still used for backward compatibility.

Parse all vars_plugins at inventory initialisation, instead of
per host when touched first by runner. Here we can also loop through
all groups once easily, then parse them.
This also centralizes all parsing in the inventory constructor.

	modified:   bin/ansible
	modified:   bin/ansible-playbook
	modified:   lib/ansible/inventory/__init__.py
	modified:   lib/ansible/inventory/vars_plugins/group_vars.py
10 years ago
jctanner adbd6865da Merge pull request #6681 from zytek/devel
Properly revert changes introduced in #6579
10 years ago
Jakub Paweł Głazik 6b53ac8a9a strip() vault password file 10 years ago
James Tanner 409044155d Fixes #6579 allow for vault passwords ending with newline chars
Also add a unit test for vaulteditor to verify 1.0 passwords with newline chars.
10 years ago
James Tanner 70f4e0807c Fixes #6467 ansible command should not assume sudo if ask_sudo_pass or sudo_user 10 years ago
James Tanner 35def422a3 Addresses #6188 Add --vault-password-file to bin/ansible and bin/ansible-playbook 10 years ago
James Tanner 9ba053c885 Fix ansible cli to use vault for group var files 10 years ago
Paul Durivage f72f5a20df Revert "Revert "Merge pull request #5325 from angstwad/add-su-support""
This reverts commit c17d0e0357.

Conflicts:
	lib/ansible/runner/connection_plugins/paramiko_ssh.py
11 years ago
James Tanner c17d0e0357 Revert "Merge pull request #5325 from angstwad/add-su-support"
This reverts commit 6f4bfa2cff, reversing
changes made to c91ba3a7c7.
11 years ago
Paul Durivage c95be4ceaa Make sudo and su command line arguments mutually exclusive 11 years ago
Paul Durivage 4088243deb Proposing fix for Issue #4324; adding support for su in connection plugins ssh, ssh_alt
Fixes for ssh_alt support, adding in references to in_data where appropriate
11 years ago
Jesse Keating 46554bbc30 Exit 0 with no matched hosts
And also print to stdout not err

This lines up with how ansible-playbook will exit. 0 in the case of no
matched hosts. This makes it easier to script ansible commands w/
variable iventory input which may or may not have an entry for the
specific ansible task being scripted. No matched hosts is acceptable,
but matched hosts w/ failures is not.
11 years ago
Jesse Keating 2b96c347dc Exit with status 3 if no failures but unreachable.
Provide hints to playbook callers that a playbook execution had
unreachable vs failures. 2 == failures, 3 == no failures, but
unreachable hosts. 0 continues to be all good.
11 years ago
Michael DeHaan 0988a86653 Misc style fixes. 11 years ago
Andy R 5a47953e7d Never ask for SSH password when using local connection.
With the command line option "-c local", ansible and ansible-playbook
should never ask for a SSH password even if this is set in the config.

Fixes #3720
11 years ago
Joshua Lund dc984d94ac Updates to Ansible command options
* Moved the --list-hosts option that is common to both `ansible` and
  `ansible-playbook` into utils/__init__.py (corrects a FIXME)
* Wrote new help text for the --list-hosts option that makes sense
  for both of the commands that it applies to
* Changed the usage argument in `ansible-playbook` so that it is
  setup in the base_parser method the same way that it is in
  the `ansible` executable
* Updated the help text for several options to correct typos,
  clarify meaning, improve readability, or fix grammatical errors.
  In the case of `ansible-pull`, I changed the help text so that
  it adheres to the same standards as the other executables.
11 years ago
Michael DeHaan aa55268514 Adds a logfile for ansible playbooks that can be set by the environment or configuration file. 11 years ago
Michael DeHaan be947e5266 Resolve merge conflict 11 years ago
Serge van Ginderachter 94243e983f make bin/ansible error output consistent for shell module as for the command module when no arguments 11 years ago
Michael DeHaan a9162a86f2 Very basic --diff option for showing what happens when templates change.
Probably output is not useful if not used with --limit

Works well with --check mode
11 years ago
Stoned Elipot 82011b043a For ansible --list-hosts benefit apply hosts selection limits early 11 years ago
Michael DeHaan fed82c2188 This implements a basic --check mode which for now is only implemented on template & copy operations. More detail will be shared with the list
shortly.
11 years ago
Christopher A. Snapp 8655f64e68 add --list-hosts support to bin/ansible
add error handling when no arg passed to command module
12 years ago
Michael DeHaan 6f938c9f4c Merge branch 'playbook_ssh_ask_pass' of git://github.com/clatour/ansible into devel
Conflicts:
	examples/ansible.cfg

+ doc tweak
12 years ago
Chandler Latour f436a8c88b Added config option for default ask for ssh_pass 12 years ago
Brian Coca 604bf9f58a Added config option to control default of asking or not for sudo password
Signed-off-by: Brian Coca <briancoca+ansible@gmail.com>
12 years ago
Aleksej Romanov 05464816c2 Different return codes for different errors. 12 years ago
Aleksej Romanov 01e922aa69 Indicate errors with exit code. 12 years ago
Michael DeHaan 3587ffdef3 Allow /bin/ansible to use --limit 12 years ago
Michael DeHaan 846186e2fc Add -vvv support for debugging activity 12 years ago
Michael DeHaan faed4b5a33 whitespace + remove deprecated YAML parser (migration script lives in examples/scripts and warning was added
in 0.6 release)
12 years ago
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.
12 years ago
Michael DeHaan db1d5b154a Fix casing/underscore convention in method name, split polling logic away from runner. 12 years ago
Seth Vidal b42628d858 hook up --private-key to the runner 12 years ago
John Kleint 710d085def Fix non-sudo execution, add --sudo-user to ansible-playbook. 12 years ago
Michael DeHaan 05545e3735 Fixup the previous sudo_user support patch to work with playbooks. 12 years ago
Jim Richardson 93a20a33e9 first bit of getting sudo -u functionality 12 years ago
Rafal Lewczuk 06e99ee75e Trivial fix: make PyDev happy (imports). 12 years ago
Jeroen Hoekx 029fe1273c Modify /usr/bin/ansible and playbooks to use the new async API. 12 years ago
Michael DeHaan edb8988e8e Unused imports 12 years ago
Michael DeHaan a8d748220b Don't prompt for password info if the pattern wouldn't have matched any hosts. Also convert
Runner() usage to the new inventory model.
12 years ago
Michael DeHaan 70734f5968 Update bin/ansible to fix usage of inventory API + no more verbose option 12 years ago
Michael DeHaan 3f26a1c7f6 verbose option is not being used, so remove it. debug variable still exists. 12 years ago
Michael DeHaan 35fdf6636b Allow --user for playbooks, no need for port setting as can specify in inventory file now. 12 years ago
Jeroen Hoekx c5cae87eca Refactor inventory code out of Runner.
This introduces the Inventory class.

Playbook uses the internals of Runner to limit the number of hosts to poll
asynchronously. To accomodate this, Inventory can be restricted to specific
hosts.
12 years ago
Michael DeHaan 347637339c Merge remote branch 'public/integration' into integration 12 years ago
Michael DeHaan c3cad50075 Update manpages, fix missing variable assignment 12 years ago
Michael DeHaan f2465e0571 Add support for specifying sudo passwords to both ansible & playbook. Nopasswd sudo is no longer required. 12 years ago
Jeroen Hoekx d366885367 Stop async /bin/ansible if completed on all hosts. 12 years ago
Michael DeHaan 6b50078881 Add defaults to command help to avoid a certain class of user questions. 12 years ago
Stephen Fromm 0675f2511b Merge branch 'master' into localconnection
Merge the SortedOptParser bits and debug attribute commits into
localconnection.

Conflicts:
	bin/ansible
	lib/ansible/playbook.py
	lib/ansible/runner.py
	lib/ansible/utils.py
12 years ago
Michael DeHaan 4c75b7f3ad Merge commit '8ae71cc' into integration
Conflicts:
	bin/ansible
	bin/ansible-playbook
	lib/ansible/utils.py
12 years ago
Stephen Fromm fdee1d3459 Add support to bin/ansible for --connection option 12 years ago
Seth Vidal 8ae71cc7b1 go back to using a normal optparser to add options instead of the dict
interface.

add very small subclass of OptionParser to sort the options so mdehaan is happy
12 years ago
Brad Olson f840c0d167 Wired in Michael's usage string optparse style. 12 years ago
Michael DeHaan 7b9856bc0e Modification on top of skvidal's common options patch to keep options to command line tools sorted. 12 years ago
Seth Vidal 7e50d170a8 move the bulk of the opt parsing out of ansible/ansible-playbook and into utils
for other scripts to use.
12 years ago
Michael DeHaan 2511992659 Surface module debug (-D) to /usr/bin/ansible also 12 years ago
Michael DeHaan 6275e57718 pyflakes: Unused import / unused var 12 years ago
Michael DeHaan 3ded27fe35 Treat module args as strings everywhere to avoid unneccessary shlex and requoting 12 years ago
Michael DeHaan 81e3496037 Added preliminary support for --sudo to ansible, playbook support and further testing pending. 12 years ago
Tim Bielawa 5261d14aef Fix exception catching for py2.4 12 years ago
Michael DeHaan b30ddc4520 Expose remote_port option in playbook 12 years ago
Christopher Johnston 9041ad4d83 just some minor clean up single vs double in getopt parsing 12 years ago
Christopher Johnston f06ec76fdb add support for using an alternate remote port 12 years ago
Michael DeHaan 01e51b120a Recieved quite a few requests to run python via /usr/bin/env, so doing that. 12 years ago
Michael DeHaan 45a455a805 Make /usr/bin/ansible output realtime and also delete some code! 12 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)
12 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)
12 years ago
Michael DeHaan fde7de80df Remove "import *" from bin/ansible so we can use pyflakes, and remove unneeded imports in the process 12 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.
12 years ago
Michael DeHaan db61e8f346 Fix -t tree mode so it writes out the value for each host, not everything, once again 12 years ago
Michael DeHaan 4ae98ed92d Upgrades to error handling, now general try/catch available. 12 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*.
12 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.
12 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.
12 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.
12 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.
12 years ago
Michael DeHaan bf967adf83 Added pydoc for functions in Cli() 12 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.
12 years ago
Michael DeHaan b33ef0de60 Add a newline in output here, possibly considering printing top level keys flat 12 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 12 years ago
Michael DeHaan 847846af0e -p has been replaced by a required option. Various docs changes. 12 years ago
Michael DeHaan 4ce1f1dd5e README/doc/example updates to go with group support and CLI option changes.
Minimizing manpage until CLI options stabilize.
12 years ago
Christopher Johnston d15172abdc add a -T option for setting ssh timeout in seconds 12 years ago
Christopher Johnston 2773234c3f python 2.5 does not include json so lets try to use simplejson 12 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
12 years ago
Michael DeHaan 1427ade3af Have ansible yell if no module name is supplied 12 years ago
Michael DeHaan edf6da5c38 Rename opts so --help looks cleaner 12 years ago
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".
12 years ago
Michael DeHaan 01e5da6d0b Make /bin/ansible use the common options from lib/ansible/scripts
DRY!
12 years ago
Michael DeHaan be4cb64c92 Relicensing to GPLv3, all previous committers ok'd on mailing list. 12 years ago
Michael DeHaan a5039eec62 Update reporting on playbook runs. 12 years ago
Seth Vidal ee95a5b0a4 use shlex.split() instead of split() to keep quoting sane for commands 12 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.
12 years ago
Michael DeHaan 767517ac65 Force forks to be an integer when read by command line 12 years ago