Saltstack IntroductionSalt is:A configuration management system capable of maintaining a predefined state of a remote node (for example, ensuring that the specified newspaper is installed and the specified service is running);A distributed remote execution system for executing commands and querying data on a remote node (which can be a single node or a node selected by any rule);The purpose of development is to provide the best solution for remote exe
Saltstack Save the results of execution to MySQL for command security auditsMySQL is responsible for storing data, Mysql-python is responsible for collecting dataMaster needs to install MySQL and mysql-python,minion-side installation Mysql-pythonSystem environmentCentOS Linux Release 7.4Master 10.0.0.111Minion 10.0.0.1121, Master side operation:Reference URL: https://docs.saltstack.com/en/latest/ref/returners/all/salt.returners.mysql.htmlReference Blo
This year, the entire stack of designers more and more popular, regardless of visual, UI or interactive is difficult to escape the tide. So deliberately to the programming foundation of the designer to point to easy to understand the introductory course, such as @googdev this series of articles, is to help you learn github, even if not an engineer, you can use it to build a personal website/markdown writing/display CV/vindicate and so on, learn!
1.
Saltstack in-depth-management Python-pipOperating content: First, the basic Environment 1, using Tvm-saltmaster operation 2, Network: eth0:host-only (for virtual intranet, manually fixed IP, so from the host can directly connect to this VM) Eth1:nat (for Sisu network, dynamic IP) [email protected]~]#cd/etc/sysconfig/network-scripts/[[emailprotected] network-scripts]#catifcfg-eth0device=eth0type=ethernetonboot=yesnm_controlled=yesbootproto= noneipaddr=
'] = ip_bracket (self. config ['interface']) migrations. migrate_paths (self. config) # Late import so logging works correctly import salt. master self. master = salt. master. master (self. config) self. daemonize_if_required () self. set_pidfile () def start (Self): ''' start the actual master. if sub-classed, don't ** ever ** forget to run: Super (yoursubclass, self ). start () Note: run any required code before calling 'super ()'. '''self. prepare () # Call your own prepare method here if che
Salt Introduction:Salt (saltstack) is an infrastructure automation and configuration management tool, according to the official documentation, salt is a configuration management system capable of maintaining a remote node to a specified state (for example, to ensure that the specified package is installed and that the specified service is running). And can be distributed on the remote node to execute command and query data.InstallationThis document is
creates as many minions as is defined in the Master option and binds EAC H Minion object to a respective master. " " #Timeout for one of the minions to Auth with a masterMinion_connect_timeout = 5def __init__(Self, opts): Super (Multiminion, self).__init__(opts)defMinions (self):" "Return a dict of minion generators bound to the Tune_in method Dict of Master, Minion_mapping, the Mapping contains:opts:options used to create the Minion Last:last Auth attempt time a Uth_wait:time to wait for
Install installation Epel as a Yum source for installing ansible (CentOS6.4)RPM-UVH http://ftp.linux.ncsu.edu/pub/epel/6/i386/epel-release-6-8.noarch.rpmInstall Saltstack:Main control side:Yum Install salt-mastster-ychkconfig Salt-master onservice Salt-master startControlled End:Yum Install salt-minion-ychkconfig Salt-minion Onservice Salt-minion startFirewall:The main control side adds TCP 4505, 4506 port rules, the controlled side does not need to be configured, the principle is the control si
uses _ return to first perform fire_event on the local event interface, the results are stored locally on the master.
8. because fire_event is carried out in 7, the get_cli_event_returns in 4 can be captured. Because the iterator is used, each received result can be immediately displayed, once the result of the captured minions is greater than or equal to the number of previously obtained minions, it means that all minions have returned results and quit.
Summary
Salt uses the flexible and eff
Saltstack Quick Start # Personal sortingGetting started using pip
Because Salt has already entered PyPI, pip can be used for installation, although most users prefer RPMs (which can be installed from EPEL ). Installing from pip is simple:
pip install saltWarning if you install from pip (or use
Setup. pyinstallFrom the source code), pay attention
Yum-utilsIt is depended on by Salt and used to manage software packages. Similarly, if Python dependencies
This article analyzes the running process of saltstack from the perspective of sal command line execution. The code analysis process is parsed by running logs.
Command Execution Process
Enter salt '*' cmd. run ls command on the terminal
#salt "*" cmd.run lscloudstack-agent_4.2.0_all.debcloudstack-common_4.2.0_all.debzmq
Let's take a look at the output log of the salt master.
14:28:36, 087 [master. py] [_ handle_clear] [640] [master] [-1221166
compression.Because gzip-cpu-intensive, this should only being used in scenarios whereThe compression ratio is very high (e.g. pretty-printed JSON or YAMLfiles).Use the *gzip* named argument to enable it. Valid values is 1..9, where 1Is the lightest compression and 9 the heaviest. 1 uses the least CPU onThe Master (and Minion), 9 uses the most.States1: View all States List: Salt ' jcfx-4 ' sys.list_state_modulesJcfx-4:-ACL-Alias-Alternatives-Apache-Archive-Artifactory-At-Beacon-Blockdev-Buildou
1. State moduleDescription format: Yaml format, file with. SLS EndUnderstanding yamlhttps://www.unixhot.com/docs/saltstack/topics/yaml/index.htmlYaml KickFirst: Indent. Note that it must be two spaces. Indentation represents a hierarchical relationship.Second: Colon. Combine with spaces to indicate indentation.The second use of a colon is to represent a key-value pairThird: The dash indicates the list. There are spaces behind the dash.[email protected
' State.sls nginx test=true The output information is omitted here summary------------succeeded:8failed: 0------------Total: When pushing the minion above, the general Salt ' sa10-003 ' state.sls this command; Of course, you can also perform salt sa10-003 state.highstate This command will match all of the STATE.SLS modules by default. where test=true refers to a test installation, that is, no actual operation, just to see the test results.
List of logical relationships for state:In
Saltstack Source Installation Zabbix_agent ClientInstallation and environment brief, directly on the topic:First, the tree-like chart.[Email protected] salt]# pwd/srv/salt[Email protected] salt]# tree. ├──init│└──init.sls├──top.sls└──zabbix├──conf.sls├──files│├──zabbix_agentd│├──zabbix_age NTD.CONF│└──ZABBIX.TAR.GZ├──INIT.SLS└──INSTALL.SLS3 directories, 8 filesSecond, initialize the system firstHere is just to tell the client to install vim-enhanced,
GrainsGrains is a collection of information that is collected at Minion startup, such as the operating system type, network card IP, and so on. Using CommandsSalt ' client.aming.com ' grains.ls lists all grains project namesSalt ' client.aming.com ' grains.items lists all grains items and valuesgrains information is not dynamic and is not always changed, it is only collected at minion startup. grains can do configuration management. Custom Grainsvim/etc/salt/minionAdd or change:Grains:role:-Ngin
1. Storage locationGrains:minion EndPillar:master End2. Data typeGrains: Static dataPillar: Dynamic Data3. Data collection and Update methodGrains:minion is collected at startup, or it can be refreshed with salt ' * ' saltutil.sync_grainsPillar: Defined on the master side, assigned to the corresponding minion. You can refresh with salt ' * ' saltutil.refresh_pillar4. ApplicationGrains: Storage Minion basic protective gear, such as for matching minion, its own receipts can be used to do asset man
machineState moduleSLS methodApache indicates which state file needs to be executed############################################################################################################### ########################################################################################################################################################################### ####################################################################################################################################
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.