中文官网:http://docs.saltstack.cn/
将saltstack执行命令返回的信息存储到mysql
方法一:
minion端控制:
python和mysql交互需要一个模块–mysql-python
[root@server2 ~]# yum install -y MySQL-python.x86_64
[root@server2 ~]# vim /etc/salt/minion
874 mysql.host: '172.25.76.1'
875 mysql.user: 'salt'
876 mysql.pass: 'westos'
877 mysql.db: 'salt'
878 mysql.port: 3306
[root@server2 ~]# systemctl restart salt-minion.service
master:
[root@server1 ~]# yum install -y mariadb-server MySQL-python.x86_64
[root@server1 ~]# systemctl start mariadb
[root@server1 ~]# mysql
MariaDB [(none)]> grant all on salt.* to salt@'%' identified by 'westos';
创建数据库
[root@server1 ~]# vim add.sql
CREATE DATABASE `salt`
DEFAU