[NetSIG] ansible question - will the generic package module work for more niche linux distros?

Greg H greg.horie at gmail.com
Fri Jun 25 12:41:09 EDT 2021


I checked the ansible docs for this one -
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/package_module.html

This modules manages packages on a target without specifying a package
manager module (like ansible.builtin.yum, ansible.builtin.apt, etc.). It is
convenient to use in an heterogeneous environment of machines without
having to create a specific task for each package manager. package calls
behind the module for the package manager used by the operating system
discovered by the module ansible.builtin.setup. If setup was not yet run,
package will run it.

So I guess the answer is maybe? It really depends on what distros the
ansible developers added support for. I'm not finding direct references, so
you'd probably have to test it on your distro or read the ansible code on
github. I did find modules for both apk and pacman, so there are
alternatives.

Also, you can see that the package module uses facts (i.e. the setup
module) to discover the distro before it installs the package on the target
machine. This is a nice example of how facts can be used to enhance your
ansible logic.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://vicpimakers.ca/pipermail/netsig_vicpimakers.ca/attachments/20210625/3def8752/attachment.htm>


More information about the NetSIG mailing list