multiple tasks_from in a single include_role

16 views
Skip to first unread message

Punit Jain

unread,
Jun 20, 2019, 9:19:54 AM6/20/19
to ansible...@googlegroups.com
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

Dick Visser

unread,
Jun 20, 2019, 10:37:39 AM6/20/19
to ansible...@googlegroups.com
Approach ok but your indentation is off. 
with_items should be at the same level as include_role.

--
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/CAFXWBQKQcdhpKDeLwJKiQ%2BOHkFA6UqgRV2a7Kr-FCc%2BWJHn%2BUg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
Sent from a mobile device - please excuse the brevity, spelling and punctuation.
Reply all
Reply to author
Forward
0 new messages