sorin
sorin

Reputation: 170430

How to I tell salt to install one package or another?

In order to successfully install something I need the add-apt-repository command, which happens to be inside python-software-properties on some distros or on common-software-properties.

That is the easiest way to write .sls file that will do this and install one of these packages.

Upvotes: 0

Views: 433

Answers (1)

Dan Garthwaite
Dan Garthwaite

Reputation: 3526

Use jinja conditionals and minion grains.

The following assumes I got the pairing correct for RedHat

add-apt-repository:
  pkgs.installed:
    - pkgs:
      {% if grains['os_family'] == 'RedHat' %}
      - common-software-properties
      {% elif grains['os_family'] == 'Debian' %}
      - python-software-properties
      {% endif %}

Upvotes: 2

Related Questions