salt-master:
[root@salt-master ~]# systemctl stop firewalld
[root@salt-master ~]# systemctl disable firewalld
[root@salt-master ~]# sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/sysconfig/selinux
[root@salt-master ~]# reboot
[root@salt-master ~]# cat /etc/hosts
192.168.111.128 salt-master
192.168.111.129 salt-client01
[root@salt-master ~]# sudo rpm --import https://repo.saltproject.io/py3/redhat/7/x86_64/3004/SALTSTACK-GPG-KEY.pub
[root@salt-master ~]# curl -fsSL https://repo.saltproject.io/py3/redhat/7/x86_64/3004.repo | sudo tee /etc/yum.repos.d/salt.repo
[root@salt-master ~]# sudo yum install salt-master -y
[root@salt-master ~]# sudo systemctl enable salt-master && sudo systemctl start salt-master
[root@salt-master ~]# sudo yum clean expire-cache
[root@salt-master ~]# salt-key -L
Accepted Keys:
Denied Keys:
Unaccepted Keys:
salt-client01
Rejected Keys:
[root@salt-master ~]# salt-key -A
The following keys are going to be accepted:
Unaccepted Keys:
salt-client01
Proceed? [n/Y] y
Key for minion salt-client01 accepted.
[root@salt-master ~]# salt-key -a salt-client01 # -a=-add -A=all add -d=delete -D=all delete
The key glob 'salt-client01' does not match any unaccepted keys.
[root@salt-master ~]# salt-key -L
Accepted Keys:
salt-client01
Denied Keys:
Unaccepted Keys:
Rejected Keys:
[root@salt-master ~]# salt '*' test.ping
salt-client01:
True
[root@salt-master ~]# salt '*' cmd.run 'echo hello world'
salt-client01:
hello world
[root@salt-master ~]# salt '*' grains.items
salt-client01:
----------
biosreleasedate:
11/12/2020
biosversion:
6.00
cpu_flags:
- fpu
[root@salt-master ~]# salt '*' grains.get hwaddr_interfaces
salt-client01:
----------
ens33:
00:0c:29:c2:80:3b
lo:
00:00:00:00:00:00
[root@salt-master ~]# salt '*' grains.get hwaddr_interfaces:ens33
salt-client01:
00:0c:29:c2:80:3b
[root@salt-master ~]# salt '*' grains.get ip_interfaces:ens33
salt-client01:
- 192.168.111.129
- fe80::cfe3:6f15:94a8:ee48
[root@salt-master ~]# salt '*' grains.item saltversion
salt-client01:
----------
saltversion:
3004.2
salt-client01:
[root@salt-client01 ~]# systemctl stop firewalld
[root@salt-client01 ~]# systemctl disable firewalld
[root@salt-client01 ~]# sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/sysconfig/selinux
[root@salt-client01 ~]# reboot
[root@salt-client01 ~]# cat /etc/hosts
192.168.111.128 salt-master
192.168.111.129 salt-client01
[root@salt-client01 ~]# sudo rpm --import https://repo.saltproject.io/py3/redhat/7/x86_64/3004/SALTSTACK-GPG-KEY.pub
[root@salt-client01 ~]# curl -fsSL https://repo.saltproject.io/py3/redhat/7/x86_64/3004.repo | sudo tee /etc/yum.repos.d/salt.repo
[root@salt-client01 ~]# sudo yum clean expire-cache
[root@salt-client01 ~]# sudo yum install salt-minion -y
[root@salt-client01 ~]# sudo systemctl enable salt-minion && sudo systemctl start salt-minion
[root@salt-client01 ~]# grep -Ev "^$|^#" /etc/salt/minion
master: salt-master
[root@salt-client01 ~]# systemctl restart salt-minion
标签:root,sudo,学习,systemctl,client01,master,saltstack,salt From: https://www.cnblogs.com/wangluohunhun/p/16991291.html