Skip to content

Commit

Permalink
add any_errors_fatal global config
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoca committed Jul 3, 2017
1 parent e9447e9 commit 32fa4db
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
3 changes: 3 additions & 0 deletions examples/ansible.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,9 @@
# ENABLING THIS COULD BE A SECURITY RISK
#allow_unsafe_lookups = False

# set default errors for all plays
#any_errors_fatal = False

[privilege_escalation]
#become=True
#become_method=sudo
Expand Down
10 changes: 10 additions & 0 deletions lib/ansible/config/data/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,16 @@ ANSIBLE_SSH_RETRIES:
value_type: integer
vars: []
yaml: {key: ssh_connection.retries}
ANY_ERRORS_FATAL:
default: False
env:
- name: ANSIBLE_ANY_ERRORS_FATAL
ini:
- section: defauls
key: any_errors_fatal
value_type: boolean
vars: []
yaml: {key: errors.anyerrors_fatal}
BECOME_ALLOW_SAME_USER:
default: False
desc: 'TODO: write it'
Expand Down
17 changes: 9 additions & 8 deletions lib/ansible/playbook/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@

from jinja2.exceptions import UndefinedError

from ansible import constants as C
from ansible.constants import mk_boolean as boolean
from ansible.module_utils.six import iteritems, string_types, with_metaclass
from ansible.errors import AnsibleParserError, AnsibleUndefinedVariable
from ansible.module_utils._text import to_text
from ansible.playbook.attribute import Attribute, FieldAttribute
from ansible.parsing.dataloader import DataLoader
from ansible.constants import mk_boolean as boolean
from ansible.utils.vars import combine_vars, isidentifier, get_unique_id

try:
Expand Down Expand Up @@ -157,13 +158,13 @@ class Base(with_metaclass(BaseMeta, object)):
_vars = FieldAttribute(isa='dict', priority=100, inherit=False)

# flags and misc. settings
_environment = FieldAttribute(isa='list')
_no_log = FieldAttribute(isa='bool')
_always_run = FieldAttribute(isa='bool')
_run_once = FieldAttribute(isa='bool')
_ignore_errors = FieldAttribute(isa='bool')
_check_mode = FieldAttribute(isa='bool')
_any_errors_fatal = FieldAttribute(isa='bool', always_post_validate=True)
_environment = FieldAttribute(isa='list')
_no_log = FieldAttribute(isa='bool')
_always_run = FieldAttribute(isa='bool')
_run_once = FieldAttribute(isa='bool')
_ignore_errors = FieldAttribute(isa='bool')
_check_mode = FieldAttribute(isa='bool')
_any_errors_fatal = FieldAttribute(isa='bool', default=C.ANY_ERRORS_FATAL, always_post_validate=True)

# param names which have been deprecated/removed
DEPRECATED_ATTRIBUTES = [
Expand Down

0 comments on commit 32fa4db

Please sign in to comment.