前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Install Saltstack

Install Saltstack

作者头像
franket
发布2021-08-11 17:06:20
6330
发布2021-08-11 17:06:20
举报
文章被收录于专栏:技术杂记技术杂记

前言

SaltStack 是一款高性能的自动化运维工具

SaltStack is a revolutionary approach to infrastructure management that replaces complexity with speed. SaltStack is simple enough to get running in minutes, scalable enough to manage tens of thousands of servers, and fast enough to communicate with each system in seconds

类似的工具还有 Puppet、Chef、Ansible,他们之间可以相互替代,但是哪一个更好,我就不在此引发圣战了

这里分享一下 SaltStack 的安装方法

参考 INSTALL SALTSTACK

Tip: 当前的版本为 Latest release: 2017.7.3 (February 5, 2018)


操作

环境

代码语言:javascript
复制
[root@much ~]# hostnamectl
   Static hostname: much
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 33dc28f7e76c4903ad9b603b77e29a7c
           Boot ID: a0fe156a8a034c1e8e48e5b5e3c42a8c
    Virtualization: kvm
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-514.21.1.el7.x86_64
      Architecture: x86-64
[root@much ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:0b:e9:0b brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic enp0s3
       valid_lft 78880sec preferred_lft 78880sec
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:36:8b:0c brd ff:ff:ff:ff:ff:ff
    inet 192.168.56.209/24 brd 192.168.56.255 scope global enp0s8
       valid_lft forever preferred_lft forever
4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN qlen 1000
    link/ether 52:54:00:16:5e:11 brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever
5: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN qlen 1000
    link/ether 52:54:00:16:5e:11 brd ff:ff:ff:ff:ff:ff
[root@much ~]#

组件与机制

强烈建议先看看 SALTSTACK COMPONENTS,可以在脑中构建起 SaltStack 里的各种对象,有助于理解其工作机制

根据需要,再看看 Understanding SaltStack,这里基于 SaltStack 系统中的的各种组件,清楚地描述了它们间的交互与工作机制

有了这些作为基础,对于 SaltStack 的使用就会清晰和容易很多

安装 salt master

在 master 上(192.168.56.209)

代码语言:javascript
复制
[root@much ~]# curl -L https://bootstrap.saltstack.com -o install_salt.sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   264  100   264    0     0    134      0  0:00:01  0:00:01 --:--:--   134
100  244k  100  244k    0     0  68655      0  0:00:03  0:00:03 --:--:--  282k
[root@much ~]# sh install_salt.sh -P -M
 *  INFO: Running version: 2017.12.13
 *  INFO: Executed by: sh
 *  INFO: Command line: 'install_salt.sh -P -M'

 *  INFO: System Information:
 *  INFO:   CPU:          GenuineIntel
 *  INFO:   CPU Arch:     x86_64
 *  INFO:   OS Name:      Linux
 *  INFO:   OS Version:   3.10.0-514.21.1.el7.x86_64
 *  INFO:   Distribution: CentOS 7.3

 *  INFO: Installing minion
 *  INFO: Installing master
 *  INFO: Found function install_centos_stable_deps
 *  INFO: Found function config_salt
 *  INFO: Found function preseed_master
 *  INFO: Found function install_centos_stable
 *  INFO: Found function install_centos_stable_post
 *  INFO: Found function install_centos_restart_daemons
 *  INFO: Found function daemons_running
 *  INFO: Found function install_centos_check_services
 *  INFO: Running install_centos_stable_deps()
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.pregi.net
 * c7-media:
 * epel: mirror.pregi.net
 * extras: mirror.pregi.net
 * updates: mirror.pregi.net
Resolving Dependencies
--> Running transaction check
---> Package PyYAML.x86_64 0:3.11-1.el7 will be installed
---> Package chkconfig.x86_64 0:1.7.2-1.el7 will be updated
--> Processing Dependency: chkconfig = 1.7.2-1.el7 for package: ntsysv-1.7.2-1.el7.x86_64
---> Package chkconfig.x86_64 0:1.7.4-1.el7 will be an update
---> Package yum-utils.noarch 0:1.1.31-40.el7 will be updated
---> Package yum-utils.noarch 0:1.1.31-42.el7 will be an update
--> Running transaction check
---> Package ntsysv.x86_64 0:1.7.2-1.el7 will be updated
---> Package ntsysv.x86_64 0:1.7.4-1.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package           Arch           Version               Repository         Size
================================================================================
Installing:
 PyYAML            x86_64         3.11-1.el7            saltstack         160 k
Updating:
 chkconfig         x86_64         1.7.4-1.el7           base              181 k
 yum-utils         noarch         1.1.31-42.el7         base              117 k
Updating for dependencies:
 ntsysv            x86_64         1.7.4-1.el7           base               38 k

Transaction Summary
================================================================================
Install  1 Package
Upgrade  2 Packages (+1 Dependent package)

Total download size: 497 k
Downloading packages:
No Presto metadata available for base
--------------------------------------------------------------------------------
Total                                              190 kB/s | 497 kB  00:02     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : chkconfig-1.7.4-1.el7.x86_64                                 1/7
  Updating   : ntsysv-1.7.4-1.el7.x86_64                                    2/7
  Installing : PyYAML-3.11-1.el7.x86_64                                     3/7
  Updating   : yum-utils-1.1.31-42.el7.noarch                               4/7
  Cleanup    : yum-utils-1.1.31-40.el7.noarch                               5/7
  Cleanup    : ntsysv-1.7.2-1.el7.x86_64                                    6/7
  Cleanup    : chkconfig-1.7.2-1.el7.x86_64                                 7/7
  Verifying  : yum-utils-1.1.31-42.el7.noarch                               1/7
  Verifying  : chkconfig-1.7.4-1.el7.x86_64                                 2/7
  Verifying  : PyYAML-3.11-1.el7.x86_64                                     3/7
  Verifying  : ntsysv-1.7.4-1.el7.x86_64                                    4/7
  Verifying  : chkconfig-1.7.2-1.el7.x86_64                                 5/7
  Verifying  : yum-utils-1.1.31-40.el7.noarch                               6/7
  Verifying  : ntsysv-1.7.2-1.el7.x86_64                                    7/7

Installed:
  PyYAML.x86_64 0:3.11-1.el7                                                    

Updated:
  chkconfig.x86_64 0:1.7.4-1.el7        yum-utils.noarch 0:1.1.31-42.el7       

Dependency Updated:
  ntsysv.x86_64 0:1.7.4-1.el7                                                   

Complete!
 *  INFO: Running install_centos_stable()
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.pregi.net
 * c7-media:
 * epel: mirror.pregi.net
 * extras: mirror.pregi.net
 * updates: mirror.pregi.net
Resolving Dependencies
--> Running transaction check
---> Package salt-master.noarch 0:2017.7.3-1.el7 will be installed
--> Processing Dependency: salt = 2017.7.3-1.el7 for package: salt-master-2017.7.3-1.el7.noarch
---> Package salt-minion.noarch 0:2017.7.3-1.el7 will be installed
--> Running transaction check
---> Package salt.noarch 0:2017.7.3-1.el7 will be installed
--> Processing Dependency: python-msgpack > 0.3 for package: salt-2017.7.3-1.el7.noarch
--> Processing Dependency: python-tornado >= 4.2.1 for package: salt-2017.7.3-1.el7.noarch
--> Processing Dependency: python-futures >= 2.0 for package: salt-2017.7.3-1.el7.noarch
--> Processing Dependency: python-crypto >= 2.6.1 for package: salt-2017.7.3-1.el7.noarch
--> Processing Dependency: python-zmq for package: salt-2017.7.3-1.el7.noarch
--> Processing Dependency: python-psutil for package: salt-2017.7.3-1.el7.noarch
--> Processing Dependency: python-jinja2 for package: salt-2017.7.3-1.el7.noarch
--> Running transaction check
---> Package python-jinja2.noarch 0:2.7.2-2.el7 will be installed
--> Processing Dependency: python-babel >= 0.8 for package: python-jinja2-2.7.2-2.el7.noarch
---> Package python-tornado.x86_64 0:4.2.1-1.el7 will be installed
---> Package python-zmq.x86_64 0:15.3.0-2.el7 will be installed
--> Processing Dependency: libzmq.so.5()(64bit) for package: python-zmq-15.3.0-2.el7.x86_64
---> Package python2-crypto.x86_64 0:2.6.1-15.el7 will be installed
--> Processing Dependency: libtomcrypt.so.0()(64bit) for package: python2-crypto-2.6.1-15.el7.x86_64
---> Package python2-futures.noarch 0:3.0.5-1.el7 will be installed
---> Package python2-msgpack.x86_64 0:0.5.1-1.el7 will be installed
---> Package python2-psutil.x86_64 0:2.2.1-3.el7 will be installed
--> Running transaction check
---> Package libtomcrypt.x86_64 0:1.17-26.el7 will be installed
--> Processing Dependency: libtommath >= 0.42.0 for package: libtomcrypt-1.17-26.el7.x86_64
--> Processing Dependency: libtommath.so.0()(64bit) for package: libtomcrypt-1.17-26.el7.x86_64
---> Package python-babel.noarch 0:0.9.6-8.el7 will be installed
---> Package zeromq.x86_64 0:4.1.4-6.el7 will be installed
--> Processing Dependency: libsodium.so.13()(64bit) for package: zeromq-4.1.4-6.el7.x86_64
--> Processing Dependency: libpgm-5.2.so.0()(64bit) for package: zeromq-4.1.4-6.el7.x86_64
--> Running transaction check
---> Package libsodium13.x86_64 0:1.0.5-1.el7 will be installed
---> Package libtommath.x86_64 0:0.42.0-6.el7 will be installed
---> Package openpgm.x86_64 0:5.2.122-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package               Arch         Version               Repository       Size
================================================================================
Installing:
 salt-master           noarch       2017.7.3-1.el7        saltstack       2.0 M
 salt-minion           noarch       2017.7.3-1.el7        saltstack        35 k
Installing for dependencies:
 libsodium13           x86_64       1.0.5-1.el7           epel            144 k
 libtomcrypt           x86_64       1.17-26.el7           extras          224 k
 libtommath            x86_64       0.42.0-6.el7          extras           36 k
 openpgm               x86_64       5.2.122-2.el7         epel            171 k
 python-babel          noarch       0.9.6-8.el7           base            1.4 M
 python-jinja2         noarch       2.7.2-2.el7           base            515 k
 python-tornado        x86_64       4.2.1-1.el7           base            636 k
 python-zmq            x86_64       15.3.0-2.el7          saltstack       520 k
 python2-crypto        x86_64       2.6.1-15.el7          extras          477 k
 python2-futures       noarch       3.0.5-1.el7           epel             26 k
 python2-msgpack       x86_64       0.5.1-1.el7           epel             93 k
 python2-psutil        x86_64       2.2.1-3.el7           epel            116 k
 salt                  noarch       2017.7.3-1.el7        saltstack       7.9 M
 zeromq                x86_64       4.1.4-6.el7           saltstack       555 k

Transaction Summary
================================================================================
Install  2 Packages (+14 Dependent packages)

Total download size: 15 M
Installed size: 58 M
Downloading packages:
--------------------------------------------------------------------------------
Total                                              271 kB/s |  15 MB  00:55     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libsodium13-1.0.5-1.el7.x86_64                              1/16
  Installing : python-babel-0.9.6-8.el7.noarch                             2/16
  Installing : python-jinja2-2.7.2-2.el7.noarch                            3/16
  Installing : python-tornado-4.2.1-1.el7.x86_64                           4/16
  Installing : libtommath-0.42.0-6.el7.x86_64                              5/16
  Installing : libtomcrypt-1.17-26.el7.x86_64                              6/16
  Installing : python2-crypto-2.6.1-15.el7.x86_64                          7/16
  Installing : python2-msgpack-0.5.1-1.el7.x86_64                          8/16
  Installing : python2-psutil-2.2.1-3.el7.x86_64                           9/16
  Installing : python2-futures-3.0.5-1.el7.noarch                         10/16
  Installing : openpgm-5.2.122-2.el7.x86_64                               11/16
  Installing : zeromq-4.1.4-6.el7.x86_64                                  12/16
  Installing : python-zmq-15.3.0-2.el7.x86_64                             13/16
  Installing : salt-2017.7.3-1.el7.noarch                                 14/16
  Installing : salt-master-2017.7.3-1.el7.noarch                          15/16
  Installing : salt-minion-2017.7.3-1.el7.noarch                          16/16
  Verifying  : salt-master-2017.7.3-1.el7.noarch                           1/16
  Verifying  : python-jinja2-2.7.2-2.el7.noarch                            2/16
  Verifying  : openpgm-5.2.122-2.el7.x86_64                                3/16
  Verifying  : salt-2017.7.3-1.el7.noarch                                  4/16
  Verifying  : python2-futures-3.0.5-1.el7.noarch                          5/16
  Verifying  : python2-crypto-2.6.1-15.el7.x86_64                          6/16
  Verifying  : python2-psutil-2.2.1-3.el7.x86_64                           7/16
  Verifying  : python-zmq-15.3.0-2.el7.x86_64                              8/16
  Verifying  : python2-msgpack-0.5.1-1.el7.x86_64                          9/16
  Verifying  : libtommath-0.42.0-6.el7.x86_64                             10/16
  Verifying  : python-tornado-4.2.1-1.el7.x86_64                          11/16
  Verifying  : zeromq-4.1.4-6.el7.x86_64                                  12/16
  Verifying  : python-babel-0.9.6-8.el7.noarch                            13/16
  Verifying  : libtomcrypt-1.17-26.el7.x86_64                             14/16
  Verifying  : salt-minion-2017.7.3-1.el7.noarch                          15/16
  Verifying  : libsodium13-1.0.5-1.el7.x86_64                             16/16

Installed:
  salt-master.noarch 0:2017.7.3-1.el7    salt-minion.noarch 0:2017.7.3-1.el7   

Dependency Installed:
  libsodium13.x86_64 0:1.0.5-1.el7       libtomcrypt.x86_64 0:1.17-26.el7      
  libtommath.x86_64 0:0.42.0-6.el7       openpgm.x86_64 0:5.2.122-2.el7        
  python-babel.noarch 0:0.9.6-8.el7      python-jinja2.noarch 0:2.7.2-2.el7    
  python-tornado.x86_64 0:4.2.1-1.el7    python-zmq.x86_64 0:15.3.0-2.el7      
  python2-crypto.x86_64 0:2.6.1-15.el7   python2-futures.noarch 0:3.0.5-1.el7  
  python2-msgpack.x86_64 0:0.5.1-1.el7   python2-psutil.x86_64 0:2.2.1-3.el7   
  salt.noarch 0:2017.7.3-1.el7           zeromq.x86_64 0:4.1.4-6.el7           

Complete!
 *  INFO: Running install_centos_stable_post()
 *  INFO: Running install_centos_check_services()
 *  INFO: Running install_centos_restart_daemons()
 *  INFO: Running daemons_running()
 *  INFO: Salt installed!
[root@much ~]# echo $?
0
[root@much ~]# rpm -qa | grep -i salt
salt-2017.7.3-1.el7.noarch
salt-master-2017.7.3-1.el7.noarch
salt-minion-2017.7.3-1.el7.noarch
[root@much ~]#

安装 salt minion

在 minion 上(192.168.56.208)

代码语言:javascript
复制
[root@much ~]# curl -L https://bootstrap.saltstack.com -o install_salt.sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   264  100   264    0     0    147      0  0:00:01  0:00:01 --:--:--   147
100  244k  100  244k    0     0  71726      0  0:00:03  0:00:03 --:--:--  201k
[root@much ~]# sudo sh install_salt.sh -P
 *  INFO: Running version: 2017.12.13
 *  INFO: Executed by: shell pipe
 *  INFO: Command line: 'install_salt.sh -P'

 *  INFO: System Information:
 *  INFO:   CPU:          GenuineIntel
 *  INFO:   CPU Arch:     x86_64
 *  INFO:   OS Name:      Linux
 *  INFO:   OS Version:   3.10.0-514.21.1.el7.x86_64
 *  INFO:   Distribution: CentOS 7.3

 *  INFO: Installing minion
 *  INFO: Found function install_centos_stable_deps
 *  INFO: Found function config_salt
 *  INFO: Found function preseed_master
 *  INFO: Found function install_centos_stable
 *  INFO: Found function install_centos_stable_post
 *  INFO: Found function install_centos_restart_daemons
 *  INFO: Found function daemons_running
 *  INFO: Found function install_centos_check_services
 *  INFO: Running install_centos_stable_deps()
Loaded plugins: fastestmirror, langpacks
https://ftp.yzu.edu.tw/Linux/Fedora-EPEL/7/x86_64/repodata/bdb4124d91bfddbc7a700e9ee228e462ff7d3652d93aac38b327e14fea76911e-primary.sqlite.bz2: [Errno 14] curl#56 - "TCP connection reset by peer"
Trying other mirror.
Loading mirror speeds from cached hostfile
 * base: mirror.pregi.net
 * c7-media:
 * epel: mirror.pregi.net
 * extras: mirror.pregi.net
 * updates: mirror.pregi.net
Resolving Dependencies
--> Running transaction check
---> Package PyYAML.x86_64 0:3.11-1.el7 will be installed
---> Package chkconfig.x86_64 0:1.7.2-1.el7 will be updated
--> Processing Dependency: chkconfig = 1.7.2-1.el7 for package: ntsysv-1.7.2-1.el7.x86_64
---> Package chkconfig.x86_64 0:1.7.4-1.el7 will be an update
---> Package yum-utils.noarch 0:1.1.31-40.el7 will be updated
---> Package yum-utils.noarch 0:1.1.31-42.el7 will be an update
--> Running transaction check
---> Package ntsysv.x86_64 0:1.7.2-1.el7 will be updated
---> Package ntsysv.x86_64 0:1.7.4-1.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package           Arch           Version               Repository         Size
================================================================================
Installing:
 PyYAML            x86_64         3.11-1.el7            saltstack         160 k
Updating:
 chkconfig         x86_64         1.7.4-1.el7           base              181 k
 yum-utils         noarch         1.1.31-42.el7         base              117 k
Updating for dependencies:
 ntsysv            x86_64         1.7.4-1.el7           base               38 k

Transaction Summary
================================================================================
Install  1 Package
Upgrade  2 Packages (+1 Dependent package)

Total download size: 497 k
Downloading packages:
No Presto metadata available for base
--------------------------------------------------------------------------------
Total                                              195 kB/s | 497 kB  00:02     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : chkconfig-1.7.4-1.el7.x86_64                                 1/7
  Updating   : ntsysv-1.7.4-1.el7.x86_64                                    2/7
  Installing : PyYAML-3.11-1.el7.x86_64                                     3/7
  Updating   : yum-utils-1.1.31-42.el7.noarch                               4/7
  Cleanup    : yum-utils-1.1.31-40.el7.noarch                               5/7
  Cleanup    : ntsysv-1.7.2-1.el7.x86_64                                    6/7
  Cleanup    : chkconfig-1.7.2-1.el7.x86_64                                 7/7
  Verifying  : yum-utils-1.1.31-42.el7.noarch                               1/7
  Verifying  : chkconfig-1.7.4-1.el7.x86_64                                 2/7
  Verifying  : PyYAML-3.11-1.el7.x86_64                                     3/7
  Verifying  : ntsysv-1.7.4-1.el7.x86_64                                    4/7
  Verifying  : chkconfig-1.7.2-1.el7.x86_64                                 5/7
  Verifying  : yum-utils-1.1.31-40.el7.noarch                               6/7
  Verifying  : ntsysv-1.7.2-1.el7.x86_64                                    7/7

Installed:
  PyYAML.x86_64 0:3.11-1.el7                                                    

Updated:
  chkconfig.x86_64 0:1.7.4-1.el7        yum-utils.noarch 0:1.1.31-42.el7       

Dependency Updated:
  ntsysv.x86_64 0:1.7.4-1.el7                                                   

Complete!
 *  INFO: Running install_centos_stable()
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.pregi.net
 * c7-media:
 * epel: mirror.pregi.net
 * extras: mirror.pregi.net
 * updates: mirror.pregi.net
Resolving Dependencies
--> Running transaction check
---> Package salt-minion.noarch 0:2017.7.3-1.el7 will be installed
--> Processing Dependency: salt = 2017.7.3-1.el7 for package: salt-minion-2017.7.3-1.el7.noarch
--> Running transaction check
---> Package salt.noarch 0:2017.7.3-1.el7 will be installed
--> Processing Dependency: python-msgpack > 0.3 for package: salt-2017.7.3-1.el7.noarch
--> Processing Dependency: python-tornado >= 4.2.1 for package: salt-2017.7.3-1.el7.noarch
--> Processing Dependency: python-futures >= 2.0 for package: salt-2017.7.3-1.el7.noarch
--> Processing Dependency: python-crypto >= 2.6.1 for package: salt-2017.7.3-1.el7.noarch
--> Processing Dependency: python-psutil for package: salt-2017.7.3-1.el7.noarch
--> Processing Dependency: python-jinja2 for package: salt-2017.7.3-1.el7.noarch
--> Running transaction check
---> Package python-jinja2.noarch 0:2.7.2-2.el7 will be installed
--> Processing Dependency: python-babel >= 0.8 for package: python-jinja2-2.7.2-2.el7.noarch
---> Package python-tornado.x86_64 0:4.2.1-1.el7 will be installed
---> Package python2-crypto.x86_64 0:2.6.1-15.el7 will be installed
--> Processing Dependency: libtomcrypt.so.0()(64bit) for package: python2-crypto-2.6.1-15.el7.x86_64
---> Package python2-futures.noarch 0:3.0.5-1.el7 will be installed
---> Package python2-msgpack.x86_64 0:0.5.1-1.el7 will be installed
---> Package python2-psutil.x86_64 0:2.2.1-3.el7 will be installed
--> Running transaction check
---> Package libtomcrypt.x86_64 0:1.17-26.el7 will be installed
--> Processing Dependency: libtommath >= 0.42.0 for package: libtomcrypt-1.17-26.el7.x86_64
--> Processing Dependency: libtommath.so.0()(64bit) for package: libtomcrypt-1.17-26.el7.x86_64
---> Package python-babel.noarch 0:0.9.6-8.el7 will be installed
--> Running transaction check
---> Package libtommath.x86_64 0:0.42.0-6.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package               Arch         Version               Repository       Size
================================================================================
Installing:
 salt-minion           noarch       2017.7.3-1.el7        saltstack        35 k
Installing for dependencies:
 libtomcrypt           x86_64       1.17-26.el7           extras          224 k
 libtommath            x86_64       0.42.0-6.el7          extras           36 k
 python-babel          noarch       0.9.6-8.el7           base            1.4 M
 python-jinja2         noarch       2.7.2-2.el7           base            515 k
 python-tornado        x86_64       4.2.1-1.el7           base            636 k
 python2-crypto        x86_64       2.6.1-15.el7          extras          477 k
 python2-futures       noarch       3.0.5-1.el7           epel             26 k
 python2-msgpack       x86_64       0.5.1-1.el7           epel             93 k
 python2-psutil        x86_64       2.2.1-3.el7           epel            116 k
 salt                  noarch       2017.7.3-1.el7        saltstack       7.9 M

Transaction Summary
================================================================================
Install  1 Package (+10 Dependent packages)

Total download size: 11 M
Installed size: 52 M
Downloading packages:
--------------------------------------------------------------------------------
Total                                              270 kB/s |  11 MB  00:43     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python-babel-0.9.6-8.el7.noarch                             1/11
  Installing : python-jinja2-2.7.2-2.el7.noarch                            2/11
  Installing : python-tornado-4.2.1-1.el7.x86_64                           3/11
  Installing : libtommath-0.42.0-6.el7.x86_64                              4/11
  Installing : libtomcrypt-1.17-26.el7.x86_64                              5/11
  Installing : python2-crypto-2.6.1-15.el7.x86_64                          6/11
  Installing : python2-msgpack-0.5.1-1.el7.x86_64                          7/11
  Installing : python2-futures-3.0.5-1.el7.noarch                          8/11
  Installing : python2-psutil-2.2.1-3.el7.x86_64                           9/11
  Installing : salt-2017.7.3-1.el7.noarch                                 10/11
  Installing : salt-minion-2017.7.3-1.el7.noarch                          11/11
  Verifying  : salt-2017.7.3-1.el7.noarch                                  1/11
  Verifying  : python-jinja2-2.7.2-2.el7.noarch                            2/11
  Verifying  : python2-psutil-2.2.1-3.el7.x86_64                           3/11
  Verifying  : python2-futures-3.0.5-1.el7.noarch                          4/11
  Verifying  : python2-crypto-2.6.1-15.el7.x86_64                          5/11
  Verifying  : python2-msgpack-0.5.1-1.el7.x86_64                          6/11
  Verifying  : libtommath-0.42.0-6.el7.x86_64                              7/11
  Verifying  : python-tornado-4.2.1-1.el7.x86_64                           8/11
  Verifying  : python-babel-0.9.6-8.el7.noarch                             9/11
  Verifying  : libtomcrypt-1.17-26.el7.x86_64                             10/11
  Verifying  : salt-minion-2017.7.3-1.el7.noarch                          11/11

Installed:
  salt-minion.noarch 0:2017.7.3-1.el7                                           

Dependency Installed:
  libtomcrypt.x86_64 0:1.17-26.el7       libtommath.x86_64 0:0.42.0-6.el7      
  python-babel.noarch 0:0.9.6-8.el7      python-jinja2.noarch 0:2.7.2-2.el7    
  python-tornado.x86_64 0:4.2.1-1.el7    python2-crypto.x86_64 0:2.6.1-15.el7  
  python2-futures.noarch 0:3.0.5-1.el7   python2-msgpack.x86_64 0:0.5.1-1.el7  
  python2-psutil.x86_64 0:2.2.1-3.el7    salt.noarch 0:2017.7.3-1.el7          

Complete!
 *  INFO: Running install_centos_stable_post()
 *  INFO: Running install_centos_check_services()
 *  INFO: Running install_centos_restart_daemons()
 *  INFO: Running daemons_running()
 *  INFO: Salt installed!
[root@much ~]# echo $?
0
[root@much ~]# rpm -qa | grep -i salt
salt-2017.7.3-1.el7.noarch
salt-minion-2017.7.3-1.el7.noarch
[root@much ~]#

脚本参数

-P 允许使用 pip 进行安装

-M 安装 salt-master

默认就是安装 salt-minion 的

代码语言:javascript
复制
[root@much ~]# sh install_salt.sh -h

  Usage :  bootstrap-salt.sh [options] <install-type> [install-type-args]

  Installation types:
    - stable              Install latest stable release. This is the default
                          install type
    - stable [branch]     Install latest version on a branch. Only supported
                          for packages available at repo.saltstack.com
    - stable [version]    Install a specific version. Only supported for
                          packages available at repo.saltstack.com
    - daily               Ubuntu specific: configure SaltStack Daily PPA
    - testing             RHEL-family specific: configure EPEL testing repo
    - git                 Install from the head of the develop branch
    - git [ref]           Install from any git ref (such as a branch, tag, or
                          commit)

  Examples:
    - bootstrap-salt.sh
    - bootstrap-salt.sh stable
    - bootstrap-salt.sh stable 2016.3
    - bootstrap-salt.sh stable 2016.3.1
    - bootstrap-salt.sh daily
    - bootstrap-salt.sh testing
    - bootstrap-salt.sh git
    - bootstrap-salt.sh git 2016.3
    - bootstrap-salt.sh git v2016.3.1
    - bootstrap-salt.sh git 06f249901a2e2f1ed310d58ea3921a129f214358

  Options:
    -h  Display this message
    -v  Display script version
    -n  No colours
    -D  Show debug output
    -c  Temporary configuration directory
    -g  Salt Git repository URL. Default: https://github.com/saltstack/salt.git
    -w  Install packages from downstream package repository rather than
        upstream, saltstack package repository. This is currently only
        implemented for SUSE.
    -k  Temporary directory holding the minion keys which will pre-seed
        the master.
    -s  Sleep time used when waiting for daemons to start, restart and when
        checking for the services running. Default: 3
    -L  Also install salt-cloud and required python-libcloud package
    -M  Also install salt-master
    -S  Also install salt-syndic
    -N  Do not install salt-minion
    -X  Do not start daemons after installation
    -d  Disables checking if Salt services are enabled to start on system boot.
        You can also do this by touching /tmp/disable_salt_checks on the target
        host. Default: ${BS_FALSE}
    -P  Allow pip based installations. On some distributions the required salt
        packages or its dependencies are not available as a package for that
        distribution. Using this flag allows the script to use pip as a last
        resort method. NOTE: This only works for functions which actually
        implement pip based installations.
    -U  If set, fully upgrade the system prior to bootstrapping Salt
    -I  If set, allow insecure connections while downloading any files. For
        example, pass '--no-check-certificate' to 'wget' or '--insecure' to
        'curl'. On Debian and Ubuntu, using this option with -U allows to obtain
        GnuPG archive keys insecurely if distro has changed release signatures.
    -F  Allow copied files to overwrite existing (config, init.d, etc)
    -K  If set, keep the temporary files in the temporary directories specified
        with -c and -k
    -C  Only run the configuration function. Implies -F (forced overwrite).
        To overwrite Master or Syndic configs, -M or -S, respectively, must
        also be specified. Salt installation will be ommitted, but some of the
        dependencies could be installed to write configuration with -j or -J.
    -A  Pass the salt-master DNS name or IP. This will be stored under
        ${BS_SALT_ETC_DIR}/minion.d/99-master-address.conf
    -i  Pass the salt-minion id. This will be stored under
        ${BS_SALT_ETC_DIR}/minion_id
    -p  Extra-package to install while installing Salt dependencies. One package
        per -p flag. You're responsible for providing the proper package name.
    -H  Use the specified HTTP proxy for all download URLs (including https://).
        For example: http://myproxy.example.com:3128
    -Z  Enable additional package repository for newer ZeroMQ
        (only available for RHEL/CentOS/Fedora/Ubuntu based distributions)
    -b  Assume that dependencies are already installed and software sources are
        set up. If git is selected, git tree is still checked out as dependency
        step.
    -f  Force shallow cloning for git installations.
        This may result in an "n/a" in the version number.
    -l  Disable ssl checks. When passed, switches "https" calls to "http" where
        possible.
    -V  Install Salt into virtualenv
        (only available for Ubuntu based distributions)
    -a  Pip install all Python pkg dependencies for Salt. Requires -V to install
        all pip pkgs into the virtualenv.
        (Only available for Ubuntu based distributions)
    -r  Disable all repository configuration performed by this script. This
        option assumes all necessary repository configuration is already present
        on the system.
    -R  Specify a custom repository URL. Assumes the custom repository URL
        points to a repository that mirrors Salt packages located at
        repo.saltstack.com. The option passed with -R replaces the
        "repo.saltstack.com". If -R is passed, -r is also set. Currently only
        works on CentOS/RHEL and Debian based distributions.
    -J  Replace the Master config file with data passed in as a JSON string. If
        a Master config file is found, a reasonable effort will be made to save
        the file with a ".bak" extension. If used in conjunction with -C or -F,
        no ".bak" file will be created as either of those options will force
        a complete overwrite of the file.
    -j  Replace the Minion config file with data passed in as a JSON string. If
        a Minion config file is found, a reasonable effort will be made to save
        the file with a ".bak" extension. If used in conjunction with -C or -F,
        no ".bak" file will be created as either of those options will force
        a complete overwrite of the file.
    -q  Quiet salt installation from git (setup.py install -q)
    -x  Changes the python version used to install a git version of salt. Currently
        this is considered experimental and has only been tested on Centos 6. This
        only works for git installations.
    -y  Installs a different python version on host. Currently this has only been
        tested with Centos 6 and is considered experimental. This will install the
        ius repo on the box if disable repo is false. This must be used in conjunction
        with -x <pythonversion>.  For example:
            sh bootstrap.sh -P -y -x python2.7 git v2016.11.3
        The above will install python27 and install the git version of salt using the
        python2.7 executable. This only works for git and pip installations.

[root@much ~]#

这个 shell 脚本可以侦测目标系统的环境,并且选择最合适的安装方法

在我的环境中,是使用的 yum 安装的

代码语言:javascript
复制
[root@much ~]# ll /etc/yum.repos.d/saltstack.repo
-rw-r--r-- 1 root root 295 2月  17 19:20 /etc/yum.repos.d/saltstack.repo
[root@much ~]#

配置 master

默认情况下 master 就监听在了 0.0.0.04505 4506 端口

本文系转载,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文系转载前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 前言
  • 操作
    • 环境
      • 组件与机制
        • 安装 salt master
          • 安装 salt minion
            • 脚本参数
              • 配置 master
              领券
              问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档