saltstack 学习之grains
【基本介绍】
Salt comes with an interface to derive information about the underlying system. This is called the grains interface, because it presents salt with grains of information.It is important to remember that grains are bits of information loaded when the salt minion starts, so this information is static. This means that the information in grains is unchanging, therefore the nature of the data is static. So grains information are things like the running kernel, or the operating system.(grains是跟系统有关的存储一下不变的变量,例如kernel,操作系统等参数)
我对pillar,grains的区别理解
pillar - 存储会变动的变量
grains - 存储不变的变量
【配置】
文件:/etc/salt/minion
配置grains的变量以及刷新,缓存等
# Custom static grains for this minion can be specified here and used in SLS
# files just like all other grains. This example sets 4 custom grains, with
# the 'roles' grain having two values that can be matched against:
#grains:
# roles:
# - webserver
# - memcache
# deployment: datacenter4
# cabinet: 13
# cab_u: 14-15
# The grains_refresh_every setting allows for a minion to periodically check
# its grains to see if they have changed and, if so, to inform the master
# of the new grains. This operation is moderately expensive, therefore
# care should be taken not to set this value too low.
#
# Note: This value is expressed in __minutes__!
#
# A value of 10 minutes is a reasonable default.
#
# If the value is set to zero, this check is disabled.
#grains_refresh_every = 1
# Cache grains on the minion. Default is False.
# grains_cache: False
# Grains cache expiration, in seconds. If the cache file is older than this
# number of seconds then the grains cache will be dumped and fully re-populated
# with fresh data. Defaults to 5 minutes. Will have no effect if 'grains_cache'
# is not enabled.
# grains_cache_expiration: 300
【原则】
grains是可以覆盖的,原则是4到1依次覆盖
Core grains can be overridden by custom grains. As there are several ways of defining custom grains, there is an order of precedence which should be kept in mind when defining them. The order of evaluation is as follows:
1. Core grains.
2. Custom grains in /etc/salt/grains.
3. Custom grains in /etc/salt/minion.
4. Custom grain modules in _grains directory, synced to minions.
Each successive evaluation overrides the previous ones, so any grains defined in /etc/salt/grains that have the same name as a core grain will override that core grain. Similarly, /etc/salt/minion overrides both core grains and grains set in /etc/salt/grains, and custom grain modules will override any grains of the same name.
【使用】
salt '*' grains.items - 获得所有的grains
salt -G 'os:CentOS' test.ping - ping所有os是CentOS的
【参考】
http://docs.saltstack.com/en/latest/topics/targeting/grains.html
分享到:
相关推荐
语言 标签 javascript 数学,逻辑 谷物 内容 背景 指示 提示 资源 ...曾经有一位明智的仆人救了王子的性命。 国王答应支付仆人梦... var grains = new Grains ( ) ; grains . square ( 1 ) // => 1 grains . square ( 2
Dive into grains and pillars, Salt’s basic data elements Control your infrastructure programmatically by extending Salt Master’s functionality Extend Salt with custom modules, the Jinja templating ...
谷物给定每个正方形的数字加倍,计算棋盘上的小麦粒数。 曾经有一位明智的仆人救了王子的性命。 国王答应支付仆人梦dream以求的一切。 仆人知道国王喜欢国际象棋,便告诉国王他想种小麦。 国际象棋棋盘第一个正方形...
Salt-VIM 这是一个用于在服务器上安装的 salt state 模块。下载: 将 salt-vim 下载到您的 salt-master: cd /... vim: {% if grains['os_family'] == 'Debian' %} config_base_dir: /etc/vim {% endif %} autocmds:
Linux运维-运维构架师-05-SaltStack数据系统-Grains.mp4
水稻花后土壤干旱对籽粒中脱落酸、乙烯和抗氧化系统的影响及其与籽粒灌浆的关系,张耗,刘凯,本研究以2个水稻品种为材料,种植于盆钵,自花后9天至成熟设置3个土壤水分处理,分别是保持水层灌溉(WW)、土壤轻度落...
Corn dried distillers grains with solubles (cDDGS) in the diet of pigs change the expression of adipose genes that are potential therapeutic targets in met
新版完整标准 BS 9286-2021 - TC Tracked Changes Abrasive grains and crude — Chemical analysis of silicon carbide.pdf
非常好的重磁反演程序!是在QT的环境下,集成C++做成的!但QT的库比较好,可能大家编绎时有点问题!
py盐盐粒和盐柱的简单python接口安装您可以使用 pip 安装 py-salt 模块: pip install py-salt例子: from pysalt import Pillar , Grainsp = Pillar ()g = Grains ()# Print pillar listprint ( p )# Print `os_...
谷物 内置于Pure Data中的粒度合成器
Nickel shaped-charge liners with nano-sized grains were prepared by the electroforming technique,and the deformation at ultra-high strain rate was performed by explosive detonation. The as-formed and ...
1、在minion端进行配置 1、配置minion配置文件中的default_include:为minion.d. 位置:/etc/salt/minion 2、
Grains进行角色定义,增加灵活性。 使用Salt Pillar进行配置项管理,保证安全性。 使用Salt SSH执行状态,不需要安装Agent,保证通用性。 使用Kubernetes当前稳定版本v1.10.3,保证稳定性。 技术交流QQ群(加群请...
它是用于沙画的CUDA加速库: ://inconvergent.net/grains-of-sand/ 第二部分称为Erosion 。 一个基于Redis的客户端和工作程序,可以接受和绘制Desert原语和编码为JSON对象的命令。 这意味着您可以在任何平台上使用...
The dependence of radiation characteristics of random laser on the size and arrangement of crystal grains in PCs
- source : salt://data/cdalvaro/dotfiles/ - user : {{ grains.main_user }} - group : {{ grains.main_group }} - dir_mode : 755 - template : jinja - exclude_pat : E@(README.md|settings/|pillar/) ...
10: 要进行应用部署,需要安装minion客户端,并配置好master 和id ,还有必须在grains 添加三个变量:group,area,usage。 这个三个变量信息会在主机信息中对应:组,地址,和用途三栏。否则刷新无法获取到主机信息 11: ...
This data set contains seven kinds of rice seed defects: complete grains, mechanical damage grains, germination grains, unfilled grains, moldy grains, hulling grains, and immature grains.
analyse size grain pour calculer taille de grain dans des images micrographique