master安装
[root@localhost ~]# date
Fri May 5 23:32:37 HKT 2017
[root@localhost ~]# date -s "2017-11-6 14:48:00"
Mon Nov 6 14:48:00 HKT 2017
[root@localhost ~]# rpm --import https://repo.saltstack.com/yum/redhat/6/x86_64/latest/SALTSTACK-GPG-KEY.pub
[root@localhost ~]# yum clean all
[root@localhost ~]# vim /etc/yum.repos.d/
back/ CentOS-Media.repo epel.repo epel-testing.repo saltstack.repo
[root@localhost ~]# vim /etc/yum.repos.d/saltstack.repo
[saltstack-repo]
name=SaltStack repo for RHEL/CentOS $releasever
baseurl=https://repo.saltstack.com/yum/redhat/$releasever/$basearch/latest
enabled=1
gpgcheck=1
gpgkey=https://repo.saltstack.com/yum/redhat/$releasever/$basearch/latest/SALTSTACK-GPG-KEY.pub
[root@localhost ~]# yum update
[root@localhost ~]# yum install salt-master -y
[root@localhost ~]# sed -i 's/#interface: 0.0.0.0/interface: 192.168.200.113/g' /etc/salt/master
[root@localhost ~]# sed -e '/^$/d;/^#/d;' /etc/salt/master
[root@localhost ~]# systemctl start salt-master.service
minion安装
[root@localhost ~]# date -s "2017-11-6 14:29:00"
[root@localhost ~]# rpm --import https://repo.saltstack.com/yum/redhat/6/x86_64/latest/SALTSTACK-GPG-KEY.pub
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# vim saltstack.repo
[saltstack-repo]
name=SaltStack repo for RHEL/CentOS $releasever
baseurl=https://repo.saltstack.com/yum/redhat/$releasever/$basearch/latest
enabled=1
gpgcheck=1
gpgkey=https://repo.saltstack.com/yum/redhat/$releasever/$basearch/latest/SALTSTACK-GPG-KEY.pub
[root@localhost yum.repos.d]# yum clean expire-cache
[root@localhost yum.repos.d]# yum update
[root@localhost yum.repos.d]# yum install salt-minion -y
[root@localhost yum.repos.d]# sed -i 's/#master: salt/master: 192.168.200.113/g' /etc/salt/minion
[root@localhost yum.repos.d]# sed -e '/^$/d;/^#/d;' /etc/salt/minion
master: 192.168.200.113
[root@localhost yum.repos.d]# systemctl start salt-minion.service
[root@localhost yum.repos.d]# systemctl status salt-minion.service
● salt-minion.service - The Salt Minion
Loaded: loaded (/usr/lib/systemd/system/salt-minion.service; disabled; vendor preset: disabled)
Active: active (running) since Mon 2017-11-06 18:14:07 HKT; 2s ago
Docs: man:salt-minion(1)
file:///usr/share/doc/salt/html/contents.html
https://docs.saltstack.com/en/latest/contents.html
Main PID: 18112 (salt-minion)
CGroup: /system.slice/salt-minion.service
├─18112 /usr/bin/python /usr/bin/salt-minion
├─18116 /usr/bin/python /usr/bin/salt-minion
└─18120 /usr/bin/python /usr/bin/salt-minion
Nov 06 18:14:07 localhost.localdomain systemd[1]: Starting The Salt Minion...
Nov 06 18:14:07 localhost.localdomain systemd[1]: Started The Salt Minion.
Nov 06 18:14:08 localhost.localdomain salt-minion[18112]: [ERROR ] The Salt Master has cached the public key for this node, th...icate
Hint: Some lines were ellipsized, use -l to show in full.
master授权并测试
[root@localhost ~]# salt-key -L
Accepted Keys:
Denied Keys:
Unaccepted Keys:
192.168.201.34
Rejected Keys:
[root@localhost ~]# salt-key -a 192.168.201.34
The following keys are going to be accepted:
Unaccepted Keys:
192.168.201.34
Proceed? [n/Y] y
Key for minion 192.168.201.34 accepted.
[root@localhost ~]# salt-key -L
Accepted Keys:
192.168.201.34
Denied Keys:
Unaccepted Keys:
Rejected Keys:
[root@localhost ~]# salt saltstack-minion test.ping
No minions matched the target. No command was sent, no jid was assigned.
ERROR: No return received
[root@localhost ~]# salt 192.168.201.34 test.ping
192.168.201.34:
True
其它
1
sed [-nefr] [动作]
-e :直接在命令列模式上进行 sed 的动作编辑;
-i :直接修改读取的文件内容,而不是输出到终端。
2
sed -e '/^$/d;/^#/d;' /etc/salt/minion
删除空行与删除以#打头行
3
Yum 报错 curl#60 – “Peer’s Certificate has expired.”
curl#60 – “Peer’s Certificate has expired.”
可能是由于服务器时间不正确导致https证书认证错误,更新服务器时间即可
4
vim中
Ctrl+u和Ctrl+d是上下翻半页。