Specifying roles dynamically at runtime for playbooks

Hi,

I often come across the situation where I need to apply some roles X,Y,Z on a bunch of machines. How do I do that without having to edit the list of roles in a playbook? In other words, could there be something of the type :

$ ansible-playbook -i role-applier.yml --extra-vars ‘roles=[“X”,“Y”,“Z”]’

Thanks,
Sankalp

Have a look at tags. Tag the role includes in the playbook, and then just pass the appropriate tags to ansible-playbook

http://docs.ansible.com/playbooks_roles.html#id6

Will