Commit graph

107 commits

Author SHA1 Message Date
Michael DeHaan
6caad9ac8f No hosts matched goes to stderr. 2014-07-28 10:48:41 -04:00
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
2014-07-14 10:57:16 -05:00
Matt Martz
19f5ce2c9c Allow --vault-password-file to work with a script as well as a flat file 2014-06-24 15:02:24 -05:00
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
2014-03-25 22:12:01 +01:00
jctanner
adbd6865da Merge pull request #6681 from zytek/devel
Properly revert changes introduced in #6579
2014-03-25 13:52:34 -04:00
Jakub Paweł Głazik
6b53ac8a9a strip() vault password file 2014-03-25 16:10:33 +01:00
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.
2014-03-19 14:38:11 -04:00
James Tanner
70f4e0807c Fixes #6467 ansible command should not assume sudo if ask_sudo_pass or sudo_user 2014-03-17 15:03:05 -04:00
James Tanner
35def422a3 Addresses #6188 Add --vault-password-file to bin/ansible and bin/ansible-playbook 2014-02-26 11:01:03 -05:00
James Tanner
9ba053c885 Fix ansible cli to use vault for group var files 2014-02-19 11:23:46 -05:00
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
2014-01-20 19:19:03 -06:00
James Tanner
c17d0e0357 Revert "Merge pull request #5325 from angstwad/add-su-support"
This reverts commit 6f4bfa2cff, reversing
changes made to c91ba3a7c7.
2014-01-20 16:10:11 -05:00
Paul Durivage
c95be4ceaa Make sudo and su command line arguments mutually exclusive 2014-01-20 11:25:10 -06:00
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
2014-01-20 11:25:10 -06:00
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.
2013-11-06 08:08:21 -08:00
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.
2013-08-14 13:37:26 -07:00
Michael DeHaan
0988a86653 Misc style fixes. 2013-08-10 17:59:05 -04:00
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
2013-08-07 08:05:59 -04:00
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.
2013-06-26 19:57:31 -06:00
Michael DeHaan
aa55268514 Adds a logfile for ansible playbooks that can be set by the environment or configuration file. 2013-04-27 10:24:26 -04:00
Michael DeHaan
be947e5266 Resolve merge conflict 2013-04-22 23:57:20 -04:00
Serge van Ginderachter
94243e983f make bin/ansible error output consistent for shell module as for the command module when no arguments 2013-04-11 19:43:31 +02:00
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
2013-02-07 22:52:25 -05:00
Stoned Elipot
82011b043a For ansible --list-hosts benefit apply hosts selection limits early 2013-02-06 14:47:21 +01:00
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.
2013-02-03 20:34:13 -05:00
Christopher A. Snapp
8655f64e68 add --list-hosts support to bin/ansible
add error handling when no arg passed to command module
2012-12-09 09:05:43 -05:00
Michael DeHaan
6f938c9f4c Merge branch 'playbook_ssh_ask_pass' of git://github.com/clatour/ansible into devel
Conflicts:
	examples/ansible.cfg

+ doc tweak
2012-11-03 19:23:38 -04:00
Chandler Latour
f436a8c88b Added config option for default ask for ssh_pass 2012-11-02 10:53:26 -05:00
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>
2012-10-30 23:36:07 -04:00
Aleksej Romanov
05464816c2 Different return codes for different errors. 2012-10-04 17:43:25 +07:00
Aleksej Romanov
01e922aa69 Indicate errors with exit code. 2012-10-04 03:11:14 +07:00
Michael DeHaan
3587ffdef3 Allow /bin/ansible to use --limit 2012-08-11 14:05:24 -04:00
Michael DeHaan
846186e2fc Add -vvv support for debugging activity 2012-08-08 21:09:14 -04:00
Michael DeHaan
faed4b5a33 whitespace + remove deprecated YAML parser (migration script lives in examples/scripts and warning was added
in 0.6 release)
2012-08-06 20:07:02 -04:00
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.
2012-06-19 21:57:43 -04:00
Michael DeHaan
db1d5b154a Fix casing/underscore convention in method name, split polling logic away from runner. 2012-05-25 19:18:02 -04:00
Seth Vidal
b42628d858 hook up --private-key to the runner 2012-05-14 16:22:05 -04:00
John Kleint
710d085def Fix non-sudo execution, add --sudo-user to ansible-playbook. 2012-05-07 19:58:16 -04:00
Michael DeHaan
05545e3735 Fixup the previous sudo_user support patch to work with playbooks. 2012-05-06 18:24:45 -04:00
Jim Richardson
93a20a33e9 first bit of getting sudo -u functionality 2012-05-06 18:24:44 -04:00
Rafal Lewczuk
06e99ee75e Trivial fix: make PyDev happy (imports). 2012-05-01 22:56:21 -04:00
Jeroen Hoekx
029fe1273c Modify /usr/bin/ansible and playbooks to use the new async API. 2012-05-01 18:38:26 -04:00
Michael DeHaan
edb8988e8e Unused imports 2012-04-21 12:04:21 -04:00
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.
2012-04-21 11:46:32 -04:00
Michael DeHaan
70734f5968 Update bin/ansible to fix usage of inventory API + no more verbose option 2012-04-19 09:21:21 -04:00
Michael DeHaan
3f26a1c7f6 verbose option is not being used, so remove it. debug variable still exists. 2012-04-16 23:47:41 -04:00
Michael DeHaan
35fdf6636b Allow --user for playbooks, no need for port setting as can specify in inventory file now. 2012-04-16 22:15:55 -04:00
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.
2012-04-16 09:16:28 +02:00
Michael DeHaan
347637339c Merge remote branch 'public/integration' into integration 2012-04-13 19:33:57 -04:00
Michael DeHaan
c3cad50075 Update manpages, fix missing variable assignment 2012-04-13 19:33:19 -04:00