Using execution modules
Modules are the basic foundations of configuration management in Salt. Using Salt modules, we can configure systems from Salt state files, as well as from the command line. In this chapter, you will learn about how to use Salt modules from the command line.
How to do it...
Configure a minion in the staging environment. We will call it stgdc1log01
.
- Run the following command to list all the
cron
entries for theroot
user on the minion:[root@salt-master ~]# salt 'stgdc1log01' cron.list_tab root stgdc1log01: ---------- crons: env: pre: special:
- Run the following command to add a new
cron
entry for theroot
user:[root@salt-master ~]# salt 'stgdc1log01' cron.set_job root '00' '12' '*' \ '*' '*' 'find /var/log/ -mtime +30 -exec rm - rf {} \;' stgdc1log01: new
- Run the following command to verify that the new
cron
was added properly:[root@salt-master ~]# salt 'stgdc1log01...