Install SW across different distributions

26 views
Skip to first unread message

Riccardo Murri

unread,
Apr 18, 2016, 11:05:13 AM4/18/16
to ansible...@googlegroups.com
Hello,

I am editing some playbooks that should be able to install software
across different distrubutions. Since Ansible 2.0 there is the
OS-independent package manager module; however, actual package names
vary across distrubutions: e.g., the `/usr/bin/ssh` command comes from
package `openssh-clients` in Fedora but `openssh-client` on
Debian/Ubuntu.

The only solution I can think of is to define a variable that maps
distro + some arbitrary SW name to the actual package name (pseudocode)::

vars:
- provides:
- ssh:
- RedHat: openssh-clients
- Debian: openssh-client

tasks:
- name: Install SSH client
package:
name={{ provides['ssh'][ansible_os_family] }}

Are there better / more clever solutions out there? Or is such a list
of corresponding packages already available and maintained?

Thanks for any hint!

Riccardo


Dejay Clayton

unread,
May 12, 2016, 4:41:13 PM5/12/16
to Ansible Project, riccard...@uzh.ch
On Monday, April 18, 2016 at 11:05:13 AM UTC-4, Riccardo Murri wrote:
I am editing some playbooks that should be able to install software
across different distrubutions.

Ansible isn't really built for that type of reusable, environment-agnostic logic.  Ansible is more declarative, meaning that you have to specify exactly how the environment should look in total detail.  I agree that it would be nice to have more composable, reusable logic within playbooks and roles.

Johannes Kastl

unread,
May 13, 2016, 4:26:10 PM5/13/16
to ansible...@googlegroups.com
On 18.04.16 17:02 Riccardo Murri wrote:

> Are there better / more clever solutions out there? Or is such a list
> of corresponding packages already available and maintained?

I manually created groups after OS, so I have one group centos which
contains all the centos machines. One with freebsd and so on.

And then you can set these kind of things in the group_vars files.

I do not know if you can avoid putting the hosts in groups manually,
that would be nice. But in reality it is not that much work.

Johannes

signature.asc
Reply all
Reply to author
Forward
0 new messages