How to create a patch and ensure it is applied within Salt Stack
Tags
salt-stack techniques
Quick tutorial on how to create a patch and ensure it is applied using salt stack.
Procedure
Creating a patch
Create a copy of original file
cp file file.orig
Modify file, and test
Create a md5 sum of the modified file for later use
cat file | md5sum
Revert modification, then prepare patch
mv file file.mod
cp file.orig fileCreate diff
diff -Naur file file.mod > file.patch
Create Salt stack manifest block in appropriate state file
Add a block similar to this as a patch state definition. Make sure it is refered at least in your top.sls
/usr/share/ganglia-webfrontend/auth.php:
file.patch:
- source: salt://monitor/auth.php.patch
- hash: md5=480ef2ae17fdfee85585ab887fa1ae5f