码迷,mamicode.com
首页 > 其他好文 > 详细

saltstack grains

时间:2018-01-15 16:29:33      阅读:152      评论:0      收藏:0      [点我收藏+]

标签:客户   virtual   etc   k8s   ansi   手机   shell   sds   add   

saltstack的grains类似于ansible的setup模块,主要作用为手机客户端的主机基本信息(cpu,内核,os,virtual等)

 

[root@k8s_master ~]# cat /etc/salt/master |grep -v "^#\|^$"
cachedir: /var/cache/salt/master
auto_accept: True
file_recv: True
file_roots:
  base:
    - /root
nodegroups:
   master1: ‘L@k8s_master‘
   agents: ‘L@k8s_node1,k8s_node2‘

查看主机的详细信息

salt -N ‘master1 grains.items

 

 

查看所有键

[root@k8s_master ~]# salt -N master1 grains.ls
k8s_master:
    - SSDs
    - biosreleasedate
    - biosversion
    - cpu_flags
    - cpu_model
    - cpuarch
    - domain
    - fqdn
    - fqdn_ip4
    - fqdn_ip6
    - gpus
    - host
    - hwaddr_interfaces
    - id
    - init
    - ip4_interfaces
    - ip6_interfaces
    - ip_interfaces
    - ipv4
    - ipv6
    - kernel
    - kernelrelease
    - locale_info
    - localhost
    - lsb_distrib_id
    - machine_id
    - manufacturer
    - master
    - mdadm
    - mem_total
    - nodename
    - num_cpus
    - num_gpus
    - os
    - os_family
    - osarch
    - oscodename
    - osfinger
    - osfullname
    - osmajorrelease
    - osrelease
    - osrelease_info
    - path
    - productname
    - ps
    - pythonexecutable
    - pythonpath
    - pythonversion
    - saltpath
    - saltversion
    - saltversioninfo
    - selinux
    - serialnumber
    - server_id
    - shell
    - systemd
    - virtual
    - zmqversion

用法示例: salt <匹配主机> grains.item  <grains.ls>获取的键

[root@k8s_master ~]# salt -N master1 grains.item ipv4
k8s_master:
    ----------
    ipv4:
        - 10.1.14.0
        - 127.0.0.1
        - 172.17.0.1
        - 192.168.132.148

 

saltstack grains

标签:客户   virtual   etc   k8s   ansi   手机   shell   sds   add   

原文地址:https://www.cnblogs.com/FRESHMANS/p/8288252.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!