grains是什么

grains是minion服务启动后,采集的客户端的一些基本信息,硬件信息,软件信息,网络信息,软件版本等。你可以在minion上自定义一些grains信息。

它是静态的信息,minion服务启动后采集,如果一些信息变更,需要重启minion服务。grains适合做一些静态的属性值的采集

grains的使用

salt  'minionid'  grains.ls

salt  'minionid'  grains.items

salt  'minionid'  grains.item  os

salt  'minionid'  grains.get    os

salt  'minionid'  grains.ls

列出minion所有的grains项的key

  1. [root@master pillar]# salt 'minion01' grains.ls
  2. minion01:
  3. - SSDs
  4. - biosreleasedate
  5. - biosversion
  6. - cpu_flags
  7. - cpu_model
  8. - cpuarch
  9. - domain
  10. - fqdn
  11. - fqdn_ip4
  12. - fqdn_ip6
  13. - gpus
  14. - host
  15. - hwaddr_interfaces
  16. - id
  17. - init
  18. - ip4_interfaces
  19. - ip6_interfaces
  20. - ip_interfaces
  21. - ipv4
  22. - ipv6
  23. - kernel
  24. - kernelrelease
  25. - locale_info
  26. - localhost
  27. - lsb_distrib_codename
  28. - lsb_distrib_id
  29. - lsb_distrib_release
  30. - machine_id
  31. - manufacturer
  32. - master
  33. - mdadm
  34. - mem_total
  35. - nodename
  36. - num_cpus
  37. - num_gpus
  38. - os
  39. - os_family
  40. - osarch
  41. - oscodename
  42. - osfinger
  43. - osfullname
  44. - osmajorrelease
  45. - osrelease
  46. - osrelease_info
  47. - path
  48. - productname
  49. - ps
  50. - pythonexecutable
  51. - pythonpath
  52. - pythonversion
  53. - saltpath
  54. - saltversion
  55. - saltversioninfo
  56. - selinux
  57. - serialnumber
  58. - server_id
  59. - shell
  60. - virtual
  61. - zmqversion
  62. [root@master pillar]#

  

salt  'minionid'  grains.items

