So the task file roles/foo/tasks/main.yml is always loaded, however this pattern is common:
main.yml: ---- - include: debian.yml when: "ansible_os_family == 'Debian'" - include: redhat.yml when: "ansible_os_family == 'RedHat'" - include: common.yml # all the time without conditionals. Hope this helps! On Fri, Mar 14, 2014 at 1:25 PM, James Goodhouse <[email protected]>wrote: > When specifying a role to use in a playbook, is it possible to target a > different file other than main.yml? I ask because I'm struggling to find > the proper way to layout a playbook and role for my project. > > Currently I have roles created for common tasks like nginx, mysql, > varnish, etc. I also have a role created specifically for my project. > Inside that role I handle things like installing project specific things > like APC, memcache, etc. These are each handled by a separate file that is > included in the main.yml. I also have a file for deployment that is also > included in the main.yml. However, I don't really want to have code deploy > each time I provision a server. > > My thought was to create a deploy.yml file in the root and somehow include > the role for the project, but just the deploy portion. > > How are people handling this with their projects? > > -- > 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/445571b4-e587-4216-83fe-a8252d72c576%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/445571b4-e587-4216-83fe-a8252d72c576%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CAEVJ8QP87pz_6xHfHPp4BvbOkMFh1%2Bs8xZ90-x-5c-iBJuMs2w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
