salt -N 'ceph' test.ping #Test connectivitysalt -E '^server10*' test.ping #Regular match connectivitysalt -S 192.168.150.101 test.ping #Match and execute based on agent IP addresssalt -S 192.168.150.0/24 test.ping #Match and execute based on agent IP addresssalt -N 'ceph' cmd.run 'df -Th'#View disk usage by groupsalt -N 'ceph' cmd.exec_code python 'import os; print os.system("df -Th")'#Python code executionsalt -N 'ceph' cmd.exec_code perl 'print scalar localtime'#Perl code executionsalt -G 'osrelease:6.3' cmd.run 'python -V'#Filter and execute according to grans informationsalt '*' smbios.get system-serial-number #Get the server hardware serial number
salt -N 'ceph' cp.get_file salt://files/opencdn/a.txt /tmp/a.txt #The agent side pulls files from the master to /tmpsalt -N 'ceph' cp.get_file salt://files/opencdn/dir1/ /tmp #The agent side pulls directories from the master to /tmpsalt -N 'ceph' cp.get_url http://www.baidu.com /tmp/index.html #Download urlsalt -N 'ceph' cp.push /etc/fstab #Extract the specified node file to the master, by default in the /var/cache/salt/master/minions/minion-id/files directorysalt -N 'ceph' cp.push_dir /etc/modprobe.d/ glob='*.conf'#Extract the specified configuration file of the node specified directorysalt-cp '*' fstab /etc/fstab #Copy the fstab file in the current directory to the node /etc/fstabsalt-cp -E 'gpu0[1-2][1-5]' fstab /etc/fstab #Regular matching copy filesalt-cp -G 'os:CentOS*' fstab /etc/fstab #grains matching copy file
salt -N 'ceph' user.list_users #List all system accounts in the systemsalt -N 'ceph' user.info lianghaiqiang #List user informationsalt -N 'ceph' user.delete lianghaiqiang remove=True force=True #Force deletion of users
salt-run jobs.active #View all jobs currently running on all minions (run saltutil.running on all minions)salt-run jobs.lookup_jid <jid> #Query the running results of the specified jid from the master jobs cachesalt-run jobs.list_jobs #List all jobs in the current master jobs cachesalt 'xxxx' saltutil.kill_job <jid> #Kill a job on the master