列出minion所有的grains项的key和value

  1. [root@master pillar]# salt 'minion01' grains.items
  2. minion01:
  3. ----------
  4. SSDs:
  5. biosreleasedate:
  6. 07/02/2015
  7. biosversion:
  8. 6.00
  9. cpu_flags:
  10. - fpu
  11. - vme
  12. - de
  13. - pse
  14. - tsc
  15. - msr
  16. - pae
  17. - mce
  18. - cx8
  19. - apic
  20. - sep
  21. - mtrr
  22. - pge
  23. - mca
  24. - cmov
  25. - pat
  26. - pse36
  27. - clflush
  28. - dts
  29. - mmx
  30. - fxsr
  31. - sse
  32. - sse2
  33. - ss
  34. - syscall
  35. - nx
  36. - pdpe1gb
  37. - rdtscp
  38. - lm
  39. - constant_tsc
  40. - arch_perfmon
  41. - pebs
  42. - bts
  43. - xtopology
  44. - tsc_reliable
  45. - nonstop_tsc
  46. - aperfmperf
  47. - unfair_spinlock
  48. - pni
  49. - pclmulqdq
  50. - ssse3
  51. - fma
  52. - cx16
  53. - pcid
  54. - sse4_1
  55. - sse4_2
  56. - x2apic
  57. - movbe
  58. - popcnt
  59. - tsc_deadline_timer
  60. - aes
  61. - xsave
  62. - avx
  63. - f16c
  64. - rdrand
  65. - hypervisor
  66. - lahf_lm
  67. - abm
  68. - 3dnowprefetch
  69. - ida
  70. - arat
  71. - xsaveopt
  72. - pln
  73. - pts
  74. - dts
  75. - fsgsbase
  76. - bmi1
  77. - hle
  78. - avx2
  79. - smep
  80. - bmi2
  81. - invpcid
  82. - rtm
  83. - rdseed
  84. - adx
  85. cpu_model:
  86. Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
  87. cpuarch:
  88. x86_64
  89. domain:
  90. fqdn:
  91. minion01
  92. fqdn_ip4:
  93. fqdn_ip6:
  94. gpus:
  95. |_
  96. ----------
  97. model:
  98. SVGA II Adapter
  99. vendor:
  100. unknown
  101. host:
  102. minion01
  103. hwaddr_interfaces:
  104. ----------
  105. eth0:
  106. 00:0c:29:22:4b:e9
  107. lo:
  108. 00:00:00:00:00:00
  109. id:
  110. minion01
  111. init:
  112. upstart
  113. ip4_interfaces:
  114. ----------
  115. eth0:
  116. - 10.0.1.172
  117. lo:
  118. - 127.0.0.1
  119. ip6_interfaces:
  120. ----------
  121. eth0:
  122. - fe80::20c:29ff:fe22:4be9
  123. lo:
  124. - ::1
  125. ip_interfaces:
  126. ----------
  127. eth0:
  128. - 10.0.1.172
  129. - fe80::20c:29ff:fe22:4be9
  130. lo:
  131. - 127.0.0.1
  132. - ::1
  133. ipv4:
  134. - 10.0.1.172
  135. - 127.0.0.1
  136. ipv6:
  137. - ::1
  138. - fe80::20c:29ff:fe22:4be9
  139. kernel:
  140. Linux
  141. kernelrelease:
  142. 2.6.32-504.el6.x86_64
  143. locale_info:
  144. ----------
  145. defaultencoding:
  146. UTF8
  147. defaultlanguage:
  148. en_US
  149. detectedencoding:
  150. UTF-8
  151. localhost:
  152. minion01
  153. lsb_distrib_codename:
  154. Final
  155. lsb_distrib_id:
  156. CentOS
  157. lsb_distrib_release:
  158. 6.6
  159. machine_id:
  160. 749e39b6649273bf0c83d26300000026
  161. manufacturer:
  162. VMware, Inc.
  163. master:
  164. master
  165. mdadm:
  166. mem_total:
  167. 3946
  168. nodename:
  169. minion01
  170. num_cpus:
  171. 4
  172. num_gpus:
  173. 1
  174. os:
  175. CentOS
  176. os_family:
  177. RedHat
  178. osarch:
  179. x86_64
  180. oscodename:
  181. Final
  182. osfinger:
  183. CentOS-6
  184. osfullname:
  185. CentOS
  186. osmajorrelease:
  187. 6
  188. osrelease:
  189. 6.6
  190. osrelease_info:
  191. - 6
  192. - 6
  193. path:
  194. /sbin:/usr/sbin:/bin:/usr/bin
  195. productname:
  196. VMware Virtual Platform
  197. ps:
  198. ps -efH
  199. pythonexecutable:
  200. /usr/bin/python2.6
  201. pythonpath:
  202. - /usr/bin
  203. - /usr/lib64/python26.zip
  204. - /usr/lib64/python2.6
  205. - /usr/lib64/python2.6/plat-linux2
  206. - /usr/lib64/python2.6/lib-tk
  207. - /usr/lib64/python2.6/lib-old
  208. - /usr/lib64/python2.6/lib-dynload
  209. - /usr/lib64/python2.6/site-packages
  210. - /usr/lib64/python2.6/site-packages/gst-0.10
  211. - /usr/lib64/python2.6/site-packages/gtk-2.0
  212. - /usr/lib64/python2.6/site-packages/webkit-1.0
  213. - /usr/lib/python2.6/site-packages
  214. - /usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info
  215. pythonversion:
  216. - 2
  217. - 6
  218. - 6
  219. - final
  220. - 0
  221. saltpath:
  222. /usr/lib/python2.6/site-packages/salt
  223. saltversion:
  224. 2015.5.10
  225. saltversioninfo:
  226. - 2015
  227. - 5
  228. - 10
  229. - 0
  230. selinux:
  231. ----------
  232. enabled:
  233. False
  234. enforced:
  235. Disabled
  236. serialnumber:
  237. VMware-56 4d d2 3c be 05 36 b5-e6 19 4e ef 0b 22 4b e9
  238. server_id:
  239. 1310197239
  240. shell:
  241. /bin/sh
  242. virtual:
  243. VMware
  244. zmqversion:
  245. 3.2.5
  246. [root@master pillar]#

  

