Return variables on task includes not working anymore

26 views
Skip to first unread message

Dan C

unread,
Apr 22, 2016, 11:14:18 AM4/22/16
to Ansible Project
I use to be able to do things like:

included_general_task.yml
---
- name: Get list dir
  shell: ls {{ path_dir }}
  register: {{ list }}



main.yml
---
- include: "included_general_task.yml path_dir=/ list=root_list"

- include: "included_general_task.yml path_dir=/tmp list=tmp_list"




From here on, I could access to the contents of {{ root_list }} and {{ tmp_list }} without problems.
It was working ok with ansible version 2.0.1.0, but with ansible version 2.0.2.0 when I try to acces those variables I am getting:

fatal: [localhost]: FAILED! => {"failed": true, "msg": "'root_list' is undefined"}


Is this a bug? or it is something that is changed and will be like this from now on?

Thanks!

Dejay Clayton

unread,
May 12, 2016, 4:07:16 PM5/12/16
to Ansible Project
Are you intending "root_list" and "tmp_list" to be expanded into "{{ root_list }}" and "{{ tmp_list }}" (by nature of the substitution into "list"?)

Johannes Kastl

unread,
May 14, 2016, 1:26:45 PM5/14/16
to ansible...@googlegroups.com
On 12.05.16 22:07 Dejay Clayton wrote:
> Are you intending "root_list" and "tmp_list" to be expanded into "{{
> root_list }}" and "{{ tmp_list }}" (by nature of the substitution into
> "list"?)

If I understood him correct he wants to store the results in a
variable, whose name is not fixed but rather defined in another variable.

I wonder why one list containing the results is not a viable option.
Dan, can you tell us?

Johannes


signature.asc
Reply all
Reply to author
Forward
0 new messages