In this chapter, we've taken the time to set up Salt in a master-minion relationship. This will allow us to take advantage of all the power of Salt and scale to multiple minions easily later on. However, Salt is also designed so that a minion can run without a master.
We'll run through a few examples of how to run commands on a minion. This will also be useful even when we do have a master because if we're logged into a minion for some reason and want to run a command while we're there, we can do so using these same concepts.
To start, we'll leave our master running. The command used to run commands on the minion is
salt-call, and it can take any of the same execution module functions that we used with the
salt command, as follows:
# sudo salt-call test.ping local: True
Note that it doesn't display our minion's ID because we're just running it locally:
# sudo salt-call test.fib 10 local: |_ - 0 - 1 - 1 - 2 - 3 - 5 - 8 - 5.00679016113e-06 # sudo salt-call sys.doc test.ping local: ---------- test.ping: Used to make sure the minion is up and responding. Not an ICMP ping. Returns ``True``. CLI Example: salt '*' test.ping
Now, let's stop our master and try again:
# sudo service salt-master stop # sudo salt-call test.ping Failed sign in
The example shown previously will take a fairly long time to terminate. Basically,
salt-call is trying to establish a connection with the master just in case it needs to copy files from the master or other similar operations.
# sudo salt-call --local test.ping local: True
Success! You can now operate a Salt minion without a master!