Here's our first command:
Was that a bit underwhelming?
Don't worry. We're going to get to the more impressive stuff soon enough. The command we just ran was called a remote execution command. Basically, we sent a message to all (one) of our minions and told them to run a function from one of the execution modules that is built into Salt. In this case, we just told our minion to return True
. It's a good way to check which of our minions are alive. We will explore the various parts of this command in more detail in the next chapter.
The test
module actually has a few other useful functions. To find out about them, we're actually going to use another module, called sys
, as follows:
Let's try one of the other functions on the list. Maybe test.fib
:
Well, that didn't work. To find out more information about a function, including examples of how to use it, we can use the sys.doc
function, as follows:
Aha! We need to give it a number to which it should calculate the Fibonacci sequence, as follows:
As it turns out, the Fibonacci sequence is not very hard for computers to calculate quickly.
Note that you can actually use sys.doc
to retrieve the documentation for a whole module's worth of functions at a time, as follows:
I didn't include the output as it is lengthy.
The sys
module is going to be one of the most useful modules in your quest to learn Salt. Keep it handy and turn to it any time you want to learn more about something you're working with. Remember that the sys
module can target itself. The following code shows you how to use the sys
module:
We are going to discuss remote execution and the execution modules in much greater detail in the next chapter.