Rookie play Cloud computing 21: Saltstack's Pillar

Source: Internet
Author: User

Rookie play Cloud computing 21: Saltstack's Pillar

Reference:

Click to open link

View Pillar Data:

# salt ' * ' Pillar.items
The default root directory for pillar in:/srv/pillar, you can change the configuration file/etc/salt/master with the following parameters:

Pillar_roots:your_dir

Build the following pillar root directory and create the Portal file: Top.sls

# mkdir/srv/pillar# Vi/srv/pillar/top.sls

Top.sls:

Base:  ' * ':    -Data

The above entry file specifies the/srv/pillar/data.sls file, which applies to all minions. (‘*‘).

Data.sls:

Info:somedata

Refresh the pillar of all nodes:

# salt ' * ' saltutil.refresh_pillar
202:
True
203:
True
Look at the pillar of the node again:

# salt ' * ' Pillar.items
202:
----------
Info
Some data

...

203:
----------
Info
Some data
...
If you create a subdirectory users/below/srv/pillar/, you can refer directly to Init.sls in Top.sls. For example:

# mkdir/srv/pillar/users# Vi/srv/pillar/users/init.sls

Init.sls content is as follows:

Users:  jhonson:2001  tom:2993  peter:3098  tex:18990

In order to be able to refer to users in Top.sls, you need to change to:

Base:  ' * ':    -Data    -users

Refresh and display:

# salt ' * ' saltutil.refresh_pillar# salt ' * ' Pillar.item users
203:
----------
Users
----------
Jhonson:
2001
Peter
2098
Tex
18900
Tom
2993
202:
----------
Users
----------
Jhonson:
2001
Peter
2098
Tex
18900
Tom
2993

One more example:


# mkdir/srv/pillar/hadoop# Vi/srv/pillar/hadoop/params.sls
Params.sls:

HDFs:  namenode:192.168.122.201  stadbynode:192.168.122.202hbase:  master:192.168.122.201

# Vi/srv/pillar/top.sls
Top.sls:

Base:  ' * ':    -Data    -users    -Hadoop.params

Test using:

# salt ' * ' saltutil.refresh_pillar# salt ' * ' Pillar.items

Rookie play Cloud computing 21: Saltstack's Pillar

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.