Using reactors for Salt tasks
Now that we are aware of how the event and the reactor systems work in Salt, we can go ahead and look into some more advanced configurations involving using them to perform Salt tasks. In this recipe, we will learn how to perform a state run based on Salt events.
How to do it...
- Configure two new minions called
salt-minion-1
andsalt-minion-2
. - On the master, configure a new state module called
cron
in the staging environment and populate the/opt/salt/staging/cron/init.sls
file with the following entries:find /var/log/ -mtime +30 -exec rm -rf {] \;: cron.present: - user: root - minute: 00 - hour: 12 - daymonth: '*' - month: '*' - dayweek: '*'
- Edit the
/etc/salt/master.d/reactor.conf
file to have the following entries: ...
Get Salt Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.