I'm in the position of having written a module for Solaris SMF
services and SVR4 packages, both of which I was planning to send a
pull request for this week.
I had written entirely new modules for these for 2 reasons:
1) I had read somewhere, although I can't remember where, that the
philosophy of Ansible was that when there are different features (e.g.
yum vs apt) that there should be different modules, avoiding the need
to rely on a lowest common denominator.
Yep, definitely true of packaging. We're trying to keep user and
service together now though, and the service
module I think is eventually going to be refactored to use the new way
'user' does OS detection, and that will clean it
up some.
The main reason I like packaging seperate is the package names are
almost never the same between distros, and the idea
that you can have an easy OS independent playbook for something
involving a package is pretty unlikely. This just
makes it evident what you are dealing with.
I think this also ends up keeping the various packaging code a lot
easier to sort through.
2) Both of them have attributes that do not appear in the existing
modules (e.g SMF services have properties that can be set on them,
different for every service).
There might be a way to just add a "properties" option to the service
module in this case. Maybe you can share
what you have on github so I could understand better?
I'm not really a Solaris guy.
It sounds from the below that I now need to think of a different
approach. Is that true?
More directly relevant to the immediate discussion is that in this new
model, it's not clear to me how to handle features that are present
only in a single implementation. For example, at user creation time
Solaris allows the assignment of RBAC profiles and auths, project
membership, process privileges and resource controls among others. How
would I implement these options in a generic user module? I may have
missed something while reading the source on my phone screen, so feel
free to point at an example.
Basically in this case what we would do is make the module option
available to *all* types of modules, and then
it should probably raise an error if used in a class that didn't support it.
We might also just name these parameters with a common prefix like
"solaris_" to make it clear they are only used
there, if we are pretty sure they are not applicable to other
operating systems in a similar way.
But it would be really really nice if "user: name=timmy state=present"
generally works on all platforms, for cases
when people don't need to worry about those extra properties... if
that's not the way it works, I'm ok with that.
Let me know if you have further questions and so forth. That's just
basically what I'm thinking at present.
I would *VERY* much like to see our modules learn to be smarter about
the other Unixes, so I'm quite excited by this.