The pillar of Saltstack data system

Source: Internet
Author: User
Tags saltstack

Open the system's own pillar on master:

[Email protected] ~]# Vim/etc/salt/master

556 Pillar_opts:true

[Email protected] ~]#/etc/init.d/salt-master restart

Stopping salt-master daemon: [OK]

Starting Salt-master daemon: [OK]


[[email protected] ~]# Salt ' * ' pillar.items =======> display system comes with pillar


Pillar Application Scenarios:

1 Sensitive data: such as user name and password

2 Handling of variance variables


[[email protected] ~]# vim/etc/salt/master ==========> Open the following options

533 Pillar_roots:

534 Base:

535-/srv/pillar

556 Pillar_opts:false


[Email protected] srv]# mkdir pillar


[Email protected] srv]#/etc/init.d/salt-master restart

Stopping salt-master daemon: [OK]

Starting Salt-master daemon: [OK]


Example 1:

[Email protected] pillar]# Cat/srv/pillar/apache.sls

{% if grains[' os '] = = ' CentOS '%} if the system is CentOS

APACHE:HTTPD Displays the httpd

{% elif grains[' os '] = = ' Debian '%} if the system is Debian

APACHE:APACHE2 Displays the Apache2

{% ENDIF%}


[[email protected] pillar]# Cat/srv/pillar/top.sls ========>pillar top file

Base

‘*‘:

-Apache


[[email protected] pillar]# Salt ' * ' Pillar.items ========> get pillar value

Linux-node2.example.com:

----------

Apache:

httpd

Linux-node1.example.com:

----------

Apache:

httpd


Example 2: Locating the host

[[email protected] pillar]# Salt ' * ' Saltutil.refresh_pillar =======> refresh pillar

Linux-node1.example.com:

True

Linux-node2.example.com:

True


[[email protected] pillar]# salt-i ' apache:httpd ' test.ping =========> Locate host

Linux-node2.example.com:

True

Linux-node1.example.com:

True


Old boy Website: http://www.etiantian.org/

qq:406564728

Welcome to make valuable suggestions

This article is from the "Linux" blog, so be sure to keep this source http://chenjisong.blog.51cto.com/7858025/1714022

The pillar of Saltstack data system

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.