SaltStack自動化軟件簡介及安裝


 

 

 

 

 

 

 

=======================================================================================================

 環境配置

角色 主機名 IP 組名
master master.salt.com 192.168.200.100  
minion node1.salt.com 192.168.200.101 web1group
minion node2.salt.com 192.168.200.102 web2group

安裝EPEL三台都安裝EPEL

[root@master ~]# ls
epel-release-latest-7.noarch.rpm
[root@master ~]# rpm -ivh epel-release-latest-7.noarch.rpm
警告:epel-release-latest-7.noarch.rpm: 頭V3 RSA/SHA256 Signature, 密鑰 ID 352c64e5: NOKEY
准備中... ################################# [100%]
正在升級/安裝...
1:epel-release-7-11 ################################# [100%]

安裝Saltstack三台都安裝

[root@master ~]# yum install salt-master -y              #主控端

[root@node1 ~]# yum install salt-minion -y                #被控端

[root@node2 ~]# yum install salt-minion -y                #被控端

 

 

 

修改映射關系

[root@master ~]# vim /etc/hosts

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.200.100 master.salt.com
192.168.200.101 node1.salt.com
192.168.200.102 node2.salt.com

將hosts文件發送給node1和node2兩台被控主機

[root@master ~]# scp /etc/hosts 192.168.200.101:/etc/

[root@master ~]# scp /etc/hosts 192.168.200.102:/etc/

[root@master ~]# vim /etc/salt/master

15    interface: 192.168.200.100          #綁定master通信IP
215   auto_accept: True                   #自動認證,避免手動運行salt-key來確認證書信任
406 file_roots: #指定saltstack文件根目錄位置 407 base: 408 - /srv/salt/

[root@master ~]# systemctl start salt-master

node1與node2被控端主機都執行本次操作

[root@node1 ~]# vim /etc/salt/minion

16      master: 192.168.200.100       #指定master主機IP地址 78      id: node1.salt.com             #修改被控主機識別ID,建議使用操作系統

[root@node1 ~]# systemctl start salt-minion

[root@master ~]# salt '*' test.ping                
node2.salt.com:
True
node1.salt.com:
True

 

 

[root@master salt]# salt-key -L
Accepted Keys:
node1.salt.com
node2.salt.com
Denied Keys:
Unaccepted Keys:
Rejected Keys:

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM