multiple tasks_from in a single include_role

Hi,

I have a role with multiple task files and I include only few of them in my different playbook

I did below but it gives an error:

tasks:

  • name: check configuration
    include_role:
    name: config_check
    tasks_from: “{{ item }}”
    with_items:
  • ldap
  • dns

it gave an error:
ERROR! invalid options for include_role: with_items

so I try below :

tasks:

  • name: check ldap configuration
    include_role:
    name: config_check

tasks_from: ldap

  • name: check dns configuration
    include_role:
    name: config_check

tasks_from: dns

Is this correct design approach ?

Thanks and regards
Punit

Approach ok but your indentation is off.

with_items should be at the same level as include_role.