Looking for feedback on what should go into a role.

I've created a 'common' role that will be applied to ALL my hosts.  It 
contains things like /etc/motd, snmp server settings, and ntp settings.  
Currently I have defined things like this: 

site-role.yml:

- hosts: all
  roles:
    - common

Directory layout:

roles/
|-- common
|   |-- handlers
|   |   `-- main.yml
|   |-- tasks
|   |   `-- main.yml
|   `-- templates
|       |-- motd
|       |-- ntp.conf
|       |-- syslog-ng.conf
|       `-- syslog-ng.logrotate

But I've been wondering if I should separate the various components into 
separate roles, like this:

Proposed site-role.yml

- hosts: all
  roles:
    - ntp
    - motd
    - snmp

Proposed directory layout:

roles/
|-- motd
|   |-- handlers
|   |-- tasks
|   `-- templates
|-- ntp
|   |-- handlers
|   |-- tasks
|   `-- templates
`-- snmp
    |-- handlers
    |-- tasks
    `-- templates

Again, all my hosts will get all of these things all the time, so I'm never 
going to have a reason to reference one of these role and not another.  

I'm happy with my current layout, but the second layout looks more like 
various Ansible examples I see out on the 'net and what's in the official 
Ansible docs. But my current layout makes more sense to me - all hosts need 
the stuff, so why spread it out to multiple roles versus just the one?

What's everybody else's opinions on these layouts? When is one more 
appropriate than the other?

thx
Chris.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/99ead413-80d1-412b-9da1-8766fde15486%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to