salt  'minionid'  grains.item  os

能取出某一个item的值

  1. [root@master pillar]# salt 'minion01' grains.item os
  2. minion01:
  3. ----------
  4. os:
  5. CentOS
  6. [root@master pillar]#

  

salt  'minionid'  grains.get    os

也能取出某一个项的值,以后推荐使用grains.get

  1. [root@master pillar]# salt 'minion01' grains.get os
  2. minion01:
  3. CentOS
  4. [root@master pillar]#

grains的用途

比如使用salt管理的一些机器,有一些是Centos的系统。需要打某个补丁,就可以根基os这个可以找出是哪些机器,

  1. [root@master pillar]# salt -G 'os:CentOS' test.ping
  2. minion01:
  3. True
  4. minion02:
  5. True
  6. [root@master pillar]#

自定义一些grains项

因为grains主要从minion端获取,因此主要还是在minion端去定义,比如我们登陆minion01机器,定义一个role:nginx

打开minion端的配置文件 

  1. vim /etc/salt/minion

看到第9到12行提示,说可以在当前目录下创建minion.d目录,此目录下以*.conf格式的文件会被加载为配置文件  

  1. 9 # Per default the minion will automatically include all config files
  2. 10 # from minion.d/*.conf (minion.d is a directory in the same directory
  3. 11 # as the main minion config file).
  4. 12 #default_include: minion.d/*.conf

在85行到94行查看自定义grains的格式  

  1. 85 # Custom static grains for this minion can be specified here and used in SLS
  2. 86 # files just like all other grains. This example sets 4 custom grains, with
  3. 87 # the 'roles' grain having two values that can be matched against.
  4. 88 #grains:
  5. 89 # roles:
  6. 90 # - webserver
  7. 91 # - memcache
  8. 92 # deployment: datacenter4
  9. 93 # cabinet: 13
  10. 94 # cab_u: 14-15

接下来在minion01自定义grains。

下面给minion01定义了一个role这个key,值为nginx。  注意文件格式是yaml的。配置完毕后重启minion服务

  1. [root@minion01 ~]# mkdir /etc/salt/minion.d -p
  2. [root@minion01 ~]# cd /etc/salt/minion.d/
  3. [root@minion01 minion.d]# pwd
  4. /etc/salt/minion.d
  5. [root@minion01 minion.d]# touch my_grains.conf
  6. [root@minion01 minion.d]# vim my_grains.conf
  7. [root@minion01 minion.d]# cat my_grains.conf
  8. grains:
  9. role: nginx
  10.  
  11. [root@minion01 minion.d]# /etc/init.d/salt-minion restart
  12. Stopping salt-minion daemon: [ OK ]
  13. Starting salt-minion daemon: [ OK ]
  14. [root@minion01 minion.d]#

  

master端测试,看到只有我们自定义的minion01机器有这一项

  1. [root@master pillar]# salt '*' grains.get role
  2. minion01:
  3. nginx
  4. minion02:
  5. [root@master pillar]# salt -G 'role:nginx' test.ping
  6. minion01:
  7. True
  8. [root@master pillar]#

  

其实可以不用重启minion,让更改的配置生效,这需要在master端执行刷新命令

操作如下,比如,minion01把自定义的grains改成如下

  1. [root@minion01 minion.d]# vim my_grains.conf
  2. [root@minion01 minion.d]# cat my_grains.conf
  3. grains:
  4. role: apache
  5.  
  6. [root@minion01 minion.d]#

master端执行刷新此minion的grains,如下

  1. [root@master pillar]# salt 'minion01' saltutil.sync_grains
  2. minion01:
  3. [root@master pillar]# salt '*' grains.get role
  4. minion02:
  5. minion01:
  6. apache
  7. [root@master pillar]#

  

