Saltstack Is an Open-Source Configuration Management and Remote Execution Engine
Total Page:16
File Type:pdf, Size:1020Kb
SaltStack i SaltStack About the Tutorial SaltStack is an open-source configuration management and remote execution engine. It remotely executes commands across all machines. It is a python based software. Thomas S Hatch is the creator and the principal architect of SaltStack. SaltStack uses the ZeroMQ messaging library to process high-speed requirements for all networking layers. Salt is simple, scalable and fast. This tutorial will explore the basic principles of SaltStack, SaltStack setup, Minion file system and then walk through with remote execution steps, configuration management, cloud management, Python API operations and finally conclude with a complete working example. Audience This is a tutorial for those professionals who are aspiring to make a career in SaltStack. This tutorial will give you enough understanding on the remote execution operation and configuration management. Prerequisites Before you start doing practice with the various components given in this tutorial, it is being assumed that you are already aware and have a sound knowledge of ZeroMQ and core knowledge of Python. Copyright & Disclaimer Copyright 2018 by Tutorials Point (I) Pvt. Ltd. All the content and graphics published in this e-book are the property of Tutorials Point (I) Pvt. Ltd. The user of this e-book is prohibited to reuse, retain, copy, distribute or republish any contents or a part of contents of this e-book in any manner without written consent of the publisher. We strive to update the contents of our website and tutorials as timely and as precisely as possible, however, the contents may contain inaccuracies or errors. Tutorials Point (I) Pvt. Ltd. provides no guarantee regarding the accuracy, timeliness or completeness of our website or its contents including this tutorial. If you discover any errors on our website or in this tutorial, please notify us at [email protected] i SaltStack Table of Contents About the Tutorial .................................................................................................................................... i Audience .................................................................................................................................................. i Prerequisites ............................................................................................................................................ i Copyright & Disclaimer ............................................................................................................................. i Table of Contents .................................................................................................................................... ii 1. SALTSTACK – OVERVIEW...................................................................................................... 1 What is SaltStack? ................................................................................................................................... 1 Need for SaltStack ................................................................................................................................... 1 Features of SaltStack ............................................................................................................................... 2 Benefits of SaltStack ................................................................................................................................ 2 Introduction to ZeroMQ .......................................................................................................................... 3 2. SALTSTACK – ARCHITECTURE ............................................................................................... 4 3. SALTSTACK – COMPETITORS ................................................................................................ 6 4. SALTSTACK – INSTALLATION ................................................................................................ 9 5. SALTSTACK – CREATING A SIMPLE ENVIRONMENT ............................................................ 12 6. SALTSTACK – ACCESS CONTROL SYSTEM ........................................................................... 15 Publisher ACL System ............................................................................................................................ 15 External Auth System ............................................................................................................................ 15 Peer System .......................................................................................................................................... 16 7. SALTSTACK – JOB MANAGEMENT ...................................................................................... 18 Jobs Runner........................................................................................................................................... 18 Job Scheduling ...................................................................................................................................... 19 ii SaltStack 8. SALTSTACK – SALT FILE SERVER ......................................................................................... 20 File Server Backend ............................................................................................................................... 20 File Server Configuration ....................................................................................................................... 21 CP Module ............................................................................................................................................. 21 FILECLIENT Module ................................................................................................................................ 22 9. SALTSTACK – GIT AS A FILE SERVER ................................................................................... 23 Salt Server Prerequisites for Using Git ................................................................................................... 23 Backend Configuration .......................................................................................................................... 24 Multiple Remotes Configuration ........................................................................................................... 25 10. SALTSTACK – USING MINIONFS AS THE FILE SERVER ......................................................... 26 11. SALTSTACK – USING CRON WITH SALT .............................................................................. 28 What is Cron? ........................................................................................................................................ 28 Salt Caller (salt-call) ............................................................................................................................... 28 12. SALTSTACK ─ REMOTE EXECUTION .................................................................................... 30 Salt Command ....................................................................................................................................... 30 What is the Target Component? ............................................................................................................ 30 Module and Functions (module.function) ............................................................................................. 32 Shell Command ..................................................................................................................................... 32 Show Disk Usage ................................................................................................................................... 33 Network Interfaces ............................................................................................................................... 39 Arguments for a Function Call ............................................................................................................... 44 13. SALTSTACK – CONFIGURATION MANAGEMENT ................................................................ 46 Salt State ............................................................................................................................................... 46 Salt State Functions ............................................................................................................................... 50 SaltStack ─ Pillar Component ................................................................................................................ 52 iii SaltStack SaltStack – Include Component ............................................................................................................. 54 Grains Interface ..................................................................................................................................... 54 14. SALTSTACK – LOGGING ...................................................................................................... 56 Configuration Settings ........................................................................................................................... 56 External Logging Handler....................................................................................................................... 57 15. SALTSTACK – SALT THROUGH SSH ..................................................................................... 59 Roster File ............................................................................................................................................