Say, I want to write a module which installs a package, and runs a service. I want to include most OS-es (well, Linuxes at least). For this, I need to know:
- the package manager in use (am I going to add a yum or an apt repo?)
- the init system in use (am I going to add config for SysV, upstart, systemd?)
... now, Puppets [documentation for packages](https://docs.puppetlabs.com/references/latest/type.html#package-attribute-provider) and for [services](https://docs.puppetlabs.com/references/latest/type.html#service-attribute-provider) just claim 'Puppet will usually find this out on its own', however, as I need to code adding that repo, or figure out which init config file to put where, does it actually _expose_ this kind of information anywhere? Looking through facts & code, I don't see it anywhere, and looking at some mature modules they all seem to re-invent the wheel in checking operating systems & going for what should be default there. So, in short, my question is:
- Does Puppet itself expose this kind of information anywhere in a module?
- And if not, is there a module specifically to do this, which I can use?
... because basically, having just an `if $::packagemanager == 'yum'` or `if $::initsystem == 'upstart'` does seem a whole lot cleaner than an entire tree of `$::osfamily` stuff, with all the possible version comparisons as well.
↧