Saltstack State Management

Source: Internet
Author: User
Tags haproxy saltstack

1. State module

Description format: Yaml format, file with. SLS End

Understanding yamlhttps://www.unixhot.com/docs/saltstack/topics/yaml/index.html

Yaml Kick

First: Indent. Note that it must be two spaces. Indentation represents a hierarchical relationship.

Second: Colon. Combine with spaces to indicate indentation.

The second use of a colon is to represent a key-value pair

Third: The dash indicates the list. There are spaces behind the dash.

[email protected]/srv/hehe/salt/base]# cat Top.sls Base: ' * ':-init.initprod: ' linux-node* ':-cluster.haproxy- Outside-cluster.haproxy-outside-keepalived
2, the module writing storage location

Before writing the state module, define a salt environment; Edit the master configuration file

Vi/etc/salt/master, edit the master configuration file to find File_roots: The base environment that defines the salt. Note that after modifying the configuration file, be sure to restart Masterfile_roots:base:-/srv/salt/base prod:-/srv/salt/prod
3. Writing Apache.sls files

Storage Path/srv/salt/web

The file role is to follow Apache and start

Apache-install:pkg.installed:-Names:-httpd #要安装的包名-httpd-develapache-service:service. Running:-Name:httpd-enable:true #设置开机启动
4. Advanced State Module
# The State system uses a ' top ' file to tell the ' Minions what environment to# use and ' What ' modules to ' use. The state_top file is defined relative to the# root of the base environment as defined in "File Server settings" below.

Top.sls stored in the base environment

Base: ' linux-node1.example.com ': #minion id-web.apache ' linux-node2.example.com ':-Web.apache perform advanced state salt ' Linu X-node1.example.com ' State.highstate test=true


This article is from "Jacky Xin" blog, please be sure to keep this source http://jackyxin.blog.51cto.com/1976631/1834142

Saltstack State Management

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.