安装master端:
[[email protected] ~]# ifconfig eth0 Link encap:Ethernet HWaddr 52:54:00:28:16:11 inet addr:192.168.0.21 Bcast:192.168.1.255 Mask:255.255.254.0 inet6 addr: fe80::5054:ff:fe28:1611/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:2648004 errors:0 dropped:0 overruns:0 frame:0 TX packets:21384 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:338622498 (322.9 MiB) TX bytes:1884671 (1.7 MiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:39 errors:0 dropped:0 overruns:0 frame:0 TX packets:39 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:2694 (2.6 KiB) TX bytes:2694 (2.6 KiB) [[email protected] ~]# yum install epel-release -y [[email protected] ~]# yum install salt-master -y [[email protected] ~]# salt-master --version salt-master 2015.5.8 (Lithium) [[email protected] ~]# /etc/init.d/salt-master start Starting salt-master daemon: [ OK ] [[email protected] ~]# ss -lnpt | grep 45 LISTEN 0 100 *:4505 *:* users:(("salt-master",4882,12)) LISTEN 0 100 *:4506 *:* users:(("salt-master",4902,20)) [[email protected] ~]#
#启动salt-master端
====================================================================
安装minion端:
[[email protected] ~]# ifconfig eth0 Link encap:Ethernet HWaddr 52:54:00:20:B9:98 inet addr:192.168.0.22 Bcast:192.168.1.255 Mask:255.255.254.0 inet6 addr: fe80::5054:ff:fe20:b998/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:2561616 errors:0 dropped:0 overruns:0 frame:0 TX packets:17514 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:328408944 (313.1 MiB) TX bytes:1569597 (1.4 MiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) [[email protected] ~]# yum install epel-release -y [[email protected] ~]# yum install salt-minion -y [[email protected] ~]# salt-minion --version salt-minion 2015.5.8 (Lithium) [[email protected] ~]# sed -i ‘[email protected]^#master:.*@master: [email protected]‘ /etc/salt/minion
#192.168.0.21是我master端的IP地址
[[email protected] ~]# /etc/init.d/salt-minion start Starting salt-minion daemon: [ OK ] [[email protected] ~]# ps -ef | grep salt-minion root 3983 1 0 15:59 ? 00:00:00 /usr/bin/python2.6 /usr/bin/salt-minion -d root 4139 3755 0 16:08 pts/0 00:00:00 grep salt-minion [[email protected] ~]#
#启动salt-minion端
master端:
[[email protected] ~]# salt-key -L Accepted Keys: Denied Keys: Unaccepted Keys: vm02 Rejected Keys: [[email protected] ~]#
#出现了vm02的key
#salt-key常用的选项有
# -a -A -l -L -d -D -y
#接受vm02的key
[[email protected] ~]# salt-key -a vm02 The following keys are going to be accepted: Unaccepted Keys: vm02 Proceed? [n/Y] y Key for minion vm02 accepted. [[email protected] ~]# [[email protected] ~]# salt "*" test.ping vm02: True [[email protected] ~]# [[email protected] ~]# salt "*" cmd.run "ifconfig" vm02: eth0 Link encap:Ethernet HWaddr 52:54:00:20:B9:98 inet addr:192.168.0.22 Bcast:192.168.1.255 Mask:255.255.254.0 inet6 addr: fe80::5054:ff:fe20:b998/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:2654870 errors:0 dropped:0 overruns:0 frame:0 TX packets:18851 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:336733440 (321.1 MiB) TX bytes:1832351 (1.7 MiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) [[email protected] ~]#
#至此,你的salt已经安装成功!!
#更多的使用方法请查官网文档!!!!
时间: 2024-11-07 00:23:14