keithresar / ansible-minneapolis-meetup-topics

Topics and schedule for Minneapolis Ansible Meetups
14 stars 0 forks source link

Role routing #37

Open keithresar opened 6 years ago

keithresar commented 6 years ago

Item 7 from http://blog.ippon.tech/ansible-tips-and-tricks/

...Technically, a role presents a single entry point, its tasks/main.yml. Because of this design, one might think it's difficult to have a role accomplish several actions (without using tags, cf below, or includes).

And still, there is a way to write reusable roles easily, including different unrelated operations.

Using a variable to decide which action to perform, you can have a small operation router inside your role