mirror of
https://github.com/ansible/ansible.git
synced 2026-08-02 08:03:18 +02:00
@@ -0,0 +1,2 @@
|
||||
deprecated_features:
|
||||
- vars - Specifying a list of dictionaries for ``vars:`` is deprecated in favor of specifying a dictionary.
|
||||
@@ -31,8 +31,23 @@ No notable changes
|
||||
Deprecated
|
||||
==========
|
||||
|
||||
No notable changes
|
||||
* Providing a list of dictionaries to ``vars:`` is deprecated in favor of supplying a dictionary.
|
||||
|
||||
Instead of:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
vars:
|
||||
- var1: foo
|
||||
- var2: bar
|
||||
|
||||
Use:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
vars:
|
||||
var1: foo
|
||||
var2: bar
|
||||
|
||||
Modules
|
||||
=======
|
||||
|
||||
@@ -570,6 +570,13 @@ class FieldAttributeBase:
|
||||
_validate_variable_keys(ds)
|
||||
return combine_vars(self.vars, ds)
|
||||
elif isinstance(ds, list):
|
||||
display.deprecated(
|
||||
(
|
||||
'Specifying a list of dictionaries for vars is deprecated in favor of '
|
||||
'specifying a dictionary.'
|
||||
),
|
||||
version='2.18'
|
||||
)
|
||||
all_vars = self.vars
|
||||
for item in ds:
|
||||
if not isinstance(item, dict):
|
||||
@@ -582,7 +589,7 @@ class FieldAttributeBase:
|
||||
else:
|
||||
raise ValueError
|
||||
except ValueError as e:
|
||||
raise AnsibleParserError("Vars in a %s must be specified as a dictionary, or a list of dictionaries" % self.__class__.__name__,
|
||||
raise AnsibleParserError("Vars in a %s must be specified as a dictionary" % self.__class__.__name__,
|
||||
obj=ds, orig_exc=e)
|
||||
except TypeError as e:
|
||||
raise AnsibleParserError("Invalid variable name in vars specified for %s: %s" % (self.__class__.__name__, e), obj=ds, orig_exc=e)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
- hosts: testhost
|
||||
gather_facts: False
|
||||
vars:
|
||||
- output_dir: .
|
||||
output_dir: .
|
||||
roles:
|
||||
- { role: test_vault, tags: test_vault}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
- hosts: testhost
|
||||
gather_facts: False
|
||||
vars:
|
||||
- output_dir: .
|
||||
output_dir: .
|
||||
roles:
|
||||
- { role: test_vaulted_template, tags: test_vaulted_template}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
- hosts: localhost
|
||||
gather_facts: false
|
||||
vars:
|
||||
- data: {}
|
||||
data: {}
|
||||
tasks:
|
||||
- block:
|
||||
- name: template error
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
- name: Test that check works with check_mode specified in roles
|
||||
hosts: testhost
|
||||
vars:
|
||||
- output_dir: .
|
||||
output_dir: .
|
||||
roles:
|
||||
- { role: test_always_run, tags: test_always_run }
|
||||
- { role: test_check_mode, tags: test_check_mode }
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
- hosts: testhost3
|
||||
vars:
|
||||
- template_role: ./roles/test_template
|
||||
- output_dir: "{{ playbook_dir }}"
|
||||
- templated_var: foo
|
||||
- templated_dict: { 'hello': 'world' }
|
||||
template_role: ./roles/test_template
|
||||
output_dir: "{{ playbook_dir }}"
|
||||
templated_var: foo
|
||||
templated_dict: { 'hello': 'world' }
|
||||
tasks:
|
||||
- name: Test no delegate_to
|
||||
setup:
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
|
||||
- hosts: testhost
|
||||
vars:
|
||||
- test1:
|
||||
key1: val1
|
||||
test1:
|
||||
key1: val1
|
||||
environment:
|
||||
PATH: '{{ansible_env.PATH + ":/lola"}}'
|
||||
lola: 'ido'
|
||||
@@ -41,9 +41,9 @@
|
||||
|
||||
- hosts: testhost
|
||||
vars:
|
||||
- test1:
|
||||
key1: val1
|
||||
- test2:
|
||||
test1:
|
||||
key1: val1
|
||||
test2:
|
||||
key1: not1
|
||||
other1: val2
|
||||
environment: "{{test1}}"
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
---
|
||||
- hosts: testhost
|
||||
vars:
|
||||
- ansible_hostname: "BAD!"
|
||||
- vars_var: "vars_var"
|
||||
- param_var: "BAD!"
|
||||
- vars_files_var: "BAD!"
|
||||
- extra_var_override_once_removed: "{{ extra_var_override }}"
|
||||
- from_inventory_once_removed: "{{ inven_var | default('BAD!') }}"
|
||||
ansible_hostname: "BAD!"
|
||||
vars_var: "vars_var"
|
||||
param_var: "BAD!"
|
||||
vars_files_var: "BAD!"
|
||||
extra_var_override_once_removed: "{{ extra_var_override }}"
|
||||
from_inventory_once_removed: "{{ inven_var | default('BAD!') }}"
|
||||
vars_files:
|
||||
- vars/test_var_precedence.yml
|
||||
roles:
|
||||
|
||||
Reference in New Issue
Block a user