返回所有tcp连接
node1:
----------
0:
----------
local_addr:
0.0.0.0
local_port:
22
remote_addr:
0.0.0.0
remote_port:
0
1:
----------
local_addr:
0.0.0.0
local_port:
4505
remote_addr:
0.0.0.0
remote_port:
0
10:
----------
local_addr:
192.168.220.10
local_port:
33270
remote_addr:
192.168.220.10
remote_port:
4506
11:
----------
local_addr:
127.0.0.1
local_port:
47714
remote_addr:
127.0.0.1
remote_port:
4506
12:
----------
local_addr:
192.168.220.10
local_port:
4505
remote_addr:
192.168.220.30
remote_port:
38894
13:
----------
local_addr:
192.168.220.10
local_port:
4506
remote_addr:
192.168.220.10
remote_port:
33270
14:
----------
local_addr:
192.168.220.10
local_port:
4506
remote_addr:
192.168.220.30
remote_port:
57468
15:
----------
local_addr:
192.168.220.10
local_port:
22
remote_addr:
192.168.220.1
remote_port:
54526
2:
----------
local_addr:
127.0.0.1
local_port:
25
remote_addr:
0.0.0.0
remote_port:
0
3:
----------
local_addr:
0.0.0.0
local_port:
4506
remote_addr:
0.0.0.0
remote_port:
0
4:
----------
local_addr:
192.168.220.10
local_port:
22
remote_addr:
192.168.220.1
remote_port:
59734
5:
----------
local_addr:
192.168.220.10
local_port:
4506
remote_addr:
192.168.220.30
remote_port:
49114
6:
----------
local_addr:
192.168.220.10
local_port:
60916
remote_addr:
192.168.220.10
remote_port:
4505
7:
----------
local_addr:
192.168.220.10
local_port:
4505
remote_addr:
192.168.220.10
remote_port:
60916
8:
----------
local_addr:
127.0.0.1
local_port:
47718
remote_addr:
127.0.0.1
remote_port:
4506
9:
----------
local_addr:
192.168.220.10
local_port:
33304
remote_addr:
192.168.220.10
remote_port:
4506
[root@node1 ~]# lsof -ni:22
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
sshd 1021 root 3u IPv4 19985 0t0 TCP *:ssh (LISTEN)
sshd 1021 root 4u IPv6 19987 0t0 TCP *:ssh (LISTEN)
sshd 4297 root 3u IPv4 76879 0t0 TCP 192.168.220.10:ssh->192.168.220.1:59734 (ESTABLISHED)
sshd 10453 root 3u IPv4 131595 0t0 TCP 192.168.220.10:ssh->192.168.220.1:54526 (ESTABLISHED)
通过IP和子网掩码计算出网段
alt '*' network.calc_net 192.168.220.10 255.255.255.0
192.168.220.10:
192.168.220.0/24
测试minion至某一台服务器的网络是否连通
[root@node1 yum.repos.d]# salt '*' network.connect baidu.com 80
node1:
----------
comment:
Successfully connected to baidu.com (39.156.69.79) on tcp port 80
result:
True
node02:
----------
comment:
Successfully connected to baidu.com (39.156.69.79) on tcp port 80
result:
True
查看默认路由
[root@node1 yum.repos.d]# salt '*' network.default_route
node1:
|_
----------
addr_family:
inet
destination:
0.0.0.0
flags:
UG
gateway:
192.168.220.2
interface:
ens33
netmask:
0.0.0.0
|_
----------
addr_family:
inet6
destination:
::/0
flags:
-1
gateway:
::
interface:
lo
netmask:
|_
----------
addr_family:
inet6
destination:
::/0
flags:
-1
gateway:
::
interface:
lo
netmask:
node02:
|_
----------
addr_family:
inet
destination:
0.0.0.0
flags:
UG
gateway:
192.168.220.2
interface:
ens33
netmask:
0.0.0.0
|_
----------
addr_family:
inet6
destination:
::/0
flags:
-1
gateway:
::
interface:
lo
netmask:
|_
----------
addr_family:
inet6
destination:
::/0
flags:
-1
gateway:
::
interface:
lo
netmask:
查看主机的fqdn(完全限定域名)
[root@master ~]# salt '*' network.get_hostname
192.168.220.10:
node1
192.168.220.30:
node02
查询到一个目标网络的路由信息
[root@node1 yum.repos.d]# salt '*' network.get_route 192.168.220.10
node1:
----------
destination:
192.168.220.10
gateway:
None
interface:
lo
source:
192.168.220.10
node02:
----------
destination:
192.168.220.10
gateway:
None
interface:
ens33
source:
192.168.220.30
返回指定网卡的MAC地址
[root@node1 yum.repos.d]# salt '*' network.hw_addr ens33
node1:
00:0c:29:a0:77:bd
node02:
00:0c:29:45:ba:a4
从特定CIDR检索接口名称
判断当前主机是否在某一个网段内
[root@node1 yum.repos.d]# salt '*' network.in_subnet 192.168.220.0/24
node1:
True
node02:
True
返回指定网卡的信息
[root@node1 yum.repos.d]# salt '*' network.interface ens33
node1:
|_
----------
address:
192.168.220.10
broadcast:
192.168.220.255
label:
ens33
netmask:
255.255.255.0
node02:
|_
----------
address:
192.168.220.30
broadcast:
192.168.220.255
label:
ens33
netmask:
255.255.255.0
返回指定网卡的IP地址
[root@node1 yum.repos.d]# salt '*' network.interface_ip ens33
node1:
192.168.220.10
node02:
192.168.220.30
返回当前系统中所有的网卡信息
[root@node1 yum.repos.d]# salt '*' network.interfaces
node1:
----------
ens33:
----------
hwaddr:
00:0c:29:a0:77:bd
inet:
|_
----------
address:
192.168.220.10
broadcast:
192.168.220.255
label:
ens33
netmask:
255.255.255.0
inet6:
|_
----------
address:
fe80::930:ee39:da6:6a84
prefixlen:
64
scope:
link
up:
True
lo:
----------
hwaddr:
00:00:00:00:00:00
inet:
|_
----------
address:
127.0.0.1
broadcast:
None
label:
lo
netmask:
255.0.0.0
inet6:
|_
----------
address:
::1
prefixlen:
128
scope:
host
up:
True
node02:
----------
ens33:
----------
hwaddr:
00:0c:29:45:ba:a4
inet:
|_
----------
address:
192.168.220.30
broadcast:
192.168.220.255
label:
ens33
netmask:
255.255.255.0
inet6:
|_
----------
address:
fe80::f826:1357:7a99:9df3
prefixlen:
64
scope:
link
up:
True
lo:
----------
hwaddr:
00:00:00:00:00:00
inet:
|_
----------
address:
127.0.0.1
broadcast:
None
label:
lo
netmask:
255.0.0.0
inet6:
|_
----------
address:
::1
prefixlen:
128
scope:
host
up:
True
返回一个IPv4的地址列表
该函数将会忽略掉127.0.0.1的地址
[root@node1 yum.repos.d]# salt '*' network.ip_addrs
node1:
- 192.168.220.10
node02:
- 192.168.220.30
返回所有打开的端口和状态
[root@node1 yum.repos.d]# salt 'node1' network.netstat
node1:
|_
----------
inode:
19985
local-address:
0.0.0.0:22
program:
1021/sshd
proto:
tcp
recv-q:
0
remote-address:
0.0.0.0:*
send-q:
0
state:
LISTEN
user:
0
|_
----------
inode:
87452
local-address:
0.0.0.0:4505
program:
5505/python
proto:
tcp
recv-q:
0
remote-address:
0.0.0.0:*
send-q:
0
state:
LISTEN
user:
0
|_
----------
inode:
18371
local-address:
127.0.0.1:25
program:
1220/master
proto:
tcp
recv-q:
0
remote-address:
0.0.0.0:*
send-q:
0
state:
LISTEN
user:
0
|_
----------
inode:
90247
local-address:
0.0.0.0:4506
program:
5513/python
proto:
tcp
recv-q:
0
remote-address:
0.0.0.0:*
send-q:
0
state:
LISTEN
user:
0
|_
----------
inode:
156917
local-address:
192.168.220.10:22
program:
10777/sshd:
proto:
tcp
recv-q:
0
remote-address:
192.168.220.1:55030
send-q:
0
state:
ESTABLISHED
user:
0
|_
----------
inode:
76879
local-address:
192.168.220.10:22
program:
4297/sshd:
proto:
tcp
recv-q:
0
remote-address:
192.168.220.1:59734
send-q:
0
state:
ESTABLISHED
user:
0
|_
----------
inode:
131607
local-address:
192.168.220.10:4506
program:
5513/python
proto:
tcp
recv-q:
0
remote-address:
192.168.220.30:49114
send-q:
0
state:
ESTABLISHED
user:
0
|_
----------
inode:
92657
local-address:
192.168.220.10:60916
program:
6057/python
proto:
tcp
recv-q:
0
remote-address:
192.168.220.10:4505
send-q:
0
state:
ESTABLISHED
user:
0
|_
----------
inode:
94970
local-address:
192.168.220.10:4505
program:
5505/python
proto:
tcp
recv-q:
0
remote-address:
192.168.220.10:60916
send-q:
0
state:
ESTABLISHED
user:
0
|_
----------
inode:
0
local-address:
127.0.0.1:47818
program:
-
proto:
tcp
recv-q:
0
remote-address:
127.0.0.1:4506
send-q:
0
state:
TIME_WAIT
user:
0
|_
----------
inode:
92640
local-address:
192.168.220.10:33270
program:
6057/python
proto:
tcp
recv-q:
0
remote-address:
192.168.220.10:4506
send-q:
0
state:
ESTABLISHED
user:
0
|_
----------
inode:
131687
local-address:
192.168.220.10:4505
program:
5505/python
proto:
tcp
recv-q:
0
remote-address:
192.168.220.30:38894
send-q:
0
state:
ESTABLISHED
user:
0
|_
----------
inode:
90080
local-address:
192.168.220.10:4506
program:
5513/python
proto:
tcp
recv-q:
0
remote-address:
192.168.220.10:33270
send-q:
0
state:
ESTABLISHED
user:
0
|_
----------
inode:
111872
local-address:
192.168.220.10:4506
program:
5513/python
proto:
tcp
recv-q:
0
remote-address:
192.168.220.30:57468
send-q:
0
state:
ESTABLISHED
user:
0
|_
----------
inode:
131595
local-address:
192.168.220.10:22
program:
10453/sshd:
proto:
tcp
recv-q:
0
remote-address:
192.168.220.1:54526
send-q:
0
state:
ESTABLISHED
user:
0
|_
----------
inode:
19987
local-address:
:::22
program:
1021/sshd
proto:
tcp6
recv-q:
0
remote-address:
:::*
send-q:
0
state:
LISTEN
user:
0
|_
----------
inode:
18372
local-address:
::1:25
program:
1220/master
proto:
tcp6
recv-q:
0
remote-address:
:::*
send-q:
0
state:
LISTEN
user:
0
|_
----------
inode:
17518
local-address:
127.0.0.1:323
program:
778/chronyd
proto:
udp
recv-q:
0
remote-address:
0.0.0.0:*
send-q:
0
user:
0
|_
----------
inode:
17519
local-address:
::1:323
program:
778/chronyd
proto:
udp6
recv-q:
0
remote-address:
:::*
send-q:
0
user:
0
使用ping命令测试到某主机的连通性
[root@node1 yum.repos.d]# salt '*' network.ping baidu.com
node1:
PING baidu.com (39.156.69.79) 56(84) bytes of data.
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=1 ttl=128 time=25.0 ms
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=2 ttl=128 time=23.7 ms
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=3 ttl=128 time=22.5 ms
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=4 ttl=128 time=24.8 ms
--- baidu.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 22.522/24.045/25.003/1.016 ms
node02:
PING baidu.com (39.156.69.79) 56(84) bytes of data.
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=1 ttl=128 time=25.6 ms
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=2 ttl=128 time=23.5 ms
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=3 ttl=128 time=23.9 ms
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=4 ttl=128 time=24.7 ms
--- baidu.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3006ms
rtt min/avg/max/mdev = 23.511/24.456/25.649/0.826 ms
返回一个指定的IP地址的反向地址
判断指定的服务是否可用
[root@node1 yum.repos.d]# salt '*' service.available sshd
node1:
True
node02:
True
[root@node1 yum.repos.d]# salt '*' service.available vsftpd
node1:
False
node02:
False
获取所有正在运行的服务
[root@node1 yum.repos.d]# salt '*' service.get_all
node1:
- -.mount
- NetworkManager
- NetworkManager-dispatcher
- NetworkManager-wait-online
- README
- arp-ethers
- auditd
- autovt@
- basic.target
- blk-availability
- bluetooth.target
- boot.mount
- brandbot
- brandbot.path
- chrony-dnssrv@
- [email protected]
- chrony-wait
- chronyd
- console-getty
- console-shell
- container-getty@
- cpupower
- crond
- cryptsetup-pre.target
- cryptsetup.target
......
检查指定服务是否开机不自动启动
[root@node1 yum.repos.d]# salt '*' service.disabled httpd
node1:
True
node02:
True
设置指定服务开机不自动启动
[root@node1 yum.repos.d]# salt '*' service.disable httpd
node1:
False
node02:
True
设置指定服务开机自动启动
[root@node1 yum.repos.d]# salt '*' service.enable httpd
node1:
True
node02:
True
重新加载指定服务
[root@master ~]# salt '*' service.reload httpd
192.168220.20:
True
停止指定服务
[root@node1 yum.repos.d]# salt '*' service.stop httpd
node1:
True
node02:
True
启动指定服务
[root@node1 yum.repos.d]# salt '*' service.start httpd
node1:
True
node02:
True
重启指定服务
[root@node1 yum.repos.d]# salt '*' service.restart httpd
node1:
True
node02:
True
查看指定服务的状态
[root@node1 yum.repos.d]# salt '*' service.status httpd
node1:
True
node02:
True
只下载软件包但不安装
此功能将会下载指定的软件包,但是需要在minion端安装yum-utils,可以使用 cmd.run 进行远程安装
[root@node1 yum.repos.d]# salt '*' pkg.download wget
node1:
----------
wget:
/var/cache/yum/packages/wget-1.14-18.el7_6.1.x86_64.rpm
node02:
----------
wget:
/var/cache/yum/packages/wget-1.14-18.el7_6.1.x86_64.rpm
列出指定包或系统中已安装的所有包的文件
//列出已安装的apache软件包提供的所有文件
[root@node1 yum.repos.d]# salt 'node1' pkg.file_list httpd
node1:
----------
errors:
files:
- /etc/httpd
- /etc/httpd/conf
- /etc/httpd/conf.d
- /etc/httpd/conf.d/README
- /etc/httpd/conf.d/autoindex.conf
- /etc/httpd/conf.d/userdir.conf
- /etc/httpd/conf.d/welcome.conf
- /etc/httpd/conf.modules.d
- /etc/httpd/conf.modules.d/00-base.conf
- /etc/httpd/conf.modules.d/00-dav.conf
- /etc/httpd/conf.modules.d/00-lua.conf
- /etc/httpd/conf.modules.d/00-mpm.conf
- /etc/httpd/conf.modules.d/00-proxy.conf
- /etc/httpd/conf.modules.d/00-systemd.conf
- /etc/httpd/conf.modules.d/01-cgi.conf
- /etc/httpd/conf/httpd.conf
- /etc/httpd/conf/magic
- /etc/httpd/logs
- /etc/httpd/modules
- /etc/httpd/run
- /etc/logrotate.d/httpd
- /etc/sysconfig/htcacheclean
- /etc/sysconfig/httpd
- /run/httpd
- /run/httpd/htcacheclean
- /usr/lib/systemd/system/htcacheclean.service
- /usr/lib/systemd/system/httpd.service
- /usr/lib/tmpfiles.d/httpd.conf
- /usr/lib64/httpd
- /usr/lib64/httpd/modules
- /usr/lib64/httpd/modules/mod_access_compat.so
//当不提供参数时,将会列出当前系统中所有已安装软件的文件列表
查看包组的信息
[root@node1 ~]# salt '*' pkg.group_info 'Development Tools'
node02:
----------
conditional:
default:
- byacc
- cscope
- ctags
- diffstat
- doxygen
- elfutils
- gcc-gfortran
- git
- indent
- intltool
- patchutils
- rcs
- subversion
- swig
- systemtap
description:
A basic development environment.
group:
Development Tools
id:
development
mandatory:
- autoconf
- automake
- binutils
- bison
- flex
- gcc
- gcc-c++
- gettext
- libtool
- make
- patch
- pkgconfig
- redhat-rpm-config
- rpm-build
- rpm-sign
optional:
- ElectricFence
- ant
- babel
- bzr
- ccache
- chrpath
- clips
- clips-devel
- clips-doc
- clips-emacs
- clips-xclips
- clipsmm-devel
- clipsmm-doc
- cmake
- cmucl
- colordiff
- compat-gcc-44
- compat-gcc-44-c++
- cvs
- cvsps
- darcs
- dejagnu
- email2trac
- expect
- ftnchek
- gcc-gnat
- gcc-objc
- gcc-objc++
- ghc
- git
- haskell-platform
- imake
- javapackages-tools
- ksc
- libstdc++-docs
- lua
- mercurial
- mock
- mod_dav_svn
- nasm
- nqc
- nqc-doc
- ocaml
- perltidy
- python-docs
- qgit
- rpmdevtools
- rpmlint
- sbcl
- scorep
- systemtap-sdt-devel
- systemtap-server
- trac
- trac-git-plugin
- trac-mercurial-plugin
- trac-webadmin
- translate-toolkit
type:
package group
列出系统中所有的包组
[root@node1 ~]# salt '*' pkg.group_list
node02:
----------
available:
- Additional Development
- Anaconda Tools
- Backup Client
- Backup Server
- Base
- Buildsystem building group
- CentOS Linux Client product core
- CentOS Linux ComputeNode product core
- CentOS Linux Server product core
- CentOS Linux Workstation product core
- Cinnamon
- Common NetworkManager submodules
- Compatibility Libraries
- Conflicts (Client)
- Conflicts (ComputeNode)
- Conflicts (Server)
- Conflicts (Workstation)
- Console Internet Tools
- Core
- DNS Name Server
- Debugging Tools
- Desktop Debugging and Performance Tools
- Development Tools
- Dial-up Networking Support
- Directory Client
- Directory Server
- E-mail Server
- Educational Software
- Electronic Lab
- Emacs
- FTP Server
- Fedora Packager
- File and Storage Server
- Fonts
- GNOME
- GNOME Applications
- General Purpose Desktop
- Graphical Administration Tools
- Graphics Creation Tools
- Guest Agents
- Guest Desktop Agents
- Hardware Monitoring Utilities
- Haskell
- High Availability
- Hyper-v platform specific packages
- Identity Management Server
- Infiniband Support
- Input Methods
- Internet Applications
- Internet Browser
- Java Platform
- KDE
- KDE Applications
- KDE Multimedia Support
- KVM platform specific packages
- LXQt Desktop
- Large Systems Performance
- Legacy UNIX Compatibility
- Legacy X Window System Compatibility
- Load Balancer
- MATE
- Mainframe Access
- MariaDB Database Client
- MariaDB Database Server
- Milkymist
- Multimedia
- Network File System Client
- Network Infrastructure Server
- Networking Tools
- Office Suite and Productivity
- PHP Support
- Performance Tools
- Perl Support
- Perl for Web
- Platform Development
- PostgreSQL Database Client
- PostgreSQL Database Server
- Print Server
- Printing Client
- Python
- Remote Desktop Clients
- Remote Management for Linux
- Resilient Storage
- Ruby Support
- Scientific Support
- Security Tools
- Smart Card Support
- System Administration Tools
- System Management
- Technical Writing
- TurboGears application framework
- VMware platform specific packages
- Virtualization Client
- Virtualization Hypervisor
- Virtualization Platform
- Virtualization Tools
- Web Server
- Web Servlet Engine
- X Window System
- Xfce
available environments:
- Minimal Install
- Compute Node
- Infrastructure Server
- File and Print Server
- Cinnamon Desktop
- MATE Desktop
- Basic Web Server
- Virtualization Host
- Server with GUI
- GNOME Desktop
- KDE Plasma Workspaces
- Development and Creative Workstation
available languages:
----------
installed:
installed environments:
安装软件
[root@master ~]# salt '*' pkg.install wget
192.168.220.20:
----------
wget:
----------
new:
1.14-18.el7
old:
列出已下载到本地的软件包
以字典的方式列出当前已安装的软件包
[root@node1 ~]# salt 'node02' pkg.list_pkgs
node02:
----------
GeoIP:
1.5.0-11.el7
NetworkManager:
1:1.8.0-9.el7
NetworkManager-config-server:
1:1.8.0-9.el7
NetworkManager-libnm:
1:1.8.0-9.el7
NetworkManager-team:
1:1.8.0-9.el7
NetworkManager-tui:
1:1.8.0-9.el7
PyYAML:
3.10-11.el7
Red_Hat_Enterprise_Linux-Release_Notes-7-en-US:
7-2.el7
Red_Hat_Enterprise_Linux-Release_Notes-7-zh-CN:
7-2.2.el7
acl:
2.2.51-12.el7
aic94xx-firmware:
30-6.el7
alsa-firmware:
1.0.28-2.el7
alsa-lib:
1.1.3-3.el7
alsa-tools-firmware:
1.1.0-1.el7
apr:
1.4.8-5.el7
apr-util:
1.5.2-6.el7
audit:
2.7.6-3.el7
audit-libs:
2.7.6-3.el7
authconfig:
6.2.8-30.el7
basesystem:
10.0-7.el7
bash:
4.2.46-28.el7
bind-libs-lite:
32:9.9.4-50.el7
bind-license:
32:9.9.4-50.el7
binutils:
2.25.1-31.base.el7
biosdevname:
0.7.2-2.el7
btrfs-progs:
4.9.1-1.el7
bzip2-libs:
1.0.6-13.el7
ca-certificates:
2017.2.14-71.el7
chkconfig:
1.7.4-1.el7
chrony:
3.1-2.el7
coreutils:
8.22-18.el7
cpio:
2.11-24.el7
cracklib:
2.9.0-11.el7
cracklib-dicts:
2.9.0-11.el7
cronie:
1.4.11-17.el7
cronie-anacron:
1.4.11-17.el7
crontabs:
1.11-6.20121102git.el7
cryptsetup-libs:
2.0.3-5.el7
curl:
7.29.0-42.el7
cyrus-sasl-lib:
2.1.26-21.el7
dbus:
1:1.6.12-17.el7
dbus-glib:
0.100-7.el7
dbus-libs:
1:1.6.12-17.el7
dbus-python:
1.1.1-9.el7
desktop-file-utils:
0.23-1.el7
device-mapper:
7:1.02.140-8.el7
device-mapper-event:
7:1.02.140-8.el7
device-mapper-event-libs:
7:1.02.140-8.el7
device-mapper-libs:
7:1.02.140-8.el7
device-mapper-persistent-data:
0.7.0-0.1.rc6.el7
dhclient:
12:4.2.5-58.el7
dhcp-common:
12:4.2.5-58.el7
dhcp-libs:
12:4.2.5-58.el7
diffutils:
3.3-4.el7
dmidecode:
1:3.0-5.el7
dracut:
033-502.el7
dracut-config-rescue:
033-502.el7
dracut-network:
033-502.el7
e2fsprogs:
1.42.9-10.el7
e2fsprogs-libs:
1.42.9-10.el7
ebtables:
2.0.10-15.el7
elfutils-default-yama-scope:
0.168-8.el7
elfutils-libelf:
0.168-8.el7
elfutils-libs:
0.168-8.el7
emacs-filesystem:
1:24.3-19.el7_3
ethtool:
2:4.8-1.el7
expat:
2.1.0-10.el7_3
file:
5.11-33.el7
file-libs:
5.11-33.el7
filesystem:
3.2-21.el7
findutils:
1:4.5.11-5.el7
fipscheck:
.....
列出指定文件是由哪个包提供的
[root@node1 ~]# salt '*' pkg.owner /usr/sbin/apachectl
node1:
httpd
node02:
httpd
[root@node1 ~]# salt '*' pkg.owner /usr/sbin/apachectl /etc/httpd/conf/httpd.conf
node1:
----------
/etc/httpd/conf/httpd.conf:
httpd
/usr/sbin/apachectl:
httpd
node02:
----------
/etc/httpd/conf/httpd.conf:
httpd
/usr/sbin/apachectl:
httpd
卸载指定软件
[root@node1 ~]# salt '*' cmd.run 'rpm -qa|grep wget'
node02:
wget-1.14-15.el7.x86_64
node1:
wget-1.14-15.el7.x86_64
升级系统中所有的软件包或升级指定的软件包
若想升级系统中所有的软件包则把 name 参数去掉即可
[root@node1 ~]# salt '*' pkg.upgrade name=httpd
node1:
----------
node02:
----------