CentOS installation and configuration SaltStack
I. Introduction to SaltStack
SaltStack is an all-new basic configuration management method. It is easy to deploy and can run in a few minutes. It has good scalability and is easy to manage tens of thousands of servers. It is fast enough and can communicate with servers in seconds. By deploying the SaltStack environment, we can execute commands in batches on thousands of servers, configure centralized management, file distribution, server data collection, operating system basics, and software package management based on different business characteristics. SaltStack is a powerful tool for O & M personnel to improve work efficiency and standardize business configuration and operations.
Ii. experiment environment
1. Version
System Version: CentOS
6.4
64bit
Python version: Native version
2.6
.
6
Salt version:
2014.7
.
1
2. Experiment Architecture
Salt
-
master:
192.168
.
1.225
soft:salt
-
master
Salt
-
minion01:
192.168
.
1.226
soft:salt
-
minion
Salt
-
minion02:
192.168
.
1.228
soft:salt
-
minion
3. Start to install Salt
This installation of SaltStack adopts the yum installation method. Therefore, the third-party yum source (epel and rpmforge) is required)
1. Install the epel Source
#rpm-ivhhttp://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
#sed-i's@^#@@'/etc/yum.repos.d/epel.repo
#sed-i's@mirrorlist@#mirrorlist@'/etc/yum.repos.d/epel.repo
2. Install the rpmforge Source
#rpm-Uvhhttp://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
3. Install the dependency package
#yum-yinstallpython-jinja2
4. Install the SaltStack package
Server Installation salt
-
Master package
#yum-yinstallsalt-master
Install salt on other Controlled Terminals
-
Minion package
#yum-yinstallsalt-minion
4. Configure SaltStack
1. configuration of key items on the master node
#vim/etc/salt/master
interface:
0.0
.
0.0
/
/
Bind the Master communication IP Address
auto_accept:
True
/
/
Automatic authentication to avoid manual running of salt
-
Key to confirm the Certificate Trust
file_roots:
/
/
Specify the location of the root directory of the saltstack File
base:
-
/
srv
/
salt
2. Update the configuration of the controlled end
#vim/etc/salt/minion
master:
192.168
.
0.106
/
/
Master Host IP Address
id
:SaltStack_minion_01
/
/
Modify controlled host recognition
id
We recommend that you set the Host Name of the operating system.
5. Start the SaltStack Service
1
Start salt on the server
-
Master Service
#/etc/init.d/salt-masterstart
#chkconfigsalt-masteron
2
Start salt on the controlled Terminal
-
Minion Service
#/etc/init.d/salt-minionstart
#chkconfigsalt-minionon
6. Use SaltStack
1. view the Public Key List on the master.
[root@localhost~]
#salt-key-L
AcceptedKeys:
SaltStack_minion_01
SaltStack_minion_02
UnacceptedKeys:
RejectedKeys:
2. Test the connectivity of the controlled host, hard disk usage, and network interface address.
#salt'*'test.ping
#salt'*'disk.usage
#salt'*'network.interfaces
3. Remote Command Execution Test
#salt'*'cmd.rundate
#salt'*'cmd.runuptime
#salt'*'cmd.run'df-h'
#salt'*'cmd.run'ls-l/etc'
#salt'*'pkg.installvim
VII. salt-key Parameters
1. Common salt-key options
# The id of the controlled end that has been or has not been authenticated is displayed. AcceptedKeys indicates the authenticated list, And UnacceptedKeys indicates the unauthenticated list.
# Accept a single id certificate request
# Accept all id certificate requests
# Rejecting the specified public key
# Rejecting all requesting public keys
# Deleting a specified public key
# Deleting all public keys
2. salt-key returned information
Accepted Keys: List of Accepted public Keys or controlled hosts
Unaccepted Keys: List of Unaccepted public Keys
Rejected Keys: List of Rejected public Keys