Saltstack (4) return value with MySQL storage salt

Source: Internet
Author: User
Tags saltstack

The Salt return Receiver (returner) allows the Minion response to be stored in various data stores or in different locations, even displaying the response content on the command line. Returner can be used to extend the salt, and to communicate with new, customized interfaces and support for new databases. This example uses the MySQL store salt to return a value

The operation is as follows:

[email protected] ~]# yum-y Install Mysql-connector-python

[email protected] ~]# yum-y Install mysql-python27

[email protected] ~]# yum-y Install Mysql-server

[email protected] ~]# /etc/init.d/mysqld Start

[email protected] ~]# MySQL

CREATE DATABASE ' Salt '

DEFAULT CHARACTER SET UTF8

DEFAULT COLLATE utf8_general_ci;


Use ' salt ';


DROP TABLE IF EXISTS ' jids ';


CREATE TABLE ' Jids ' (

' Jid ' varchar (255) is not NULL,

' Load ' mediumtext not NULL,

UNIQUE KEY ' Jid ' (' Jid ')

) Engine=innodb DEFAULT Charset=utf8;


DROP TABLE IF EXISTS ' salt_returns ';


CREATE TABLE ' Salt_returns ' (

' Fun ' varchar (+) not NULL,

' Jid ' varchar (255) is not NULL,

' Return ' Mediumtext not NULL,

' ID ' varchar (255) is not NULL,

' Success ' varchar () not NULL,

' Full_ret ' Mediumtext not NULL,

' Alter_time ' TIMESTAMP DEFAULT current_timestamp,

KEY ' id ' (' id '),

KEY ' Jid ' (' Jid '),

KEY ' fun ' (' fun ')

) Engine=innodb DEFAULT Charset=utf8;


DROP TABLE IF EXISTS ' salt_events ';

CREATE TABLE ' salt_events ' (

' ID ' BIGINT not NULL auto_increment,

' Tag ' varchar (255) Not NULL,

' Data ' varchar (1024x768) is not NULL,

' Alter_time ' TIMESTAMP DEFAULT current_timestamp,

PRIMARY KEY (' id '),

KEY ' tag ' (' tag ')

) Engine=innodb DEFAULT Charset=utf8;

Grant all on salt.* to [e-mail protected] ' 172.31.% ' identified by ' salt ';

Flush privileges;

Exit

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

#return: MySQL

Master_job_cache:mysql

Mysql.host: ' 172.31.24.139 '

Mysql.user: ' Salt '

Mysql.pass: ' Salt '

Mysql.db: ' Salt '

mysql.port:3306

[email protected] ~]# /etc/init.d/salt-master Restart

[email protected] ~]# Salt ' * ' saltutil.refresh_pillar

[email protected] ~]# Salt ' * ' test.ping

[email protected] ~]# MySQL

Use salt;

SELECT * from Salt_returns;

Exit

[Email protected] ~]#

This article is from the "11462293" blog, please be sure to keep this source http://11472293.blog.51cto.com/11462293/1884477

Saltstack (4) return value with MySQL storage salt

Related Article

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.