Commit Graph

131 Commits (ae2447df9136353453c9ed48d44b2c7fa70231b0)

Author SHA1 Message Date
Toshio Kuratomi 318bfbb207 Migrate cli and dependencies to use global display 9 years ago
Brian Coca 10fd717a44 narrow the scope of import error and make sure non - aliases to ansible get their own error 9 years ago
Brian Coca d0a22a7b45 made cli code more flexible to add new command line programs w/o need for updating bin/ansible 9 years ago
Brian Coca 56a2412dc2 now correctly traps unimplemented symlinks as subprograms 9 years ago
Toshio Kuratomi 7c10c16251 Revert "capture some install issues and give out a slightly nicer error"
This reverts commit e6b1dc45e1.

This is not ready yet and it's causing failures in some environments
(travis)
9 years ago
Brian Coca e6b1dc45e1 capture some install issues and give out a slightly nicer error 9 years ago
Toshio Kuratomi f34b55ac2b Add python3-compat boilerplate to all .py files in lib/ansible 9 years ago
James Cammarata de792ba3c2 Improve handling of unicode errors
Fixes #12669
9 years ago
Brian Coca a5e6845c8b Revert "Allow exceptions to pass through the program"
breaks handling constants.py errors gracefully

This reverts commit 59f96d713e.
9 years ago
Will Thames 59f96d713e Allow exceptions to pass through the program
This is useful when using `ipython --pdb -- $(which ansible-playbook)
...` for debugging.

Also show traceback when `ANSIBLE_DEBUG` is on
9 years ago
Brian Coca e49575ff56 added wrap_text to 'last resort' as it fails if there is an error in callbacks 9 years ago
James Cammarata 469aa0c26a Don't wrap text on most errors 9 years ago
James Cammarata 6d50a261c5 Allow full exception tracebacks to be displayed with increased verbosity 9 years ago
Marc Abramowitz 314bae2a9e Don't wrap text for AnsibleParserError
This allows not messing up the wonderful error reporting that is
carefully created. Instead of:

    $ ansible-playbook foo.yml
     [ERROR]: ERROR! 'foo' is not a valid attribute for a Task  The error appears
    to have been in '/Users/marca/dev/git-repos/ansible/foo.yml': line 4, column 7,
    but may be elsewhere in the file depending on the exact syntax problem.  The
    offending line appears to be:    tasks:     - name: do something       ^ here

we get:

    $ ansible-playbook foo.yml
    ERROR! 'foo' is not a valid attribute for a Task

    The error appears to have been in '/Users/marca/dev/git-repos/ansible/foo.yml': line 4, column 7, but may
    be elsewhere in the file depending on the exact syntax problem.

    The offending line appears to be:

      tasks:
        - name: do something
          ^ here

which is much nicer.
9 years ago
Brian Coca f42b6237d9 now has display of last resort
moved all display/color/err to use display.error
now also capture generic exceptions if they happen (never should!)
9 years ago
Brian Coca 6a75125f32 now traps exceptions on display instantiation 9 years ago
Brian Coca fdeca37257 switched to argv[0] from __file__ as it is what we actually wanted 9 years ago
Brian Coca b85ce38834 slight changes to error handling to align with v1 9 years ago
James Cammarata ce3ef7f4c1 Making the switch to v2 9 years ago
Brian Coca 5f6db0e164 preliminary privlege escalation unification + pbrun
- become constants inherit existing sudo/su ones
- become command line options, marked sudo/su as deprecated and moved sudo/su passwords to runas group
- changed method signatures as privlege escalation is collapsed to become
- added tests for su and become, diabled su for lack of support in local.py
- updated playbook,play and task objects to become
- added become to runner
- added whoami test for become/sudo/su
- added home override dir for plugins
- removed useless method from ask pass
- forced become pass to always be string also uses to_bytes
- fixed fakerunner for tests
- corrected reference in synchronize action plugin
- added pfexec (needs testing)
- removed unused sudo/su in runner init
- removed deprecated info
- updated pe tests to allow to run under sudo and not need root
- normalized become options into a funciton to avoid duplication and inconsistencies
- pushed suppored list to connection classs property
- updated all connection plugins to latest 'become' pe

- includes fixes from feedback (including typos)
- added draft docs
- stub of become_exe, leaving for future v2 fixes
10 years ago
Matt Martz 68358e31fb Allow ansible (ad-hoc) to support --extra-vars also 10 years ago
Toshio Kuratomi fbadcfd44f Fix for not all platforms having optional libraries at the proper versions. 10 years ago
Pete Smith 0953322b23 Remove no-op string declaration 10 years ago
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.
11 years ago
James Tanner 70f4e0807c Fixes #6467 ansible command should not assume sudo if ask_sudo_pass or sudo_user 11 years ago
James Tanner 35def422a3 Addresses #6188 Add --vault-password-file to bin/ansible and bin/ansible-playbook 11 years ago
James Tanner 9ba053c885 Fix ansible cli to use vault for group var files 11 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
12 years ago
Stoned Elipot 82011b043a For ansible --list-hosts benefit apply hosts selection limits early 12 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.
12 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