Using include_tasks with the same file several times inside a role

16 views
Skip to first unread message

Paulo Silva

unread,
Feb 23, 2019, 9:57:12 AM2/23/19
to Ansible Project
Hi,

Is it possible do to something like this inside a role?

- name: task with var1
  include_tasks: external.yaml
  vars:
    my_var=var1

- name task with var2
  include_tasks: external.yaml
  vars:
    my_var=var2

I'm no getting any error but it appears that only the first include_tasks is used, switching to import_tasks as the same behavior.

Is is expected? Any other to achieve this?

Thanks

BHARATHI DURAI RAJ

unread,
Feb 23, 2019, 10:22:39 AM2/23/19
to Ansible Project
Try this one

- name: task with var1
  include_tasks: external.yaml
  vars:
    my_var: var1

- name: task with var2
  include_tasks: external.yaml
  vars:
    my_var: var2

Paulo Silva

unread,
Feb 23, 2019, 5:08:16 PM2/23/19
to ansible...@googlegroups.com
It was a typo, even like that only the first one is executed.

Regards

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/dd2b9c97-e819-4b7c-8388-5f4a01cf9d2c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kai Stian Olstad

unread,
Feb 23, 2019, 5:20:47 PM2/23/19
to ansible...@googlegroups.com
On 23.02.2019 23:07, Paulo Silva wrote:
> It was a typo, even like that only the first one is executed.

You have only shown us part of your code, since it's not working you have error(s) in that code.


--
Kai Stian Olstad
Reply all
Reply to author
Forward
0 new messages