另外有一个地方也可以自定义grains

这个时候第一行不用写grains了

minion01上操作如下,比如自定义一个role2:tomcat

  1. [root@minion01 minion.d]# touch /etc/salt/grains
  2. [root@minion01 minion.d]# vim /etc/salt/grains
  3. [root@minion01 minion.d]# cat /etc/salt/grains
  4. role2: tomcat
  5. [root@minion01 minion.d]#

master端操作,先刷新,再取值

  1. [root@master pillar]# salt 'minion01' saltutil.sync_grains
  2. minion01:
  3. [root@master pillar]# salt '*' grains.get role2
  4. minion01:
  5. tomcat
  6. minion02:
  7. [root@master pillar]#

  

接下来学习配置管理

SLS(代表SaLt State文件)是Salt State系统的核心。SLS描述了系统的目标状态,由格式简单的数据构成。这经常被称作配置管理 首先,在master上面定义salt的主目录,默认是在/srv/salt/下面,vim /etc/salt/master:

  1. file_roots:
  2. base:
  3. - /srv/salt
  4. dev:
  5. - /srv/salt-dev

给minion安装apache服务,我们知道通过salt的远程执行命令我们可以给minion安装apache,然后通过命令也能启动minion端的apache服务,但是有个缺点就是,我们需要每次手动去输入命令,非常不方便。

试想怎么通过配置文件把我要执行的东西都配置好呢,然后执行此配置文件,比如:安装apache,设置开机自启动,启动服务等这一系列的东西呢。

这点就是salt的配置管理了。通过配置文件管理minion

首先需要打开master端相关的配置项

[root@master ~]# vim /etc/salt/master

找到416行,打开注释,注意缩进,salt中2个空格作为一个缩进。

  1. file_roots:
  2. base:
  3. - /srv/salt

然后重启master服务,建立配置管理目录

  1. [root@master ~]# /etc/init.d/salt-master restart
  2. Stopping salt-master daemon: [ OK ]
  3. Starting salt-master daemon: [ OK ]
  4. [root@master ~]# mkdir /srv/salt -p
  5. [root@master ~]#

编写配置管理文件

  1. [root@master ~]# cd /srv/salt/
  2. [root@master salt]# ls
  3. [root@master salt]# vim apache.sls
 

apache.sls里面写了两大功能,第一大功能是安装包,第二打功能是运行服务,这里的apache.sls文件名不是固定的,可以随意写,但是为了便于阅读性,就写成这个了,sls这个扩展名是必须有的

pkg.installed pkg是模块,installed是方法

service.running service是模块,running是方法

下面的是参数,

enable:True表示开机自动启动

reload:True 表示可以重载

name和names 指定哪个或哪些对象(包名,服务名),如果你不写name的话,它会默认把id当成name

其中apache-install和apache-service都是id,可以随便取,但是必须唯一。

  1. apache-install:
  2. pkg.installed:
  3. - names:
  4. - httpd
  5. - httpd-devel
  6. apache-service:
  7. service.running:
  8. - name: httpd
  9. - enable: True
  10. - reload: True

保存,退出,执行此文件,在执行之前先查看minion端机器是否已经安装,服务是否设置了开机自动启动,以及服务当前状态

找minion01先查看下,安装了httpd,但是没安装httpd-devel,服务是没启动状态,同时也不是开机自启动

  1. [root@minion01 ~]# rpm -qa httpd
  2. httpd-2.2.15-39.el6.centos.x86_64
  3. [root@minion01 ~]# rpm -qa httpd-devel
  4. [root@minion01 ~]# chkconfig --list httpd
  5. httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
  6. [root@minion01 ~]# ps -ef | grep httpd
  7. root 10102 9931 0 15:03 pts/0 00:00:00 grep --colour=auto httpd
  8. [root@minion01 ~]#

我们执行下状态文件试试,注意执行语法如下apache就是那个apache.sls文件,执行的时候,需要省去sls

