Automatic deployment of salt-minion with SALT-SSH (i)

Source: Internet
Author: User

First, RPM installation Chapter

Using the SALT-SSH feature requires the client system Python version 2.6+

1.salt-minion End Environment:

System: CentOS 6.5 64bit

Python version: 2.6.6

2. Configure/etc/salt/roster

Cases:

10.10.10.30:  host:10.10.10.30  user:syspub #普通用户, with no password sudo permissions  passwd:123456aa  sudo:true  Timeout:15

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

Vim IP.SH#!/bin/Bash forIinch`Cat/root/GG ' Do        Echo "$i:">>/etc/salt/RosterEcho "Host: $i">>/etc/salt/RosterEcho "user:syspub">>/etc/salt/RosterEcho "PASSWD:123456AA">>/etc/salt/RosterEcho "sudo:true">>/etc/salt/RosterEcho "timeout:15">>/etc/salt/Roster Done

where/root/GG is the client IP table, for example:

10.10.10.3010.10.10.3110.10.10.32

3. Writing the State.sls file

Path:/srv/salt/minions/

The directory tree is structured as follows:

|conf|---minion|install.sls|yum.repos.d #yum源可自制本地源 |---centos-base.repo |---epel.repo

A. Writing/srv/salt/minions/install.sls

#salt_minion_installminion_yum:  file.recurse:    -Name:/ETC/YUM.REPOS.D    -source:salt://minions/ YUM.REPOS.D    -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    -User:root    -group:root    -mode:640    -Template:jinja    -defaults:      minion_id: {{g rains[' FQDN_IP4 '][0]}} #要求客户端 binding its IP and hostname in/etc/hosts, not binding hostname in 127.0.0.1    -require:      -Pkg:minion_installminio N_service:  service.running:    -name:salt-minion    -enable:true    -require:      -file:minion_ Conf

B.minion file with default Minion file for Salt-minion version

4. Deploying Salt-minion

The SALT-SSH side executes the following command:

salt-ssh'*' State.sls minions. Install

Verify:

salt-ssh'*'ps aux | grep salt'grep grep grep WC -L

Compares the number of IP numbers in the/ROOT/GG with equal

Automatic deployment of salt-minion with SALT-SSH (i)

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.