SALT-SSH Batch automatic installation of the controlled end minion

Source: Internet
Author: User
Tags saltstack

salt-ssh Batch automatic installation of the controlled end minion

Salt-ssh is another way to manage saltstack, without the need to install the Minion end, can use all the functions of salt, management and use of basic and salt. However, Salt-ssh did not inherit the original ZEROMQ communication architecture. So, she's running slower. Supplements as salt are very useful in the initial batch installation of Minion or some special scenarios where Minion cannot be installed.

previous post the Centralized management platform Saltstack", we introduced the installation configuration of Saltstack. Here we introduce how to bulk install the controlled end. Saltstack-master has been configured, we still use the original node here. Below, the automatic installation of the MySQL node is the controlled end.

One, Environment configuration description1.IP Address Assignment

Hostname IP Address node service

Saltstack01 10.62.83.211 Master Salt-ssh

Mysql01 10.62.83.201 MySQL Minion

2. Software version

Software Version number

OS CentOS Release 6.7 (Final)

Python python2.6.6

Salt 2015.8.10 (beryllium)

Two, installation configuration Salt-ssh1.yum Source Configuration

We're here or we're using the Yum file from the previous article

2. Installing Salt-ssh

SALTSTACK01 node continues to install Salt-ssh

#yum-y Installsalt-ssh

3. Configure Roster

All host information that needs to be installed on the controlled side is configured here.

# vim /etc/salt/roster # sample salt-ssh  config file#web1:# host: 192.168.42.1 # the ip addr or dns  Hostname# user: fred         # remoteexecutions  will be executed as user fred# passwd: foobarbaz  #  the passwordto use for login, if omitted, keys are used#  sudo: true         # whether tosudo to  root, not enabled by default#web2:# host: 192.168.42.210.62.83.201: ## Deploy multiple clients in bulk, adding client-like options in this configuration file   host:10.62.83.201  user:root  passwd:emsee123!   port:22 timeout: 10 

When the number of clients, manual configuration/etc/salt/roster is cumbersome, here is a simple script for reference:

# vim Ip.sh#!/bin/bashfor i in ' Cat/root/hostip ' do echo "$i:" >>/etc/salt/roster # # $i means fetching each line of the file echo " Host: $i ">>/etc/salt/roster echo" User:username ">>/etc/salt/roster echo" Passwd:password ">>/etc/salt/roster echo" Sudo:true ">>/etc/salt/roster echo" Timeout:10 ">>/etc/salt /rosterdone

Where/root/hostip is the client IP file, for example:

10.10.10.3010.10.10.3110.10.10.32
Third, configure the State.sls file structure

*.SLS files for state management of controlled hosts

1. Create a directory
# mkdir/srv/salt/minions# Mkdir/srv/salt/minions/conf # MKDIR/SRV/SALT/MINIONS/YUM.REPOS.D
2. Preparing the. sls File


# vim install.sls#salt_minion_installminion_yum:  file.recurse:    -  name: /etc/yum.repos.d    - source: salt://minions/yum.repos.d # #提前准备的yum文件路径     - user: root    - group: root     - file_mode: 644    - dir_mode: 755     - include_empty: Trueminion_install:  pkg.installed:     - pkgs:      - salt-minion    - require :      - file: minion_yum    - unless:  rpm -qa | grep salt-minionminion_conf:  file.managed:    -  name: /etc/salt/minion    - source: salt://minions/conf/minion   # #minion端需要配置的minion主Configuration Files     -user: root    - group: root     - mode: 640    - template: jinja    -  defaults:      minion_id: {{ grains[' FQDN_IP4 '][0]}}         # #这里grains是收集minion端/etc/hosts file IP and host name     - require:       - pkg: minion_installminion_service:  service.running:     - name: salt-minion    - enable: True     - require:      - file: minion_conf
3. Writing the Minion Master file


MASTER:10.62.83.211ID:MYSQL01 the corresponding domain name resolution in the configuration #这里需要在/etc/hosts

Attention:

The final directory structure is as follows:

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/80/F0/wKioL1dFO6vAzY8xAAAbNW2MxMM698.png "title=" s6.png "alt=" Wkiol1dfo6vazy8xaaabnw2mxmm698.png "/>

Four, deploy salt-minion

The SALT-SSH side executes the following command:

# salt-ssh-i ' * ' State.sls minions.install # # ' * ' means all, or can be replaced with only the host name or IP address that needs to be installed Minion
Five, results verified
#salt-ssh-ir ' * ' PS aux | grep Salt ' | grep Salt | Grep-v grep| Wc-l # #查看安装minion端的salt The-minion process is running, a client runs a salt-minion service.

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/80/F2/wKiom1dFOxPRlFrtAAAMJSBrqPc189.png "title=" s7.png "alt=" Wkiom1dfoxprlfrtaaamjsbrqpc189.png "/>


Reference Blog: http://www.cnblogs.com/jim-hwg/p/4940480.html


This article is from the JESSEN6 blog, so be sure to keep this source http://zkhylt.blog.51cto.com/3638719/1782990

Salt-ssh automatically installs the controlled end minion

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.