另外执行下面语句的时候,不必在/srv/salt目录下,无论在哪里执行,master都会去/srv/salt去找apache.sls文件来执行

  1. [root@master salt]# salt 'minion01' state.sls apache
  2. minion01:
  3. ----------
  4. ID: apache-install
  5. Function: pkg.installed
  6. Name: httpd
  7. Result: True
  8. Comment: Package httpd is already installed.
  9. Started: 15:05:57.576469
  10. Duration: 1009.635 ms
  11. Changes:
  12. ----------
  13. ID: apache-install
  14. Function: pkg.installed
  15. Name: httpd-devel
  16. Result: True
  17. Comment: The following packages were installed/updated: httpd-devel
  18. Started: 15:05:58.586254
  19. Duration: 59776.234 ms
  20. Changes:
  21. ----------
  22. apr-devel:
  23. ----------
  24. new:
  25. 1.3.9-5.el6_2
  26. old:
  27. apr-util-devel:
  28. ----------
  29. new:
  30. 1.3.9-3.el6_0.1
  31. old:
  32. cyrus-sasl:
  33. ----------
  34. new:
  35. 2.1.23-15.el6_6.2
  36. old:
  37. 2.1.23-15.el6
  38. cyrus-sasl-devel:
  39. ----------
  40. new:
  41. 2.1.23-15.el6_6.2
  42. old:
  43. cyrus-sasl-gssapi:
  44. ----------
  45. new:
  46. 2.1.23-15.el6_6.2
  47. old:
  48. 2.1.23-15.el6
  49. cyrus-sasl-lib:
  50. ----------
  51. new:
  52. 2.1.23-15.el6_6.2
  53. old:
  54. 2.1.23-15.el6
  55. cyrus-sasl-md5:
  56. ----------
  57. new:
  58. 2.1.23-15.el6_6.2
  59. old:
  60. 2.1.23-15.el6
  61. cyrus-sasl-plain:
  62. ----------
  63. new:
  64. 2.1.23-15.el6_6.2
  65. old:
  66. 2.1.23-15.el6
  67. expat:
  68. ----------
  69. new:
  70. 2.0.1-13.el6_8
  71. old:
  72. 2.0.1-11.el6_2
  73. expat-devel:
  74. ----------
  75. new:
  76. 2.0.1-13.el6_8
  77. old:
  78. httpd:
  79. ----------
  80. new:
  81. 2.2.15-55.el6.centos.2
  82. old:
  83. 2.2.15-39.el6.centos
  84. httpd-devel:
  85. ----------
  86. new:
  87. 2.2.15-55.el6.centos.2
  88. old:
  89. httpd-tools:
  90. ----------
  91. new:
  92. 2.2.15-55.el6.centos.2
  93. old:
  94. 2.2.15-39.el6.centos
  95. openldap:
  96. ----------
  97. new:
  98. 2.4.40-12.el6
  99. old:
  100. 2.4.39-8.el6
  101. openldap-devel:
  102. ----------
  103. new:
  104. 2.4.40-12.el6
  105. old:
  106. ----------
  107. ID: apache-service
  108. Function: service.running
  109. Name: httpd
  110. Result: True
  111. Comment: Service httpd has been enabled, and is running
  112. Started: 15:06:58.376744
  113. Duration: 166.666 ms
  114. Changes:
  115. ----------
  116. httpd:
  117. True
  118.  
  119. Summary
  120. ------------
  121. Succeeded: 3 (changed=2)
  122. Failed: 0
  123. ------------
  124. Total states run: 3
  125. [root@master salt]#

   

在上面执行过程中,可以看到minion01里有执行yum安装

  1. [root@minion01 ~]# ps -ef |grep yum
  2. root 10177 10110 4 15:06 ? 00:00:00 /usr/bin/python /usr/bin/yum --quiet check-update
  3. root 10189 9931 0 15:06 pts/0 00:00:00 grep --colour=auto yum
  4. [root@minion01 ~]#

  

