Skip to main content

Salt-stack cheat sheet

Here is an essential cheat sheet of some normal SaltStack orders with models:


1. Test network with flunkies:


   salt '*' test.ping


2. Execute an order on cronies:


   salt '*' cmd.run 'ls - l/var/log'


3. Apply a state to cronies:


   salt '*' state.apply nginx


4. Apply a highstate to cronies (apply every single characterized state):


   salt '*' state.highstate


5. Get data about followers (grains):


   salt '*' grains.items


6. Introduce a bundle on cronies:


   salt '*' pkg.install nginx


7. Begin, stop, or restart a help on flunkies:


   salt '*' service.start nginx


   salt '*' service.stop nginx


   salt '*' service.restart nginx


8. Duplicate records to cronies:


   salt '*' cp.get_file salt://way/to/record/objective/way


9. Execute an order in a particular registry on cronies:


   salt '*' cmd.run chdir=/way/to/registry 'ls - l'


10. Run an order nonconcurrently on flunkies:


 salt - - async '*' cmd.run 'long_running_command'


11. Recover flunky key data:


  salt-key - L


12. Acknowledge a forthcoming crony key:


    salt-key - a <minion-id>


13. Eliminate a crony key:


    salt-key - d <minion-id>


14. Execute an order on unambiguous cronies utilising focusing on:


    salt 'minion1,minion2' cmd.run 'ls - l/var/log'


15. Apply a particular state to designated followers:


  salt 'web*' state.apply nginx


16. Execute an order and view the nitty gritty result:


    salt '*' cmd.run 'ls - l/var/log' - - out=full


17. Run an order in test mode to see changes without applying them:


    salt '*' state.apply nginx test=True


18. Run a particular state in test mode:


    salt '*' state.apply nginx.test


19. Synchronize documents or indexes to cronies:


    salt '*' rsync.rsync/nearby/way/remote/way


20. Recover data about a particular crony:


    salt 'minion1' grains.item os


21. Execute an order on cronies in equal:


    salt - P 'web*' cmd.run 'ls - l/var/log' - - group size=10%


22. Run a Salt execution module:


    salt 'minion1' pkg.install apache


23. Run a Salt state module:

    salt 'minion1' state.apply pkg.installed


24. Execute an order and show the result in JSON design:


    salt '*' cmd.run 'ls - l/var/log' - - out=json


25. List accessible Salt modules:

    salt '*' sys.list_modules


These models grandstand different use cases and functionalities of SaltStack. Make sure to adjust the orders to your particular framework and naming shows. SaltStack offers broad documentation and assets that give point by point clarifications and further models for each order and component.

These orders give a beginning stage to utilizing SaltStack. For further developed utilization and customization, SaltStack offers a far reaching set of highlights and capacities that can be investigated further in the authority SaltStack documentation and other learning assets.


Kindly note that the models above utilize the trump card '*' to focus on all cronies. You can supplant it with explicit crony IDs or target bunches according to your framework arrangement.


Go ahead and investigate the SaltStack documentation for more inside and out data: https://docs.saltproject.io/

Comments

Popular posts from this blog

System SRE (site reliability engineering)

  Free to be SRE, with this systems engineering syllabus  Systems Engineering Side of Site Reliability Engineering

Google Cloud Arcade Program

Arcade Facilitator Program 2024 (July) Arcade Facilitator Arcade site Arcade Point systems Leaderboard Arcade Points Calculator Be a part of the Google Cloud Community

Google Career Certificates

  Career Certificates IT Automation & Support