Ansible has recently introduced new syntax for including tasks, roles and vars into task lists using import_tasks, include_tasks, include_vars etc and deprecated the old syntax include.

Gem Version Linux Build Status

Initially I found this a bit confusing, but after a bit of study, I find them to be quite powerful. In particular it now seems possible to implement File Specificity which might go some way to clean up messy task lists with when: ansible_distribtion==XX conditions

Chef supports the notion of File specificity for templates, so looks for files in a decreasing order of specificity, and ending with a defaul file, if nothing else is found.

For example it allows this resource to be used for multiple OS

template '/etc/httpd/conf.d/apache.conf' do
  source 'apache.conf'
end

and then have chef pull the appropriate file format based on the

mycookbook/
templates/Redhat-6/apache.conf
templates/Redhat-7/apache.conf
templates/Debian/apache.conf
templates/apache.conf
    /host-$fqdn/$source
    /$platform-$platform_version/$source
    /$platform/$source
    /default/$source
    /$source

rwr