Brief introduction of grains in Saltstack

Source: Internet
Author: User
Tags saltstack

1. What is grains: ( static data,Minion acquisition at startup )

Grains

Static bits of information a minioncollects about the system when the Minion first starts.

The grains interface is made available Tosalt modules, and components so, the right salt minion commands areautomatical Ly available on the right systems.

The above is an official explanation, which means that grains is the static data collected at the first boot of minion, which can be used in salt modules and other components. In fact , grains every time the Minion start (restart) will be collected, that is, report to the master once.



Application Scenarios:

Grains Features – Each launch report, static determines that it is not pillar flexible, to know that pillar is changeable at any time, as long as the master side modified it will be effective immediately. So grains is more suitable for some static property value collection, such as the role of the device , the number of disks (Disk_num) andOther such very fixed properties.

Then we can get a general judgment, if you want to define the value of the property is often changed, then please use pillar, if it is very fixed, not changeable, please use grains .



Grain and Pillar differences

1.grains stores static, infrequently changing content, pillar the opposite

2.grains is stored locally on Minion, while Pillar is stored in master local

3.minion has permissions to manipulate its own grains values, such as additions, deletions, but Minion can only view its own pillar, not authorized to modify


Related commands:

Salt ' * ' Grains.ls # lists all keys for grains

Salt '*' grains.items # View all grains information, view all item



Salt ' * ' Grains.item FQDN #查看单个item


Configuration

1 Minion Configuration

Vi/etc/salt/grains

Cloud:openstack


Restart Minion to make it effective


2

Salt ' * ' grains.get cloud





This article is from the DBA Sky blog, so be sure to keep this source http://9425473.blog.51cto.com/9415473/1713354

Brief introduction of grains in Saltstack

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.