检查结果,和我们配置文件里设定的都完成了

  1. [root@minion01 ~]# rpm -qa httpd
  2. httpd-2.2.15-55.el6.centos.2.x86_64
  3. [root@minion01 ~]# rpm -qa httpd-devel
  4. httpd-devel-2.2.15-55.el6.centos.2.x86_64
  5. [root@minion01 ~]# chkconfig --list httpd
  6. httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
  7. [root@minion01 ~]# ps -ef | grep httpd
  8. root 10289 1 0 15:06 ? 00:00:00 /usr/sbin/httpd
  9. apache 10300 10289 0 15:06 ? 00:00:00 /usr/sbin/httpd
  10. apache 10301 10289 0 15:06 ? 00:00:00 /usr/sbin/httpd
  11. apache 10302 10289 0 15:06 ? 00:00:00 /usr/sbin/httpd
  12. apache 10303 10289 0 15:06 ? 00:00:00 /usr/sbin/httpd
  13. apache 10304 10289 0 15:06 ? 00:00:00 /usr/sbin/httpd
  14. apache 10305 10289 0 15:06 ? 00:00:00 /usr/sbin/httpd
  15. apache 10306 10289 0 15:06 ? 00:00:00 /usr/sbin/httpd
  16. apache 10307 10289 0 15:06 ? 00:00:00 /usr/sbin/httpd
  17. root 10326 9931 0 15:09 pts/0 00:00:00 grep --colour=auto httpd
  18. [root@minion01 ~]#

关于上面的命令

  1. salt 'minion01' state.sls apache

state.sls  其中,state是模块,sls是方法  

配置管理也支持多次执行,就是apache服务已经安装了,再次执行此文件不会报错。

  

关于执行apache.sls,还有另外一种方式执行,通过top.sls文件执行,它也叫入口文件

在master机器上 vim /etc/salt/master  找到329行,看到它是状态管理的入口文件,默认是top.sls ,当然你也可以自定义这个名字。

这个文件必须放在/srv/salt/下面

  1. ##### State System settings #####
  2. ##########################################
  3. # The state system uses a "top" file to tell the minions what environment to
  4. # use and what modules to use. The state_top file is defined relative to the
  5. # root of the base environment as defined in "File Server settings" below.
  6. #state_top: top.sls

操作如下

注意'*'  代表所有的minion

  1. [root@master salt]# cd /srv/salt/
  2. [root@master salt]# vim top.sls
  3. [root@master salt]# cat top.sls
  4. base:
  5. '*':
  6. - apache
  7. [root@master salt]#

虽然上面写了'*'

但是你可以在执行命令的时候指定minion执行,这样其余没指定的minion不会执行此文件

执行命令如下,它会执行top.sls文件。你top.sls文件里又写了apache.sls文件。这样它就执行apache.sls文件了

  1. [root@master salt]# salt 'minion01' state.highstate

 以上学习了通过saltstack简单安装并配置apache服务,对于大批量机器管理非常有用

  

 配置管理结合grains

获取grains信息,看到minion02的主机名也就是它的fqdn名为minion02 

  1. [root@master salt]# salt '*' grains.get fqdn
  2. minion02:
  3. minion02
  4. minion01:
  5. minion01
  6. [root@master salt]#

修改top.sls文件,让匹配到grains的minion执行安装

