Automatic deployment of Salt-minion with SALT-SSH (ii)

Source: Internet
Author: User

Second, the source code installation Chapter

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

1.salt-minion End Environment:

System: SUSE SP3 64bit

Python version: 2.6.6

RPM Package: Pcre-devel #不安装, compile Swig error

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|install2.sls

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

Sources_download:cmd.run:-CWD:/usr/src-names:-wget http://yum.deepay.3g/SOFT/salt/setuptools-18.3.2.t ar.gz http://yum.deepay.3g/SOFT/salt/python-dateutil-1.5.tar.gz http://yum.deepay.3g/SOFT/salt/ pyyaml-3.11.tar.gz http://yum.deepay.3g/SOFT/salt/MarkupSafe-0.23.tar.gz http://yum.deepay.3g/SOFT/salt/ jinja2-2.8.tar.gz http://yum.deepay.3g/SOFT/salt/pycrypto-2.6.tar.gz http://yum.deepay.3g/SOFT/salt/ libsodium-1.0.2.tar.gz http://yum.deepay.3g/SOFT/salt/zeromq-4.1.3.tar.gz http://yum.deepay.3g/SOFT/salt/ pyzmq-14.1.1.tar.gz http://yum.deepay.3g/SOFT/salt/msgpack-python-0.4.6.tar.gz http://yum.deepay.3g/SOFT/salt/ Yaml-0.1.6.tar.gzhttp://yum.deepay.3g/SOFT/salt/msgpack-pure-0.1.3.tar.gzHttp://yum.deepay.3g/SOFT/salt/swig-2.0.11.tar.gz http://yum.deepay.3g/SOFT/salt/M2Crypto-0.22.3.tar.gz/HTTP Home-made address source on yum.deepay.3g/soft/salt/salt-2015.5.5.tar.gz#
-Unless:test-e setuptools-18.3.2.tar.gz Setuptools_install:cmd.run:-CWD:/usr/src-names:-sudo t AR zxf/usr/src/setuptools-18.3.2.tar.gz; cd setuptools-18.3.2; sudo python setup.py build; sudo python setup.py install -unless:test-d Setuptools-18.3.2pythondateutil_install:cmd.run:-CWD:/usr/src-names:-sudo tar zxf python-dateutil-1.5.tar.gz, cd python-dateutil-1.5, sudo python setup.py install-unless:test-d python-dateutil-1.5 -Require:-Cmd:setuptools_installPyYAML_install:cmd.run:-CWD:/usr/src-names:-sudo tar zxf P yyaml-3.11.tar.gz, cd PyYAML-3.11, sudo python setup.py install-unless:test-d pyyaml-3.11-require:-cmd: Pythondateutil_installMarkupSafe_install:cmd.run:-CWD:/usr/src-names:-sudo tar zxf markupsafe-0.23.ta r.gz, cd MarkupSafe-0.23, sudo python setup.py install-unless:test-d markupsafe-0.23-require:-Cmd:pyya Ml_installjinja2_install: Cmd.run:-CWD:/usr/src-names:-sudo tar zxf jinja2-2.8.tar.gz; CD jinja2-2.8; sudo python setup.py inst all-unless:test-d Jinja2-2.8-require:-Cmd:MarkupSafe_installpycrypto_install:cmd.run:-CWD:/usr /src-names:-sudo tar zxf pycrypto-2.6.tar.gz; CD pycrypto-2.6; sudo python setup.py install-unless:test -D Pycrypto-2.6-require:-Cmd:Jinja2_installlibsodium_install:cmd.run:-CWD:/usr/src-names:- sudo tar zxf libsodium-1.0.2.tar.gz; CD libsodium-1.0.2; sudo/configure cc= "gcc-m64"--prefix=/usr--libdir=/usr/lib64 && sudo make && sudo make install-unless:test-d libsodium-1.0.2-require:-Cmd:pycrypto _installzeromq_install:cmd.run:-CWD:/usr/src-names:-sudo tar zxf zeromq-4.1.3.tar.gz, CD zeromq-4.1.3 ; sudo./configure--prefix=/usr cc= "gcc-m64" pkg_config_path= "/usr/lib64/pkgconfig"--libdir=/usr/lib64 && sudo make && sudo make install-unless:test-d Zeromq-4.1.3-require:-Cmd:libsodium_installpyzmq_install:cmd.run:-CWD:/ Usr/src-names:-sudo tar zxf pyzmq-14.1.1.tar.gz; CD pyzmq-14.1.1; sudo python setup.py install-unless:te st-d Pyzmq-14.1.1-require:-Cmd:zeromq_installmsgpackpython_install:cmd.run:-CWD:/usr/src-names: -Sudo tar zxf msgpack-python-0.4.6.tar.gz; CD msgpack-python-0.4.6; sudo python setup.py install-unless:test -D Msgpack-python-0.4.6-require:-Cmd:pyzmq_installyaml_install:cmd.run:-CWD:/usr/src-names: -Sudo tar zxf yaml-0.1.6.tar.gz; CD yaml-0.1.6/; sudo/configure && sudo make && make Install-unle ss:test-d Yaml-0.1.6-require:-Cmd:msgpackpython_install
Msgpackpure_install:cmd.run:-CWD:/usr/src-names:-sudo tar zxf msgpack-pure-0.1.3.tar.gz;msgpack-pure-0.1.3; sudo python setup.py install-unless:test-dmsgpack-pure-0.1.3-Require:-cmd:Yaml_installSwig_install:cmd.run:-CWD:/usr/src-names:-sudo tar zxf swig-2.0.11.tar.gz; CD swig-2.0.11/; sudo./con Figure, sudo make, sudo make install, sudo ln-s/usr/local/bin/swig/usr/bin/swig-unless:test-d swig-2.0.11-r Equire:-cmd:Msgpackpure_installM2Crypto_install:cmd.run:-CWD:/usr/src-names:-sudo tar zxf m2crypto-0.22.3.tar.gz, CD m2crypto-0.22.3/      ; sudo python setup.py build build_ext; sudo python setup.py install-unless:test-d m2crypto-0.22.3-require:  -Cmd:swig_installsalt_install:cmd.run:-CWD:/usr/src-names:-sudo tar zxf salt-2015.5.5.tar.gz, CD salt-2015.5.5, sudo python setup.py install, sudo ln-s/usr/local/python2.6.6/bin/salt-minion/usr/bin/salt-minion- unless:test-d Salt-2015.5.5-require:-Cmd:M2Crypto_installminion_conf:cmd.run:-Names:-sudo mk    Dir-p/etc/salt; -Unless:test-d/etc/salt file.managed:-Name:/etc/salt/minion-source:salt://minions/conf/minion-user: root-group:root-mode:640-template:jinja-defaults:minion_id: {{grains[' fqdn_ip4 '][0]}}- UNLESS:TEST-E/etc/salt/minion-require:-cmd:salt_installminion_service:cmd.run:-Name:sudo salt-min Ion -D &-Unless:ps aux | grep salt-minion | Grep-v grep-require:-file:minion_conf file.managed:-Name:/etc/init.d/after.local-source:salt://  MINIONS/CONF/AFTER.LOCAL-USER:ROOT-GROUP:ROOT-MODE:755-UNLESS:TEST-E/etc/init.d/after.local- Require:-Cmd:salt_install

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.install2

Verify:

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

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

Third, problem solving

See also: 1. "Problem" SuSE has installed Libsodium and the following error occurred while installing ZEROMQ?

2. "Problem" error [CRITICAL] Rendering SLS ' base:minions.install ' failed:jinja variable ' list ' object has no element 0

Automatic deployment of Salt-minion with SALT-SSH (ii)

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.