Explicitly naming variable to eliminate possible collision
The ansible loop construct assigns the same variable name 'item' to all loops by default. This can lead to potential name space collisions, as multiple loops, operating over different datastructures, can be nested within each other, and potentially modify each others data. Introduction of a named loop variable prevents this, unlikely though not impossible, event from happening. Signed-off-by: Jiri Podivin <jpodivin@redhat.com> Change-Id: I2a1cfe09d850af5c0ebd8cb9ac139d58790f5881
This commit is contained in:
parent
e3afdf14b6
commit
d48deac395
@ -64,3 +64,5 @@
|
||||
- name: add required services
|
||||
include: services.yml
|
||||
loop: "{{ tripleo_ipa_server_metadata | from_json | parse_service_metadata(base_server_fqdn) }}"
|
||||
loop_control:
|
||||
loop_var: required_service
|
||||
|
@ -17,7 +17,7 @@
|
||||
# The tasks in this file perform the registration process for a service.
|
||||
#
|
||||
# The following variable are required:
|
||||
# - {item} : which is an ordered tuple of the form:
|
||||
# - { required_service } : which is an ordered tuple of the form:
|
||||
# -- { sub_host, service }
|
||||
#
|
||||
# An example of this is:
|
||||
@ -27,8 +27,8 @@
|
||||
|
||||
- name: set variables
|
||||
set_fact:
|
||||
sub_host: "{{ item.0 }}"
|
||||
service: "{{ item.1 }}"
|
||||
sub_host: "{{ required_service.0 }}"
|
||||
service: "{{ required_service.1 }}"
|
||||
|
||||
- name: add sub_host
|
||||
ipahost:
|
||||
|
Loading…
x
Reference in New Issue
Block a user