However, I notice that core user module seems to have extensibility built in since it automatically selects the best class based on the platforms/distributions defined in the subclasses. Short of cut-n-pasting the whole user module (1500 lines of code), is there a way of just writing the OS X extension and having it be automatically loaded for OS X platforms?
A good point. I’m not exactly sure how that helps me, though. It seems like my options are:
Cut-n-paste the entire group.py and user.py files into a custom module, minus the trouble of having to write it myself.
Wait for the merge conflicts to be resolved and for this to make it into some sort of development release.
Put together a custom build and installation of Ansible.
It seems like what I want to do in the short-term is extend the core module. Is there a way to extend the core module for just OS X without cut-n-pasting the entire user module?
(I realize I’m repeating my question from my original post here, but I’m not seeing how the pull request changes the situation other than it means I don’t have to write the Darwin implementations myself.)
"Cut-n-paste the entire group.py and user.py files into a custom module, minus the trouble of having to write it myself. "
Well, to answer the original question, extension in Ansible modules happens by module_utils/*.py, which exists in the main repo. So ansible does have a facility for sharing common code.
Normal remote modules however, cannot be trivially subclassed.
(This does not apply to action plugins, but that’s not helpful to your question in this case)