salt-ssh 安装salt-minion
安装好saltmaster和salt-ssh
yum install https://repo.saltstack.com/yum/redhat/salt-repo-latest-1.el7.noarch.rpm
yum install salt-master salt-ssh -y
修改/etc/salt/master:
file_roots:
base:
- /srv/salt/base
启动master:
systemctl start salt-master
配置/etc/salt/roster
# Sample salt-ssh config file
#web1:
# host: 192.168.42.1 # The IP addr or DNS hostname
# user: fred # Remote executions will be executed as user fred
# passwd: foobarbaz # The password to use for login, if omitted, keys are used
# sudo: True # Whether to sudo to root, not enabled by default
#web2:
# host: 192.168.42.2
liulianmessage:
host: 172.16.88.199
user: root
password: adm*123
# sudo: True
# tty: True
# sudo_user: 6lapp
port: 33222
timeout: 10
测试:
salt-ssh '*' test.ping
mkdir /srv/salt/base/minion
cat minion-install.sls
minion_yum:
file.managed:
- name: /home/6lapp/salt-repo-latest-1.el7.noarch.rpm
- source: salt://minion/salt-repo-latest-1.el7.noarch.rpm
- mode: 644
- user: root
- group: root
cmd.run:
- name: cd /home/6lapp && rpm -ivh salt-repo-latest-1.el7.noarch.rpm
- require:
- file: minion_yum
pkg-saltminion:
pkg.installed:
- names:
- salt-minion
- require:
- cmd: minion_yum
- unless: rpm -qa| grep salt-minion
saltminon-config:
file.managed:
- name: /etc/salt/minion
- source: salt://minion/minion
- mode: 644
- user: root
- group: root
minion_service:
service.running:
- name: salt-minion
- enable: True
- require:
- file: saltminon-config
将salt-repo-latest-1.el7.noarch.rpm和minion的配置文件minion 放到minion文件夹下
salt-ssh 'liulianmessage' state.sls minion.minion-install
可以看到minion端安装成功
Accepted Keys:
liulianmessage
Denied Keys:
Unaccepted Keys:
Rejected Keys:
本文转自 674591788 51CTO博客,原文链接:http://blog.51cto.com/mrdeng/1895761