Skip to content

Instantly share code, notes, and snippets.

@deniszh
Created April 30, 2020 11:58
Show Gist options
  • Save deniszh/d9a09f469eb66496972114cfff6ab3a8 to your computer and use it in GitHub Desktop.
Save deniszh/d9a09f469eb66496972114cfff6ab3a8 to your computer and use it in GitHub Desktop.
How to patch Salt by salt
{% if grains.saltversion == "2016.11.6" %}
# Just in case there is no patch command installed
patch:
pkg.installed
# We use directory name here (saltpath) to apply patches that touch multiple files
saltmaster_security_patch:
file.patch:
- name: '{{ grains.saltpath }}'
- source: salt://saltstack/files/salt-2016.11-security.patch
- strip: 2
- require:
- pkg: patch
# Restart salt master after the patch is applied
restart_salt_master:
cmd.run:
- name: 'salt-call service.restart salt-master'
- bg: true
- onchanges:
- file: saltmaster_security_patch
{%- endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment