Book Image

Learning SaltStack

By : Colton Myers
Book Image

Learning SaltStack

By: Colton Myers

Overview of this book

Table of Contents (15 chapters)

Masterless Salt

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 such 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 for running 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

Note that it doesn't display our minion's ID because we're just running it locally:

# sudo salt-call test.fib 10
      - 0
      - 1
      - 1
      - 2
      - 3
      - 5
      - 8
    - 5.00679016113e-06
# sudo salt-call sys.doc

            Used to make sure the minion is up and responding. Not 
            an ICMP ping.

            Returns ``True``.

            CLI Example:

                salt '*'

Now let's stop our master and try again:

# sudo service salt-master stop
# sudo salt-call
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.

To get salt-call to operate properly masterless, we need to tell it there's no master. We do this with the --local flag, as follows:

# sudo salt-call --local

Success! You can now operate a Salt minion without a master!


Start your master again before moving on to the next chapter of this book:

# salt-master --daemon --log-level debug