使用saltstack的sls功能
# vim /etc/salt/master#在master配置文件中添加以下内容
file_roots:
base:
- /srv/salt
# mkdir -p /srv/salt
# cd /srv/salt/
# pwd
/srv/salt
# vim top.sls
base:
'*':
- httpd
# vim httpd.sls
httpd:
pkg:
- installed
#
# salt '*' service.available httpd
vm02:
False
#
# salt '*' state.highstate -v
Executing job with jid 20160412203923856918
-------------------------------------------
vm02:
----------
ID: httpd
Function: pkg.installed
Result: True
Comment: The following packages were installed/updated: httpd
Started: 20:39:25.356652
Duration: 46945.068 ms
Changes:
----------
httpd:
----------
new:
2.2.15-47.el6.centos.4
old:
Summary
------------
Succeeded: 1 (changed=1)
Failed: 0
------------
Total states run: 1
#
# salt '*' service.available httpd
vm02:
True
#
#minion端查看httpd是否已经安装成功
# rpm -q httpd
httpd-2.2.15-47.el6.centos.4.x86_64
#
#ok,已经安装成功了,就这么简单。
页:
[1]