FAQ
Hey group,

An open question to you all. How do you handle installing packages that
have different names for different distributions while keeping with DRYness?

I've gone through of a few different ways but I'm curious to see how others
are handling this. Currently in a sort of 'base/packages.sls' I have what
looks like this:

{% if grains['os_family'] == 'RedHat' %}
   {% set vim = 'vim-enhanced' %}
{% else %}
   {% set vim = 'vim' %}
{% endif %}

{{ vim }}:
   pkg.installed

Is there a better way that's more sustainable as the package list grows and
the distribution complexity increases?

--
Stephen Wood
www.heystephenwood.com

--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Vye at Jul 16, 2014 at 4:58 pm
    Have you looked at the Salt formula documentation? There's lots of
    good information there. Using variations of the map.jinja example may
    be what you're looking for.

    http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html#map-jinja
    On Wed, Jul 16, 2014 at 9:47 AM, Stephen Wood wrote:
    Hey group,

    An open question to you all. How do you handle installing packages that have
    different names for different distributions while keeping with DRYness?

    I've gone through of a few different ways but I'm curious to see how others
    are handling this. Currently in a sort of 'base/packages.sls' I have what
    looks like this:

    {% if grains['os_family'] == 'RedHat' %}
    {% set vim = 'vim-enhanced' %}
    {% else %}
    {% set vim = 'vim' %}
    {% endif %}

    {{ vim }}:
    pkg.installed

    Is there a better way that's more sustainable as the package list grows and
    the distribution complexity increases?

    --
    Stephen Wood
    www.heystephenwood.com

    --
    You received this message because you are subscribed to the Google Groups
    "Salt-users" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to salt-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.


    --
    -Vye

    --
    You received this message because you are subscribed to the Google Groups "Salt-users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Vye at Jul 16, 2014 at 5:04 pm
    Another good resource are the salt formula repos here:
    https://github.com/saltstack-formulas. A lot of those formulas support
    multiple distros.
    On Wed, Jul 16, 2014 at 9:58 AM, Vye wrote:
    Have you looked at the Salt formula documentation? There's lots of
    good information there. Using variations of the map.jinja example may
    be what you're looking for.

    http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html#map-jinja
    On Wed, Jul 16, 2014 at 9:47 AM, Stephen Wood wrote:
    Hey group,

    An open question to you all. How do you handle installing packages that have
    different names for different distributions while keeping with DRYness?

    I've gone through of a few different ways but I'm curious to see how others
    are handling this. Currently in a sort of 'base/packages.sls' I have what
    looks like this:

    {% if grains['os_family'] == 'RedHat' %}
    {% set vim = 'vim-enhanced' %}
    {% else %}
    {% set vim = 'vim' %}
    {% endif %}

    {{ vim }}:
    pkg.installed

    Is there a better way that's more sustainable as the package list grows and
    the distribution complexity increases?

    --
    Stephen Wood
    www.heystephenwood.com

    --
    You received this message because you are subscribed to the Google Groups
    "Salt-users" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to salt-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.


    --
    -Vye


    --
    -Vye

    --
    You received this message because you are subscribed to the Google Groups "Salt-users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • JC Lawrence at Jul 16, 2014 at 5:08 pm
    A dict lookup seems simple. Something like:

    pkgmap = {"RedHat" : {
                         "vim": "vim-enhanced",
                         "foo": "bar",
                         ...etc},
                       "Solaris": {...}
                       "Ubuntu": {...}

                      }

    {{ pkgmap[grains['os_family']['thing_I_want'] }}
       pkg.installed

    -- JCL
    On 16 Jul 2014, at 09:58, Vye wrote:

    Have you looked at the Salt formula documentation? There's lots of
    good information there. Using variations of the map.jinja example may
    be what you're looking for.

    http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html#map-jinja
    On Wed, Jul 16, 2014 at 9:47 AM, Stephen Wood wrote:
    Hey group,

    An open question to you all. How do you handle installing packages that have
    different names for different distributions while keeping with DRYness?

    I've gone through of a few different ways but I'm curious to see how others
    are handling this. Currently in a sort of 'base/packages.sls' I have what
    looks like this:

    {% if grains['os_family'] == 'RedHat' %}
    {% set vim = 'vim-enhanced' %}
    {% else %}
    {% set vim = 'vim' %}
    {% endif %}

    {{ vim }}:
    pkg.installed

    Is there a better way that's more sustainable as the package list grows and
    the distribution complexity increases?

    --
    Stephen Wood
    www.heystephenwood.com

    --
    You received this message because you are subscribed to the Google Groups
    "Salt-users" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to salt-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.


    --
    -Vye

    --
    You received this message because you are subscribed to the Google Groups "Salt-users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "Salt-users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupsalt-users @
postedJul 16, '14 at 4:48p
activeJul 16, '14 at 5:08p
posts4
users3

3 users in discussion

Vye: 2 posts JC Lawrence: 1 post Stephen Wood: 1 post

People

Translate

site design / logo © 2022 Grokbase