Skip to content

How to manage salt cache

bmemmott71 edited this page Apr 11, 2019 · 2 revisions

Salt has a tendency to quickly fill up the /var/cache/salt/master/jobs directory

How to reduce the size of the default job cache:
see: https://docs.saltstack.com/en/latest/topics/jobs/job_cache.html
Stop salt-master service:
systemctl stop salt-master
vi /etc/salt/master
job_cache: False
keep_jobs: 1
Verify config file with out # lines:
cat /etc/salt/master | grep -E "^[^#]"
How to clear salt-master cache:
rm -rfv /var/cache/salt/master/jobs/*
Note: It can take some time to delete the cache, so monitor with:
watch "ls -al /var/cache/salt/master/jobs/ | wc -l"
or count # of sub-directories & Jobs:
find /var/cache/salt/master/jobs/ -name "*" | wc -l
When done, start salt-master service:
systemctl start salt-master
How to change ownership of files/directories to salt:salt:
chown -R salt:salt /var/cache/salt/master/jobs/*
find /var/cache/salt/master/jobs -group root -name "*"