salt.modules.salt_version

Access Salt's elemental release code-names.

New in version 3000.

Salt's feature release schedule is based on the Periodic Table, as described in the Version Numbers documentation.

When a feature was added (or removed) in a specific release, it can be difficult to build out future-proof functionality that is dependent on a naming scheme that moves.

For example, a state syntax needs to change to support an option that will be removed in the future, but there are many Minion versions in use across an infrastructure. It would be handy to use some Jinja syntax to check for these instances to perform one state syntax over another.

A simple example might be something like the following:

{# a boolean check #}
{% set option_deprecated = salt['salt_version.less_than']("Sodium") %}

{% if option_deprecated %}
  <use old syntax>
{% else %}
  <use new syntax>
{% endif %}
salt.modules.salt_version.equal(name)

Returns a boolean (True) if the minion's current version code name matches the named version.

name

The release code name to check the version against.

CLI Example:

salt '*' salt_version.equal 'Oxygen'
salt.modules.salt_version.get_release_number(name)

Returns the release number of a given release code name in a MAJOR.PATCH format (for Salt versions < 3000) or MAJOR for newer Salt versions.

If the release name has not been given an assigned release number, the function returns a string. If the release cannot be found, it returns None.

name

The release code name for which to find a release number.

CLI Example:

salt '*' salt_version.get_release_number 'Oxygen'
salt.modules.salt_version.greater_than(name)

Returns a boolean (True) if the minion's current version code name is greater than the named version.

name

The release code name to check the version against.

CLI Example:

salt '*' salt_version.greater_than 'Oxygen'
salt.modules.salt_version.less_than(name)

Returns a boolean (True) if the minion's current version code name is less than the named version.

name

The release code name to check the version against.

CLI Example:

salt '*' salt_version.less_than 'Oxygen'