diff --git a/changelogs/fragments/82528summary.yml b/changelogs/fragments/82528summary.yml new file mode 100644 index 00000000000..ab99e13b6bd --- /dev/null +++ b/changelogs/fragments/82528summary.yml @@ -0,0 +1,3 @@ +bugfixes: +- Warning now includes filename and line number of variable + when specifying a list of dictionaries for vars (https://github.com/ansible/ansible/issues/82528). \ No newline at end of file diff --git a/lib/ansible/playbook/base.py b/lib/ansible/playbook/base.py index 96c3b9815dc..df18ecb61ad 100644 --- a/lib/ansible/playbook/base.py +++ b/lib/ansible/playbook/base.py @@ -589,10 +589,11 @@ class FieldAttributeBase: _validate_variable_keys(ds) return combine_vars(self.vars, ds) elif isinstance(ds, list): + line_file = getattr(ds, 'ansible_pos', ("unknown", 0)) display.deprecated( ( 'Specifying a list of dictionaries for vars is deprecated in favor of ' - 'specifying a dictionary.' + 'specifying a dictionary. Error occurred in the file: %s, line: %d' % (line_file[0], line_file[1]) ), version='2.18' )