# Install SW across different distributions

**URL:** <https://forum.ansible.com/t/install-sw-across-different-distributions/21194>\
**Category:** Ansible Project\
**Tags:** fedora, ubuntu\
**Created:** [April 18, 2016, 3:02pm UTC](https://forum.ansible.com/t/install-sw-across-different-distributions/21194 "2016-04-18T15:02:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Riccardo\_Murri1](https://avatars.discourse-cdn.com/v4/letter/r/fbc32d/32.png) [@Riccardo\_Murri1](https://forum.ansible.com/u/Riccardo_Murri1)\
**Post date:** [April 18, 2016, 3:02pm UTC](https://forum.ansible.com/t/install-sw-across-different-distributions/21194/1 "2016-04-18T15:02:19Z")

</div>

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)::

&nbsp;&nbsp;vars:  
&nbsp;&nbsp;&nbsp;&nbsp;- provides:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- ssh:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- RedHat: openssh-clients  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- Debian: openssh-client

&nbsp;&nbsp;tasks:  
&nbsp;&nbsp;&nbsp;&nbsp;- name: Install SSH client  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;package:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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

---

<div class="post-metadata">

**Author:** ![Dejay\_Clayton](https://avatars.discourse-cdn.com/v4/letter/d/6de8d8/32.png) [@Dejay\_Clayton](https://forum.ansible.com/u/Dejay_Clayton)\
**Post date:** [May 12, 2016, 8:41pm UTC](https://forum.ansible.com/t/install-sw-across-different-distributions/21194/2 "2016-05-12T20:41:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Johannes\_Kastl](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@Johannes\_Kastl](https://forum.ansible.com/u/Johannes_Kastl)\
**Post date:** [May 13, 2016, 8:26pm UTC](https://forum.ansible.com/t/install-sw-across-different-distributions/21194/3 "2016-05-13T20:26:04Z")

</div>

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
