using role for deployment across multiple OSs

Hi,

About to write my first role-based playbook, and wanted to verify I
understand the Ansible Way before getting myself in trouble.

I need to deploy software across multiple operating systems. I want to
reuse as much as possible, such as config file templates. As a
specific example: I need to deploy zabbix-agentd across FreeBSD,
CentOS, and Ubuntu hosts. The template for the zabbix-agentd.conf file
is identical across all platforms.

It seems that the right way to do this is with roles. Have an
os-specific role for apt, yum, pkg, and suchforth, and a zabbix-agent
role that contains the config file template and the "service restart"
stuff, then to organize the playbook something like this.

You have some slightly off syntax at the top, but that’s basically it.

The group_by module is very useful for creating dynamic groups based on host OS to if you want.