Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

CentOS-6.5-saltstack- installation

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Official website: https://www.saltstack.com/

Official document https://docs.saltstack.cn/contents.html

GitHub: https://github.com/saltstack

China saltstack user Group: https://www.saltstack.cn/

CentOS-6.5 install saltstack

192.168.161.132

Salt-master

Salt-master

Salt-minion. Only salt-master is installed here.

192.168.161.133

Salt-test-minion

Salt-minion

[root@salt-master /] # cat / etc/hosts127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain localhost6 localhost6.localdomain6192.168.161.132 salt-master192.168.161.133 salt-test-minion

Install the epel source

[root@salt-master /] # wget-O / etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

Turn off the firewall

[root@salt-master /] # / etc/init.d/iptables stopiptables: Setting chains to policy ACCEPT: filter [OK] iptables: Flushing firewall rules: [OK] iptables: Unloading modules: [OK] [root@salt-test-minion /] # / etc/init.d/iptables stopiptables: Setting chains to policy ACCEPT: filter [OK] iptables: Flushing firewall rules: [OK] iptables: Unloading modules: [OK]

Master end

[root@salt-master /] # yum-y install salt-masterInstalled:salt-master.noarch 0VR May 10, 2015.10-2.el6Dependency Installed:PyYAML.x86_64 0 2.el6Dependency Installed:PyYAML.x86_64 3.10-3.1.el6 libyaml.x86_64 0V 0.1.3-4.el6_6 m2crypto.x86_64 0V 0.20.2-9.el6 openpgm.x86_64 0V 5.1.118-3.el6 python-babel.noarch 0R 0.9.4-5.1.el6 python -backports.x86_64 0VOR 1.0-5.el6 python-backports-ssl_match_hostname.noarch 0VOR 3.4.0.2-4.el6.centos python-chardet.noarch 0VOR 2.2.1-1.el6 python-jinja2.x86_64 0VOV 2.2.1-2.el6_5 python-msgpack.x86_64 0RU 0.4.6-1.el6 python-requests.noarch 0VOV 2.6.0-3.el6 python-six.noarch 0:1. 9.0-2.el6 python-urllib3.noarch 02.el6 zeromq3.x86_64 1.10.2-1.el6 python-zmq.x86_64 0vir 14.3.1-1.el6 salt.noarch 0vir May 10, 2015.10-2.el6 zeromq3.x86_64 0vir 3.2.5-1.el6Dependency Updated:python.x86_64 0vir 2.6.6-66.el6_8 python-libs.x86_64 0vir 2.6.6-66.el6_8Complete! [root@salt-master /] # chkconfig salt-master on [root@salt-master /] # chkconfig-- list salt-mastersalt-master 0:off 1:off 2:on 3:on 4:on 5:on 6:off

Salt-test- minion side

[root@salt-test-minion /] # yum-y install salt-minionInstalled:salt-minion.noarch 0buret May 10, 2015.10-2.el6Dependency Installed:PyYAML.x86_64 0VOV 3.10-3.1.el6 libyaml.x86_64 0RV 0.1.3-4.el6_6 m2crypto.x86_64 0Rod 0.20.2-9.el6 openpgm.x86_64 0Rod 5.1.118-3.el6 python-babel.noarch 0Rod 0.9.4-5.1. El6 python-backports.x86_64 0VOR 1.0-5.el6 python-backports-ssl_match_hostname.noarch 0VOR 3.4.0.2-4.el6.centos python-chardet.noarch 0RU 2.2.1-1.el6 python-jinja2.x86_64 0V 2.2.1-2.el6_5 python-msgpack.x86_64 0Rover 0.4.6-1.el6 python-requests.noarch 0vir 2.6.0-3.el6 python-six.noarch 0: 1.9.0-2.el6 python-urllib3.noarch 01.el6Dependency Updated:python.x86_64 1.10.2-1.el6 python-zmq.x86_64 0vir 14.3.1-1.el6 salt.noarch 0vir May 10, 2015.2015.10-2.el6 zeromq3.x86_64 0vir 3.2.5-1.el6Dependency Updated:python.x86_64 0vir 2.6.6-66.el6_8 python-libs.x86_64 0vir 2.6.6-66.el6_8Complete! [root@salt-test -minion /] # chkconfig salt-minion on # join boot boot [root@salt-test-minion /] # chkconfig-- list salt-minionsalt-minion 0:off 1:off 2:on 3:on 4:on 5:on 6:off

Master end

[root@salt-master /] # cp / etc/salt/master / etc/salt/master.bk # make backup [root@salt-master /] # vim / etc/salt/master

416 file_roots: #: remove # (comment)

417 base:

418-/ srv/salt

529 pillar_roots: #: remove # (comment)

530 base:

531-/ srv/pillar

[root@salt-master /] # / etc/init.d/salt-master start

Starting salt-master daemon: [OK]

Salt-test- minion side

[root@salt-test-minion /] # cp / etc/salt/minion / etc/salt/minion.bk [root@salt-test-minion /] # vim / etc/salt/minion

16 master: 192.168.161.132 # changed to Ip or hostname of master

78 id: minion # define a name (suggest a meaningful name such as nfs, nginx, etc.)

[root@salt-test-minion /] # / etc/init.d/salt-minion start

Starting salt-minion daemon: [OK]

[root@salt-test-minion /] # chkconfig salt-minion on

Master end

[root@salt-master /] # salt-key-L# displays all minion authentication information

[root@salt-master /] # salt-key-a salt-test-minion # accepts salt-test-minion authentication information; follow the parameter-y

[root@salt-master /] # salt-key

Or

[root@localhost /] # salt-key-A # accepts minion authentication information for all Unaccepted status

The following keys are going to be accepted:

Unaccepted Keys:

Minion

Proceed? [n/Y] y

Key for minion minion accepted.

[root@localhost /] # salt-key

Accepted Keys:

Minion

Denied Keys:

Unaccepted Keys:

Rejected Keys:

Installation completed

Introduction to some simple commands

[root@localhost salt] # salt-key-d salt-test-minion # deny authentication salt-test-minion [root@localhost salt] # salt-key-D reject all [root@salt-master /] # salt'* 'test.ping # check the status of all current hosts

Or

[root@salt-master /] # salt 'salt-test-minion' test.ping

[root@salt-master /] # salt'* 'cmd.run' df-h'

Document distribution

[root@salt-master /] # mkdir / srv/-master /] # cd / srv/salt/-/srv/-/etc/- source: salt:--- mode:

[root@salt-master salt] # mkdir files [root@salt-master salt] # cd files [root@salt-master files] # ls [root@salt-master files] # vim / etc/hosts [root@salt-master files] # cat / etc/hosts # append some content whose purpose is different from that of salt-test-minion 's / etc/hosts/ Later verify that the hosts file # 127.0.0 of 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain localhost6 localhost6.localdomain6192.168.161.132 salt-master192.168.161.133 salt-test-minion## [root@salt-test-minion /] # cat / etc/hosts # salt-test-minion has been successfully distributed. 1 localhost localhost.localdomain localhost4 localhost4.localdomain4#::1 localhost localhost.localdomain localhost6 localhost6.localdomain6#192.168.161.132 salt-master#192.168.161.133 salt-test-minion [root@salt-master files] # cp / etc/hosts. # copy to the current directory [root@salt-master files] # cd-/ srv/salt [root@salt-master salt] # salt'* 'state.sls host_file

Go to salt-test-minion to verify whether the distribution is really successful.

Or

[root@salt-master salt] # salt-cp'*'/ etc/hosts / etc # can be implemented without creating the above host_file.sls (not recommended)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report