使用saltstack的sls功能
sls文件编写1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# 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]