feat(package): allow for salt package version hold
This commit is contained in:
parent
7af4524f22
commit
11b017e6a8
@ -24,9 +24,11 @@ salt:
|
||||
# Optional: set salt version (if install_packages is set to true)
|
||||
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
|
||||
# These 2 options apply only to yum/dnf, apt, and zypper-based systems:
|
||||
# Force the package to be held at the installed version (optional)
|
||||
hold_version: false
|
||||
# Allow the upgrade or downgrade of a "held" package version (optional)
|
||||
update_holds: false
|
||||
|
||||
# to overwrite map.jinja salt packages
|
||||
lookup:
|
||||
|
@ -10,6 +10,12 @@ salt-api:
|
||||
{%- if salt_settings.version is defined %}
|
||||
- version: {{ salt_settings.version }}
|
||||
{%- endif %}
|
||||
{%- if salt_settings.hold_version is defined %}
|
||||
- hold: {{ salt_settings.hold_version }}
|
||||
{%- endif %}
|
||||
{%- if salt_settings.update_holds is defined %}
|
||||
- update_holds: {{ salt_settings.update_holds }}
|
||||
{%- endif %}
|
||||
{% endif %}
|
||||
{% if salt_settings.api_service_details.state != 'ignore' %}
|
||||
service.{{ salt_settings.api_service_details.state }}:
|
||||
|
@ -1,6 +1,11 @@
|
||||
{%- set tplroot = tpldir.split('/')[0] %}
|
||||
{% from "salt/map.jinja" import salt_settings with context %}
|
||||
|
||||
{% if salt_settings.hold_version is defined and salt_settings.install_packages %}
|
||||
include:
|
||||
- .hold
|
||||
{% endif %}
|
||||
|
||||
{%- if salt_settings.use_pip %}
|
||||
python-pip:
|
||||
pkg.installed
|
||||
@ -24,6 +29,12 @@ salt-cloud:
|
||||
{%- if salt_settings.version is defined %}
|
||||
- version: {{ salt_settings.version }}
|
||||
{%- endif %}
|
||||
{%- if salt_settings.hold_version is defined %}
|
||||
- hold: {{ salt_settings.hold_version }}
|
||||
{%- endif %}
|
||||
{%- if salt_settings.update_holds is defined %}
|
||||
- update_holds: {{ salt_settings.update_holds }}
|
||||
{%- endif %}
|
||||
{%- if salt_settings.use_pip %}
|
||||
- require:
|
||||
- pip: salt-cloud-pip-packages
|
||||
|
12
salt/hold.sls
Normal file
12
salt/hold.sls
Normal file
@ -0,0 +1,12 @@
|
||||
{%- set tplroot = tpldir.split('/')[0] %}
|
||||
{%- from tplroot ~ "/map.jinja" import salt_settings with context %}
|
||||
|
||||
{% if salt_settings.hold_version is defined and grains.os_family|lower == 'redhat' %}
|
||||
salt-install-hold-plugin:
|
||||
pkg.installed:
|
||||
{% if grains.osmajorrelease > 7 %}
|
||||
- name: python3-dnf-plugin-versionlock
|
||||
{% else %}
|
||||
- name: yum-plugin-versionlock
|
||||
{% endif %}
|
||||
{% endif %}
|
@ -2,9 +2,9 @@
|
||||
{%- from tplroot ~ "/map.jinja" import salt_settings 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' %}
|
||||
{% if salt_settings.hold_version is defined and salt_settings.install_packages %}
|
||||
include:
|
||||
- .pin
|
||||
- .hold
|
||||
{% endif %}
|
||||
|
||||
{%- if grains.kernel != 'Windows' %}
|
||||
@ -26,6 +26,12 @@ salt-master:
|
||||
- name: {{ salt_settings.salt_master }}
|
||||
{%- if salt_settings.version is defined %}
|
||||
- version: {{ salt_settings.version }}
|
||||
{%- endif %}
|
||||
{%- if salt_settings.hold_version is defined %}
|
||||
- hold: {{ salt_settings.hold_version }}
|
||||
{%- endif %}
|
||||
{%- if salt_settings.update_holds is defined %}
|
||||
- update_holds: {{ salt_settings.update_holds }}
|
||||
{%- endif %}
|
||||
{% if salt_settings.master_service_details.state != 'ignore' %}
|
||||
- require_in:
|
||||
|
@ -2,9 +2,9 @@
|
||||
{%- from tplroot ~ "/map.jinja" import salt_settings 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' %}
|
||||
{% if salt_settings.hold_version is defined and salt_settings.install_packages %}
|
||||
include:
|
||||
- .pin
|
||||
- .hold
|
||||
{% endif %}
|
||||
|
||||
{%- if grains.os == 'MacOS' %}
|
||||
@ -68,8 +68,14 @@ salt-minion:
|
||||
{%- elif grains.os != 'MacOS' and "workaround https://github.com/saltstack/salt/issues/49348" %}
|
||||
pkg.installed:
|
||||
- name: {{ salt_settings.salt_minion }}
|
||||
{%- if salt_settings.version %}
|
||||
{%- if salt_settings.version is defined %}
|
||||
- version: {{ salt_settings.version }}
|
||||
{%- endif %}
|
||||
{%- if salt_settings.hold_version is defined %}
|
||||
- hold: {{ salt_settings.hold_version }}
|
||||
{%- endif %}
|
||||
{%- if salt_settings.update_holds is defined %}
|
||||
- update_holds: {{ salt_settings.update_holds }}
|
||||
{%- endif %}
|
||||
{% if salt_settings.minion_service_details.state != 'ignore' %}
|
||||
- require_in:
|
||||
|
11
salt/ssh.sls
11
salt/ssh.sls
@ -1,6 +1,11 @@
|
||||
{%- set tplroot = tpldir.split('/')[0] %}
|
||||
{% from "salt/map.jinja" import salt_settings with context %}
|
||||
|
||||
{% if salt_settings.hold_version is defined and salt_settings.install_packages %}
|
||||
include:
|
||||
- .hold
|
||||
{% endif %}
|
||||
|
||||
{% if salt_settings.install_packages %}
|
||||
ensure-salt-ssh-is-installed:
|
||||
pkg.installed:
|
||||
@ -8,6 +13,12 @@ ensure-salt-ssh-is-installed:
|
||||
{%- if salt_settings.version is defined %}
|
||||
- version: {{ salt_settings.version }}
|
||||
{%- endif %}
|
||||
{%- if salt_settings.hold_version is defined %}
|
||||
- hold: {{ salt_settings.hold_version }}
|
||||
{%- endif %}
|
||||
{%- if salt_settings.update_holds is defined %}
|
||||
- update_holds: {{ salt_settings.update_holds }}
|
||||
{%- endif %}
|
||||
{% endif %}
|
||||
|
||||
ensure-roster-config:
|
||||
|
@ -1,6 +1,11 @@
|
||||
{%- set tplroot = tpldir.split('/')[0] %}
|
||||
{% from "salt/map.jinja" import salt_settings with context %}
|
||||
|
||||
{% if salt_settings.hold_version is defined and salt_settings.install_packages %}
|
||||
include:
|
||||
- .hold
|
||||
{% endif %}
|
||||
|
||||
salt-minion-standalone:
|
||||
{% if salt_settings.install_packages %}
|
||||
pkg.installed:
|
||||
@ -8,6 +13,12 @@ salt-minion-standalone:
|
||||
{%- if salt_settings.version is defined %}
|
||||
- version: {{ salt_settings.version }}
|
||||
{%- endif %}
|
||||
{%- if salt_settings.hold_version is defined %}
|
||||
- hold: {{ salt_settings.hold_version }}
|
||||
{%- endif %}
|
||||
{%- if salt_settings.update_holds is defined %}
|
||||
- update_holds: {{ salt_settings.update_holds }}
|
||||
{%- endif %}
|
||||
{% endif %}
|
||||
file.recurse:
|
||||
- name: {{ salt_settings.config_path }}/minion.d
|
||||
|
@ -9,6 +9,12 @@ salt-syndic:
|
||||
- name: {{ salt_settings.salt_syndic }}
|
||||
{%- if salt_settings.version is defined %}
|
||||
- version: {{ salt_settings.version }}
|
||||
{%- endif %}
|
||||
{%- if salt_settings.hold_version is defined %}
|
||||
- hold: {{ salt_settings.hold_version }}
|
||||
{%- endif %}
|
||||
{%- if salt_settings.update_holds is defined %}
|
||||
- update_holds: {{ salt_settings.update_holds }}
|
||||
{%- endif %}
|
||||
- require_in:
|
||||
- service: salt-syndic
|
||||
|
Loading…
Reference in New Issue
Block a user