Weirdness when testing include_role

47 views
Skip to first unread message

Trond Hindenes

unread,
Oct 3, 2016, 4:24:49 PM10/3/16
to Ansible Project
Just a quick question regarding the include_role thing:

It seems that the "name" of the include_role task needs to match the role name, is anybody else seeing the same? For example, if my role is called "myrole", then this doesnt work:
---
- name: Do stuff to stuff
  hosts: localhost
  tasks:
    - name: do the thing
      include_role:
        name: myrole

While this works:
---
- name: Do stuff to stuff
  hosts: localhost
  tasks:
    - name: myrole
      include_role:
        name: myrole

btw: this is such an awesome feature. It's gonna fundamentally change how we write playbooks. Thanks!

Dave Kindel

unread,
Oct 3, 2016, 6:11:53 PM10/3/16
to Ansible Project
I haven't messed around with it but according to their examples, your first test should have worked.

From the docs:
- name: Run tasks/other.yml instead of 'main'
  include_role:
    name: myrole
    tasks_from: other

Brian Coca

unread,
Oct 3, 2016, 6:22:25 PM10/3/16
to ansible...@googlegroups.com
​Sounds like a bug, probably my fault for reusing name on the object and bad tests:

- name: myrole
  include_role: name=myrole

....


----------
Brian Coca
Reply all
Reply to author
Forward
0 new messages