-5

Package names do differ on different platforms. Some call it httpd some apache2...

Imagine your product supports RedHat, SuSE and Ubuntu. Each in two versions.

Do you keep six lists of packages to install in your configuration management?

AFAIK this question is valid for all common products like Salt, Puppet, Chef, Ansible

Update

This question got a lot of down-votes. For me this means: This question is known and a lot of people hate the situation. And: No one has an answer.

I found this: There is a project on github which tries to bring sanity into this package naming chaos:

https://github.com/unixpackage/unixpackage

One command to install equivalent packages in Ubuntu, Debian, CentOS, Fedora, Red Hat and Mac OS X. UnixPackage is a UNIX independent way of installing packages. Specify the Ubuntu package name (e.g. libpq-dev), and it will install the equivalent on your system (e.g. postgresql-libs on Arch).

guettli
  • 3,113
  • 14
  • 59
  • 110
  • I suggest you check the tools in question to see how they do it. I know for a fact how the official Puppet Apache module for example handles this, I'm sure the other tools do something similar. – bodgit Aug 16 '16 at 10:37
  • I'm not aware of anything in general that handles this for package installation and I've used all of the systems mentioned. There might be one-off solutions for mysql or apache httpd, but not for the rest of packages. I'm working on a map of Perl module to rpm to deb to deal with a small slice of this problem. – chicks Aug 16 '16 at 22:01
  • @chicks I am interested. How do you handle the map of Perl modules for rpm and deb? – guettli Aug 17 '16 at 09:01
  • https://github.com/fini-net/fini-web-manager/blob/master/bin/fini-reqs#L78 Just my manual way of trying to build portable web apps. This is still in the early stages and there are on docs yet. – chicks Aug 17 '16 at 12:34
  • 1
    I guess there is no real best practice because it is IMHO not a good practice to maintain a zoo of distributions in a network. Beside package names many other things differ among different distributions. – Henrik Pingel Aug 17 '16 at 20:05
  • @knowhy the support for different platforms was not invented by me. It's my job, and I like it. The problem looks solvable. I just unsure how to do it. – guettli Aug 18 '16 at 08:06
  • The Ansible way is to do something like this: `- include: setup-RedHat.yml when: ansible_os_family == 'RedHat'` [example](https://github.com/geerlingguy/ansible-role-nginx/tree/master/tasks) – Henrik Pingel Aug 18 '16 at 14:59
  • @knowhy that's a valid answer. If you write your comment as answer, I will up-vote it. – guettli Aug 19 '16 at 08:34

2 Answers2

1

I guess there is no real best practice because it is IMHO not a good practice to maintain a zoo of distributions in a network. Beside package names many other things (usernames, paths, etc) differ among different distributions. However every configuration management system will feature a way to solve this problem.

The Ansible way is to do something like this for tasks:

- include: setup-RedHat.yml
  when: ansible_os_family == 'RedHat'

and for the variable setup something like this:

- name: Include OS-specific variables.
  include_vars: "{{ ansible_os_family }}.yml"

The file setup-RedHat.yml would then contain all the tasks specific to RHEL distributions and the variable file redhat.yml all the variable declarations specific to RHEL distributions.

Henrik Pingel
  • 8,676
  • 2
  • 24
  • 38
0

At least salt has common names for the packages and translates them in its scripts according to the targets linux flavour

Thomas SV
  • 53
  • 5
  • 1
    are you sure? I asked there some days ago. Maybe I am missing something, but AFAIK there is no translations of package names: https://github.com/saltstack/salt/issues/35377 – guettli Aug 16 '16 at 12:19
  • No, I'm not anymore. Once there were tutorials showing the solution for that problem. But I can not find them anymore. Sorry. Should I delete my answer? – Thomas SV Aug 30 '16 at 06:57
  • I am unsure. Would be nice if you could find the tutorial showing the solution. – guettli Aug 30 '16 at 07:47
  • Salt makes it pretty easy to do this yourself. Just create pillar data that matches on the OS such that each OS gets the proper package name, then the Salt states just refer to the pillar value for the package. – Utah_Dave Oct 12 '16 at 20:52