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

Expanding to encompass multiple pieces of state

We now have our state declaration, which ensures that the apache2 package is installed on each of our minions. However, apache2 will not necessarily be running on our systems.

We know that we can start apache2 using the service.start execution module function, as follows:

# sudo salt '*' service.status apache2
myminion:
    False
# sudo salt '*' service.start apache2
myminion:
    True
# sudo salt '*' service.status apache2
myminion:
    True

Really, we just want to make sure that apache2 is running. Repeatedly running service.start does serve this purpose, but it's not very stateful. Instead, let's use the service.running state module function. Again, note the change in languageā€”rather than starting the service (service.start), we're going to just ensure that it's running (service.running).

Let's first glance at the documentation for this function:

# sudo salt '*' sys.state_doc...
lock icon The rest of the chapter is locked
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