Run Salt Command Locally
You can run Salt commands locally, and see the result immediately. This is useful for practice, testing and quick setup. The same Salt functions work in both Linux and Windows, so if you can't remember how to stop a daemon in Windows, this can help, too.
The most important state functions are pkg, file, service, user and cmd.
Salt is normally used to control large number of slave computers over the network. This is handled in my other Salt articles.
Install Salt Slave # ↑
To install Salt slave daemon in Debian or Ubuntu
$
$
You can check that you have it
$ sudo salt-call --version
pkg.installed - An Application Should Be Installed # ↑
$
$
file.managed - There Should be a File # ↑
In Linux, all settings are just text files.
$
$
$
service.running - A Daemon is Running # ↑
This function, service.running, is often used to automatically restart the daemon when settings should be changed.
$
$
user.present - User Should Exist # ↑
$
$
cmd.run - Running a Command # ↑
$
- You must make it idempotent (only run it when changes are needed).
- creates, unless, onlyif
- Use file, service or user instead of cmd.run
Instructions # ↑
$
Adminstrivia # ↑
This article has been updated after publishing.
Icon "thin-client-solid" from Clarity Icons by WMware, received under the MIT license.