Browse code

add any_errors_fatal global config

Brian Coca authored on 2017/05/11 07:08:42
Showing 3 changed files
... ...
@@ -310,6 +310,9 @@
310 310
 # ENABLING THIS COULD BE A SECURITY RISK
311 311
 #allow_unsafe_lookups = False
312 312
 
313
+# set default errors for all plays
314
+#any_errors_fatal = False
315
+
313 316
 [privilege_escalation]
314 317
 #become=True
315 318
 #become_method=sudo
... ...
@@ -180,6 +180,16 @@ ANSIBLE_SSH_RETRIES:
180 180
   value_type: integer
181 181
   vars: []
182 182
   yaml: {key: ssh_connection.retries}
183
+ANY_ERRORS_FATAL:
184
+    default: False
185
+    env:
186
+      - name: ANSIBLE_ANY_ERRORS_FATAL
187
+    ini:
188
+      - section:  defauls
189
+        key: any_errors_fatal
190
+    value_type: boolean
191
+    vars: []
192
+    yaml: {key: errors.anyerrors_fatal}
183 193
 BECOME_ALLOW_SAME_USER:
184 194
   default: False
185 195
   desc: 'TODO: write it'
... ...
@@ -27,12 +27,13 @@ from functools import partial
27 27
 
28 28
 from jinja2.exceptions import UndefinedError
29 29
 
30
+from ansible import constants as C
31
+from ansible.constants import mk_boolean as boolean
30 32
 from ansible.module_utils.six import iteritems, string_types, with_metaclass
31 33
 from ansible.errors import AnsibleParserError, AnsibleUndefinedVariable
32 34
 from ansible.module_utils._text import to_text
33 35
 from ansible.playbook.attribute import Attribute, FieldAttribute
34 36
 from ansible.parsing.dataloader import DataLoader
35
-from ansible.constants import mk_boolean as boolean
36 37
 from ansible.utils.vars import combine_vars, isidentifier, get_unique_id
37 38
 
38 39
 try:
... ...
@@ -157,13 +158,13 @@ class Base(with_metaclass(BaseMeta, object)):
157 157
     _vars = FieldAttribute(isa='dict', priority=100, inherit=False)
158 158
 
159 159
     # flags and misc. settings
160
-    _environment      = FieldAttribute(isa='list')
161
-    _no_log           = FieldAttribute(isa='bool')
162
-    _always_run       = FieldAttribute(isa='bool')
163
-    _run_once         = FieldAttribute(isa='bool')
164
-    _ignore_errors    = FieldAttribute(isa='bool')
165
-    _check_mode       = FieldAttribute(isa='bool')
166
-    _any_errors_fatal = FieldAttribute(isa='bool', always_post_validate=True)
160
+    _environment         = FieldAttribute(isa='list')
161
+    _no_log              = FieldAttribute(isa='bool')
162
+    _always_run          = FieldAttribute(isa='bool')
163
+    _run_once            = FieldAttribute(isa='bool')
164
+    _ignore_errors       = FieldAttribute(isa='bool')
165
+    _check_mode          = FieldAttribute(isa='bool')
166
+    _any_errors_fatal     = FieldAttribute(isa='bool', default=C.ANY_ERRORS_FATAL, always_post_validate=True)
167 167
 
168 168
     # param names which have been deprecated/removed
169 169
     DEPRECATED_ATTRIBUTES = [