CentOS installation and configuration SaltStack

Source: Internet
Author: User

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

  • The shell output in the cmd module is on the controlled end, for example, cmd. run and cmd. run_all.

#salt'*'cmd.rundate #salt'*'cmd.runuptime #salt'*'cmd.run'df-h' #salt'*'cmd.run'ls-l/etc'
  • The pkg function automatically maps packages in the Local System to the salt function.

#salt'*'pkg.installvim

VII. salt-key Parameters

1. Common salt-key options

  • -L, -- list-all

# 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.
  • -A ACCEPT, -- accept = ACCEPT

# Accept a single id certificate request
  • -A, -- accept-all

# Accept all id certificate requests
  • -R REJECT, -- reject = REJECT

# Rejecting the specified public key
  • -R, -- reject-all

# Rejecting all requesting public keys
  • -D DELETE, -- delete = DELETE

# Deleting a specified public key
  • -D, -- delete-all

# 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

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.