Saltstack常用命令总结

本文发布时间: 2019-Mar-22
查找目标minion的三种方式:salt 'shell正则' 命令salt -E 'prel 正则'salt -N $group 命令salt -L 'server_id1,server_id2,server_id3' 命令根据bash glob来查找:salt ’*foo.com’ sys.doc根据正则表达式来查找:salt -E ’.*’ cmd.run ’ls -l | grep foo’根据hostname来查找:salt -L foo.bar.baz,quo.qux cmd.run ’ps aux | grep foo’根据grains(机器各种信息)来查找:salt -G ’os:Redhat’ test.ping综合以上几种模式混合查找:salt -C ’[email protected]:Debian and webser* or [email protected]*’ test.ping常见grains信息如下:1.根据bash glob来查找:salt ’*foo.com’ sys.doc2.根据正则表达式来查找:salt -E ’.*’ cmd.run ’ls -l | grep foo’3.根据hostname来查找:salt -L foo.bar.baz,quo.qux cmd.run ’ps aux | grep foo’4.根据grains(机器各种信息)来查找:salt -G ’os:Redhat’ test.ping5.综合以上几种模式混合查找:salt -C ’[email protected]:Debian and webser* or [email protected]*’ test.ping常见grains信息如下:10.15.137.42: biosreleasedate: 03/07/2013 biosversion: 1.6.0 cpu_flags: fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 x2apic popcnt aes xsave avx lahf_lm ida arat xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid cpu_model: Intel(R) Xeon(R) CPU E5-2670 0 @ 2.60GHz cpuarch: x86_64 defaultencoding: UTF8 defaultlanguage: en_US domain: localdomain fqdn: localhost.localdomain gpus: {'model': 'G200eR2', 'vendor': 'unknown'} host: localhost id: 10.15.137.42 ip_interfaces: {'lo': ['127.0.0.1'], 'eth3': [], 'eth2': [], 'eth1': [], 'eth0': ['10.15.137.42']} ipv4: 10.15.137.42 127.0.0.1 kernel: Linux kernelrelease: 2.6.32-279.el6.x86_64 localhost: localhost.localdomain manufacturer: Dell Inc. master: 10.10.144.112 mem_total: 193651 nodename: localhost.localdomain num_cpus: 32 num_gpus: 1 os: RedHat os_family: RedHat osarch: x86_64 oscodename: Santiago osfinger: Red Hat Enterprise Linux Server-6 osfullname: Red Hat Enterprise Linux Server osmajorrelease: 6 3 osrelease:6.3 path: /sbin:/usr/sbin:/bin:/usr/bin productname: PowerEdge R720 ps: ps -efH pythonpath: /usr/bin /usr/lib64/python26.zip /usr/lib64/python2.6 /usr/lib64/python2.6/plat-linux2 /usr/lib64/python2.6/lib-tk /usr/lib64/python2.6/lib-old /usr/lib64/python2.6/lib-dynload /usr/lib64/python2.6/site-packages /usr/lib64/python2.6/site-packages/gtk-2.0 /usr/lib/python2.6/site-packages /usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info pythonversion: 2.6.6.final.0 saltpath: /usr/lib/python2.6/site-packages/salt saltversion: 0.16.4 serialnumber: C786BX1 server_id: 489250112 shell: /bin/sh virtual: physical


(以上内容不代表本站观点。)
---------------------------------
本网站以及域名有仲裁协议。
本網站以及域名有仲裁協議。

2019-May-25 12:57pm
栏目列表