Centos7.x安装
yum install -y https://repo.saltstack.com/yum/redhat/salt-repo-latest-1.el7.noarch.rpm
yum install -y salt-minionsed -i 's/#master: salt/master: 172.16.8.25/g' /etc/salt/minion
grep -n '^master' /etc/salt/minion
systemctl enable salt-minion.service
systemctl start salt-minion.service
Centos6.x安装
yum install -y http://dl.fedoraproject.org/pub/epel/6Server/x86_64/epel-release-6-8.noarch.rpm
yum clean expire-cache
yum install salt-minion -y
sed -i 's/#master: salt/master: 172.16.8.25/' /etc/salt/minion
grep -n '^master' /etc/salt/minion
/etc/init.d/salt-minion start
vim /etc/salt/master
#return: mysql
master_job_cache: mysql
mysql.host: '172.16.8.25'
mysql.user: 'salt'
mysql.pass: 'salt'
mysql.db: 'salt'
mysql.port: 3306
CREATE DATABASE `salt`
DEFAULT CHARACTER SET utf8
DEFAULT COLLATE utf8_general_ci;
USE `salt`;
CREATE TABLE `jids` (
`jid` varchar(255) NOT NULL,
`load` mediumtext NOT NULL,
UNIQUE KEY `jid` (`jid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `salt_returns` (
`fun` varchar(50) NOT NULL,
`jid` varchar(255) NOT NULL,
`return` mediumtext NOT NULL,
`id` varchar(255) NOT NULL,
`success` varchar(10) 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;
CREATE TABLE `salt_events` (
`id` BIGINT NOT NULL AUTO_INCREMENT,
`tag` varchar(255) NOT NULL,
`data` varchar(1024) NOT NULL,
`alter_time` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `tag` (`tag`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
grant all on salt.* to salt@'172.16.8.0/255.255.255.0' identified by 'salt';
----------------------------------------------------------------------------------------------------------------------------------
curl -k https://172.16.8.25:8000/login -H "Accept: application/x-yaml" -d username='jc' -d password='admin2016' -d eauth='pam'
curl -k https://172.16.8.25:8000/ -H "Accept: application/x-yaml" -H "X-Auth-Token: f2295bafc5d3336fd27438f0a19a727e592e779e" -d client='local' -d tgt='*' -d fun='cmd.run' -d arg="free -m"
查看结果
mysql salt -e "select * from salt_returns\G"