Add config to fail on invalid task attributes. Fixes #42479

pull/42576/merge
Matt Martz 6 years ago committed by Brian Coca
parent 937e710485
commit 8aea8901c3

@ -1375,6 +1375,17 @@ HOST_KEY_CHECKING:
ini:
- {key: host_key_checking, section: defaults}
type: boolean
INVALID_TASK_ATTRIBUTE_FAILED:
name: Controls whether invalid attributes for a task result in errors instead of warnings
default: false
description: If 'true', invalid attributes for a task will result in errors instead of warnings
type: boolean
env:
- name: ANSIBLE_INVALID_TASK_ATTRIBUTE_FAILED
ini:
- key: invalid_task_attribute_failed
section: defaults
version_added: "2.7"
INVENTORY_ANY_UNPARSED_IS_FAILED:
name: Controls whether any unparseable inventory source is a fatal error
default: False

@ -231,7 +231,7 @@ class Task(Base, Conditional, Taggable, Become):
" Please see:\nhttps://docs.ansible.com/ansible/playbooks_roles.html#task-include-files-and-encouraging-reuse\n\n"
" for currently supported syntax regarding included files and variables", version="2.7")
new_ds['vars'][k] = v
elif k in self._valid_attrs:
elif C.INVALID_TASK_ATTRIBUTE_FAILED or k in self._valid_attrs:
new_ds[k] = v
else:
display.warning("Ignoring invalid attribute: %s" % k)

Loading…
Cancel
Save