0
0
mirror of https://github.com/saltstack-formulas/salt-formula.git synced 2024-12-18 08:22:54 +01:00
salt-formula/salt/pin.sls
hatifnatt 98ad87a001 feat(package): use apt-pinning to pin specific package version
Available only on Debian family OS-es
2020-03-18 22:49:28 +03:00

23 lines
873 B
Plaintext

{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import salt_settings with context %}
{% if salt_settings.pin_version and salt_settings.version and grains.os_family|lower == 'debian' %}
salt-pin-version:
file.managed:
- name: /etc/apt/preferences.d/salt
- contents: |
# This file managed by Salt, do not edit by hand!!
Package: salt*
Pin: version {{ salt_settings.version }}
Pin-Priority: 1000
# Order: 2 because we can't put a require_in on "pkg: salt-{master,minion}"
# because we don't know if they are used, and 'order: 1' already occupied by salt-pkgrepo
- order: 2
{% elif grains.os_family|lower != 'debian' %}
salt-pin-version:
test.show_notification:
- name: Available on Debian family OS-es only
- text: Apt pinning available only on Debian based distributives
{% endif %}