看到minion01 没匹配到这个fqdn,只有minion02匹配到了,执行了

  1. [root@master salt]# cd /srv/salt/
  2. [root@master salt]# vim top.sls
  3. [root@master salt]# cat top.sls
  4. base:
  5. 'fqdn:minion02':
  6. - match: grain
  7. - apache
  8. [root@master salt]# salt '*' state.highstate
  9. minion01:
  10. ----------
  11. ID: states
  12. Function: no.None
  13. Result: False
  14. Comment: No Top file or external nodes data matches found.
  15. Started:
  16. Duration:
  17. Changes:
  18.  
  19. Summary
  20. ------------
  21. Succeeded: 0
  22. Failed: 1
  23. ------------
  24. Total states run: 1
  25. minion02:
  26. ----------
  27. ID: apache-install
  28. Function: pkg.installed
  29. Name: httpd
  30. Result: True
  31. Comment: Package httpd is already installed.
  32. Started: 15:48:28.024297
  33. Duration: 994.259 ms
  34. Changes:
  35. ----------
  36. ID: apache-install
  37. Function: pkg.installed
  38. Name: httpd-devel
  39. Result: True
  40. Comment: The following packages were installed/updated: httpd-devel
  41. Started: 15:48:29.018697
  42. Duration: 49304.666 ms
  43. Changes:
  44. ----------
  45. apr-devel:
  46. ----------
  47. new:
  48. 1.3.9-5.el6_2
  49. old:
  50. apr-util-devel:
  51. ----------
  52. new:
  53. 1.3.9-3.el6_0.1
  54. old:
  55. cyrus-sasl:
  56. ----------
  57. new:
  58. 2.1.23-15.el6_6.2
  59. old:
  60. 2.1.23-15.el6
  61. cyrus-sasl-devel:
  62. ----------
  63. new:
  64. 2.1.23-15.el6_6.2
  65. old:
  66. cyrus-sasl-gssapi:
  67. ----------
  68. new:
  69. 2.1.23-15.el6_6.2
  70. old:
  71. 2.1.23-15.el6
  72. cyrus-sasl-lib:
  73. ----------
  74. new:
  75. 2.1.23-15.el6_6.2
  76. old:
  77. 2.1.23-15.el6
  78. cyrus-sasl-md5:
  79. ----------
  80. new:
  81. 2.1.23-15.el6_6.2
  82. old:
  83. 2.1.23-15.el6
  84. cyrus-sasl-plain:
  85. ----------
  86. new:
  87. 2.1.23-15.el6_6.2
  88. old:
  89. 2.1.23-15.el6
  90. expat:
  91. ----------
  92. new:
  93. 2.0.1-13.el6_8
  94. old:
  95. 2.0.1-11.el6_2
  96. expat-devel:
  97. ----------
  98. new:
  99. 2.0.1-13.el6_8
  100. old:
  101. httpd:
  102. ----------
  103. new:
  104. 2.2.15-55.el6.centos.2
  105. old:
  106. 2.2.15-39.el6.centos
  107. httpd-devel:
  108. ----------
  109. new:
  110. 2.2.15-55.el6.centos.2
  111. old:
  112. httpd-tools:
  113. ----------
  114. new:
  115. 2.2.15-55.el6.centos.2
  116. old:
  117. 2.2.15-39.el6.centos
  118. openldap:
  119. ----------
  120. new:
  121. 2.4.40-12.el6
  122. old:
  123. 2.4.39-8.el6
  124. openldap-devel:
  125. ----------
  126. new:
  127. 2.4.40-12.el6
  128. old:
  129. ----------
  130. ID: apache-service
  131. Function: service.running
  132. Name: httpd
  133. Result: True
  134. Comment: Service httpd has been enabled, and is running
  135. Started: 15:49:18.337679
  136. Duration: 162.474 ms
  137. Changes:
  138. ----------
  139. httpd:
  140. True
  141.  
  142. Summary
  143. ------------
  144. Succeeded: 3 (changed=2)
  145. Failed: 0
  146. ------------
  147. Total states run: 3
  148. ERROR: Minions returned with non-zero exit code
  149. [root@master salt]#

  

