ansible-examples icon indicating copy to clipboard operation
ansible-examples copied to clipboard

Allow examples to run on multiple distributions

Open m8ram opened this issue 6 years ago • 2 comments

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.

m8ram avatar Apr 05 '18 13:04 m8ram

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.

scheerchrs avatar Apr 06 '18 15:04 scheerchrs

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.

m8ram avatar Apr 08 '18 09:04 m8ram