Specifying roles dynamically at runtime for playbooks

25 views
Skip to first unread message

Sankalp Khare

unread,
Sep 23, 2014, 7:29:34 PM9/23/14
to ansible...@googlegroups.com
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 <inven> role-applier.yml --extra-vars 'roles=["X","Y","Z"]'

Thanks,
Sankalp

Will Thames

unread,
Sep 23, 2014, 9:08:00 PM9/23/14
to ansible...@googlegroups.com
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
Reply all
Reply to author
Forward
0 new messages