Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

salt stack: grains vs pillars

In the Salt system there are grains and pillars. I understand how I can assign custom grains, but when would it be better to consider using pillars?

like image 747
Jeff Bauer Avatar asked Oct 29 '12 04:10

Jeff Bauer


People also ask

What are pillars in salt?

Pillars are tree-like structures of data defined on the Salt Master and passed through to minions. They allow confidential, targeted data to be securely sent only to the relevant minion.

How do you set grains in SaltStack?

Append a value to a list in the grains config file. If the grain doesn't exist, the grain key is added and the value is appended to the new grain as a list item. If convert is True, convert non-list contents into a list. If convert is False and the grain contains non-list contents, an error is given.

What is salt minion?

Salt minions are your servers that actually run your applications and services. Each minion has an ID assigned to it (which can be automatically generated from the minion's hostname), and the Salt master can refer to this ID to target commands to specific minions. Note.


2 Answers

In Salt, grains are used for immutable aspects of your minion, such as the cpu, memory, location, time zone, etc.

A pillar is a list of data on the master (in SLS format) that you need to distribute to your minions. Pillar allows you to set variables that the minions can access, for example a database configuration option.

like image 169
Jeff Bauer Avatar answered Oct 05 '22 17:10

Jeff Bauer


In short, custom static Grains is likely worse alternative than Pillars.

| Differences                  | Grains                        | Pillars                             | |------------------------------|-------------------------------|-------------------------------------| | This is info which...        | ... Minion knows about itself | ... Minion asks Master about        | |                              |                               |                                     | | Distributed:                 | Yes (different per minion)    | No (single version per master)      | | Centralized:                 | No                            | Yes                                 | |                              |                               |                                     | | Computed automatically:      | Yes (preset/computed value)   | No (only rendered from Jinja/YAML)  | | Assigned manually:           | No (too elaborate)            | Yes (Jinja/YAML sources)            | |                              |                               |                                     | | Conceptually intrinsic to... | ... individual Minion node    | ... entire system managed by Master | | Data under revision control: | No (computed values)          | Yes (Jinja/YAML sources)            | |                              |                               |                                     | | They define rather...        | _provided_ resources          | _required_ resources                | |                              | (e.g. minion OS version)      | (e.g. packages to install)          | |                              |                               |                                     | 
like image 24
uvsmtid Avatar answered Oct 05 '22 15:10

uvsmtid