saltstack实战3--配置管理之grains的更多相关文章

  1. SaltStack实战

    SaltStack实战 #安装 安装注意几点 python-libs-2.6.6-64.el6.x86_64 conflicts with file from package python-2.6.6 ...

  2. saltstack实战4--综合练习1

    规范配置管理 实际工作中可能会有现网环境,基线环境,开发环境. 需要使用saltstack统一管理.机器多了,业务多了,可能配置文件存放的会比较乱,因此可以统一管理起来 我们可以再加2个目录,test ...

  3. saltstack实战笔记

    #运维管理工具 ansible #支持ssh,不需要客户端 saltstack #也是只是ssh,不需要客户端的 安装架构是,master /minion 安装salt的依赖模块 python zer ...

  4. saltstack之(八)配置管理部署LAMP

    场景:公司有10台服务器需要安装lamp测试环境,使用saltstack编写state文件进行批量部署,可以提高工作效率,减少人为出错的可能性,保证环境的一致性. saltstack之配置管理lamp ...

  5. saltstack实战4--综合练习3

    Saltstack配置管理-业务引用haproxy 在业务模块里写它的配置 各个业务是不同的,这里有差异性,所以没写在配置模块里. 对minion02也执行安装haproxy [root@master ...

  6. saltstack之(九)配置管理源码部署Nginx

    场景:rpm包安装的nginx服务,无法满足定制模块的需求,故线上环境使用nginx源码进行安装.本片文章详细介绍如何使用saltstack的配置管理功能实现nginx软件的源码安装. 下载源码:pc ...

  7. saltstack之(六)配置管理state

    配置管理是saltstack工具最重要的模块之一,也是学习saltstack之后使用最多的一个功能.可以轻松实现上百台上千台甚至上万台服务器的管理工作. 1.使用state模块进行配置管理,编写sls ...

  8. saltstack实战4--综合练习4

    Saltstack配置管理-给minion增加Zabbix-agent zabbix-agent的包 [root@A ~]# rpm -qa |grep zabbix zabbix-2.4.8-1.e ...

  9. saltstack实战4--综合练习2

    Saltstack配置管理-功能模块-安装haproxy 配置管理,我们分了3层 最底层是系统初始化部分 倒数二层是功能模块,就是具体的产品的安装了 假如你的环境需要nginx,php,memcach ...

随机推荐

  1. Codeforces Round #260 (Div. 1) A. Boredom (简单dp)

    题目链接:http://codeforces.com/problemset/problem/455/A 给你n个数,要是其中取一个大小为x的数,那x+1和x-1都不能取了,问你最后取完最大的和是多少. ...

  2. POJ 1088 滑雪 (记忆化搜索)

    题目链接:http://poj.org/problem?id=1088 题意很好懂,就是让你求一个最长下降路线的长度. dp[i][j]记录的是i j这个位置的最优的长度,然后转移方程是dp[i][j ...

  3. Scala List的排序函数sortWith

    //原始方法: //val list=List("abc","bcd","cde") scala> list.sortWith( (s ...

  4. Django 使用原生SQL

    def dictfetchall(cursor): "将游标返回的结果保存到一个字典对象中" desc = cursor.description return [ dict(zip ...

  5. Jquery EasyUi实战教程布局篇

    转自:http://www.kwstu.com/ArticleView/kwstu_20139413501290 送给大家一个非常好的后台布局模板,本人后来就选择了这个模板http://www.kws ...

  6. 如何彻底隐藏iOS7应用的status bar

    用xcode5开发新的iOS游戏,发现一个坑爹的现象,虽然我已经在info.plist里面把Status bar is initially hidden设置成了YES,但在设备上一跑还是看到丑陋的st ...

  7. Thinkphp框架----微信公众测试号开发

    最开始的一个步骤.注册一个微信公众测试号.URL:https://mp.weixin.qq.com/debug/cgi-bin/sandbox?t=sandbox/login; 接口配置的信息,对新手 ...

  8. wiki1169-传纸条(dp)

    http://wikioi.com/problem/1169/ 四维数组和三维数组: #include<iostream> #include<cstdio> #include& ...

  9. too many automatic redirections were attempted

    用HttpClient时发现一下页面跳转现象. 页面A要求授权自动跳转到页面B, 页面B进行了授权,在HTTP Header里要求SetCookie并跳转到页面A. 再次请求页面A的时候没有带上此Co ...

  10. Hadoop on Mac with IntelliJ IDEA - 3 解决MRUnit - No applicable class implementing Serialization问题

    本文讲述在IntelliJ IDEA中使用MRUnit 1.0.0测试Mapper派生类时因MapDriver.withInput(final K1 key, final V1 val)的key参数被 ...