ansible-examples
ansible-examples copied to clipboard
Allow examples to run on multiple distributions
Thanks for providing these examples. Could these examples be updated to show the best practices for dealing with multiple distributions?
The problem I run into now is that package names differ between distributions and the examples here only work on one of them. The LAMP examples should be a great place to add this because it is a typical example: apache2 versus httpd etc.
Thanks in advance.
Precurse your code with a "define is" type of statement. Think "if then else". If you can define the 'package names' in a separate block, then you can include that block definition within your code. Then the distribution/updates/system/node mods should work.
It would be great to see this in the examples. Some of the modules I've seen on galaxy/github do something like this in defaults, others in vars. And mostly I've seen this for e.g. Debian/Rhel but not for major versions of those distributions.