Saltstack安裝配置

1、master安裝及配置

yum install salt-master -y

在master上修改配置文件(/etc/salt/master)

找到以下內容,註釋全部去掉,並且注意下面base前面和下一行前面的空格數量,一個爲2,一個爲4
# vim /etc/salt/master
file_roots:
  base:
    - /srv/salt

pillar_roots:
  base:
    - /srv/pillar

啓動master的salt-master

root@ubuntu16:/etc/salt# /etc/init.d/salt-master start
[ ok ] Starting salt-master (via systemctl): salt-master.service.

 

2、在minion上安裝salt-minion

yum install salt-minion -y

 修改minion的配置文件(/etc/salt/minion)

#在大概16行的master上添加master主機ip地址或主機名(需要地址解析),冒號和ip之間有一空格

# vim /etc/salt/minion

master: 192.168.99.99

# 找到#id,把註釋去掉,給每一臺虛擬機起一個有意義的id名稱
# 這裏三臺minion都取各自類型的名稱,如果此項不修改,則會使用每臺虛擬機的主機名

id: hostname1

id: hostname2

id: hostname3

 3、啓動salt-master服務失敗:

root@ubuntu16:/etc/salt# /etc/init.d/salt-master start
[....] Starting salt-master (via systemctl): salt-master.serviceJob for salt-master.service failed because the control process exited with error code. See "systemctl status salt-master.service" and "journalctl -xe" for details.
 failed!

執行 systemctl status salt-master  查看問題

root@ubuntu16:/etc/salt# systemctl status salt-master
● salt-master.service - The Salt Master Server
   Loaded: loaded (/lib/systemd/system/salt-master.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2019-05-07 10:35:01 CST; 2min 0s ago
  Process: 22499 ExecStart=/usr/bin/salt-master (code=exited, status=1/FAILURE)
 Main PID: 22499 (code=exited, status=1/FAILURE)

May 07 10:35:01 ubuntu16 systemd[1]: Starting The Salt Master Server...
May 07 10:35:01 ubuntu16 salt-master[22499]: Traceback (most recent call last):
May 07 10:35:01 ubuntu16 salt-master[22499]:   File "/usr/bin/salt-master", line 6, in <module>
May 07 10:35:01 ubuntu16 salt-master[22499]:     from salt.scripts import salt_master
May 07 10:35:01 ubuntu16 salt-master[22499]: ImportError: No module named 'salt'
May 07 10:35:01 ubuntu16 systemd[1]: salt-master.service: Main process exited, code=exited, status=1/FAILURE
May 07 10:35:01 ubuntu16 systemd[1]: Failed to start The Salt Master Server.
May 07 10:35:01 ubuntu16 systemd[1]: salt-master.service: Unit entered failed state.
May 07 10:35:01 ubuntu16 systemd[1]: salt-master.service: Failed with result 'exit-code'.

問題:ImportError: No module named 'salt'

解決: pip install salt

參考文檔: https://blog.csdn.net/mr_rsq/article/details/79486680

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章