O'Reilly logo

Salt Cookbook by Anirban Saha

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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...

  1. Configure two new minions called salt-minion-1 and salt-minion-2.
  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: '*'
  3. Edit the /etc/salt/master.d/reactor.conf file to have the following entries: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required