Book Image

Salt Cookbook

By : Anirban Saha
Book Image

Salt Cookbook

By: Anirban Saha

Overview of this book

Table of Contents (18 chapters)
Salt Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Testing a state run before applying to minions


Sometimes, even the smallest of typos or mistakes in configurations can create the biggest problems in infrastructure if not tested and checked before applying them. In this recipe, you will learn how to test state configurations before applying them to minions.

How to do it...

We will make use of the minion and states configured in the previous recipe Setting and using variables in states. We will also assume that the minion is a fresh install with no previous configurations applied to it:

  1. Run the following command:

    [root@salt-master ~]# salt 'stgdc1app02' state.sls user \ saltenv=staging test=True
    stgdc1app02:
    ----------
              ID: cyclonus
        Function: user.present
          Result: None
         Comment: User cyclonus set to be added
         Changes:
    ----------
              ID: megatron
        Function: user.present
          Result: None
         Comment: User megatron set to be added
         Changes:
    
    Summary
    ------------
    Succeeded: 0
    Failed:    0
    Not Run:   2
    ...