You could use the include_role module like this:

include_role:
  name: my_flirt_role
  tasks_from: create_user

Am Dienstag, 23. Mai 2017 16:10:32 UTC+2 schrieb [email protected]:
>
> Hello everyone,
>
> I did not found a elegant way of sharing tasks list between roles.
> I explain my problem :
> 1 I have a first role in which i include tasks (IE create_user.yml) so i 
> put the file in my_firt_role/tasks/create_user.yml
> 2 I am writing an other role in which i would like to use the tasks 
> create_user.yml too
>
> The only solutions i found to use it in both playbooks are :
> hardcode the path of a common dir in my roles includes ( 
> /var/ansible/common/create_user.yml)
> duplicate the tasks in each playbook
> I was expecting a way to configure tasks lookup directories (like 
> role_path for roles) in ansible.cfg
> I try also to add a role dependencies but it seems that the pulled roles 
> are not sharing  tasks to upper roles.
>
> Am I missing an Ansible feature or good practice ?
> Any ideas to improve tasks re-usability and avoid duplication ?
>
> Regards,
>
> Efflam
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/bedb65a6-8443-4a2d-9d97-9dac604c5110%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to