feat(package): use apt-pinning to pin specific package version
Available only on Debian family OS-es
This commit is contained in:
parent
e47acb487d
commit
98ad87a001
@ -24,6 +24,10 @@ salt:
|
|||||||
# Optional: set salt version (if install_packages is set to true)
|
# Optional: set salt version (if install_packages is set to true)
|
||||||
version: 2017.7.2-1.el7
|
version: 2017.7.2-1.el7
|
||||||
|
|
||||||
|
# Pin version provided under 'version' key by using apt-pinning
|
||||||
|
# available only on Debian family OS-es
|
||||||
|
pin_version: false
|
||||||
|
|
||||||
# to overwrite map.jinja salt packages
|
# to overwrite map.jinja salt packages
|
||||||
lookup:
|
lookup:
|
||||||
salt_master: 'salt-master'
|
salt_master: 'salt-master'
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
---
|
---
|
||||||
salt:
|
salt:
|
||||||
version: ''
|
version: ''
|
||||||
|
pin_version: false
|
||||||
py_ver: '' ## py2 is default
|
py_ver: '' ## py2 is default
|
||||||
rootuser: root
|
rootuser: root
|
||||||
rootgroup: root
|
rootgroup: root
|
||||||
|
@ -2,6 +2,11 @@
|
|||||||
{%- from tplroot ~ "/map.jinja" import salt_settings with context %}
|
{%- from tplroot ~ "/map.jinja" import salt_settings with context %}
|
||||||
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
|
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
|
||||||
|
|
||||||
|
{% if salt_settings.pin_version and salt_settings.version and grains.os_family|lower == 'debian' %}
|
||||||
|
include:
|
||||||
|
- .pin
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
salt-master:
|
salt-master:
|
||||||
{% if salt_settings.install_packages %}
|
{% if salt_settings.install_packages %}
|
||||||
pkg.installed:
|
pkg.installed:
|
||||||
|
@ -2,6 +2,11 @@
|
|||||||
{%- from tplroot ~ "/map.jinja" import salt_settings with context %}
|
{%- from tplroot ~ "/map.jinja" import salt_settings with context %}
|
||||||
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
|
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
|
||||||
|
|
||||||
|
{% if salt_settings.pin_version and salt_settings.version and grains.os_family|lower == 'debian' %}
|
||||||
|
include:
|
||||||
|
- .pin
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if salt_settings.install_packages and grains.os == 'MacOS' %}
|
{% if salt_settings.install_packages and grains.os == 'MacOS' %}
|
||||||
download-salt-minion:
|
download-salt-minion:
|
||||||
{% if salt_settings.salt_minion_pkg_source %}
|
{% if salt_settings.salt_minion_pkg_source %}
|
||||||
|
22
salt/pin.sls
Normal file
22
salt/pin.sls
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{%- 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 %}
|
Loading…
Reference in New Issue
Block a user