Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning SaltStack

You're reading from   Learning SaltStack Build, manage, and secure your infrastructure with the power of SaltStack

Arrow left icon
Product type Paperback
Published in Jun 2016
Publisher Packt
ISBN-13 9781785881909
Length 202 pages
Edition 2nd Edition
Concepts
Arrow right icon
Author (1):
Arrow left icon
Colton Myers Colton Myers
Author Profile Icon Colton Myers
Colton Myers
Arrow right icon
View More author details
Toc

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 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.

In order for salt-call to operate properly without a master, we need to tell it that there's no master. We do this with the --local flag, as follows:

# sudo salt-call --local test.ping
local:
    True

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

Tip

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

# sudo service salt-master start
You have been reading a chapter from
Learning SaltStack - Second Edition
Published in: Jun 2016
Publisher: Packt
ISBN-13: 9781785881909
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime