码迷,mamicode.com
首页 > 其他好文 > 详细

salt sls 状态管理批量管理文件包|服务

时间:2015-03-19 06:31:52      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:already

 

[root@Mail-Verify-01 salt]# cat top.sls
base:
  ‘*‘:
    - servers

 

 

 

 

[root@Mail-Verify-01 f_source]# salt ‘CMM-182.91‘ state.highstate
CMM-182.91:
----------
          ID: apache
    Function: pkg.installed
        Name: httpd
      Result: True
     Comment: Package httpd is already installed.
     Started: 00:06:06.450717
    Duration: 2382.883 ms
     Changes:  
----------
          ID: /etc/httpd/conf/httpd.conf
    Function: file.managed
      Result: True
     Comment: File /etc/httpd/conf/httpd.conf updated
     Started: 00:06:08.834416
    Duration: 22.11 ms
     Changes:  
              ----------
              diff:
                  --- 
                  +++ 
                  @@ -1,4 +1,4 @@
                  -#
                  +##
                   # This is the main Apache server configuration file.  It contains the
                   # configuration directives that give the server its instructions.
                   # See <URL:http://httpd.apache.org/docs/2.2/> for detailed information.
                 
----------
          ID: apache
    Function: service.running
        Name: httpd
      Result: True
     Comment: Service reloaded
     Started: 00:06:08.942839
    Duration: 206.958 ms
     Changes:  
              ----------
              httpd:
                  True

Summary
------------
Succeeded: 3 (changed=2)
Failed:    0
------------
Total states run:     3
[root@Mail-Verify-01 f_source]# ll
总计 36
-rw-r--r-- 1 root root 33727 03-19 00:05 httpd.conf
[root@Mail-Verify-01 f_source]# cd ..
[root@Mail-Verify-01 salt]# ll
总计 16
drwxr-xr-x 2 root root 4096 03-19 00:05 f_source
drwxr-xr-x 2 root root 4096 03-18 23:05 _modules
-rw-r--r-- 1 root root  323 03-19 00:04 servers.sls
-rw-r--r-- 1 root root   27 03-16 13:39 top.sls
[root@Mail-Verify-01 salt]# cat servers.sls
apache:
  pkg:
   - installed
   - name: httpd
  service:
    - name: httpd
    - running
    - reload: True
    - watch:
       - file: /etc/httpd/conf/httpd.conf

 

/etc/httpd/conf/httpd.conf:
  file.managed:
    - source: salt://f_source/httpd.conf
    - user: root
    - group: root
    - mode: 644
    - backup: minion

本文出自 “歪歪男生乖乖心” 博客,请务必保留此出处http://iamxiao.blog.51cto.com/6530374/1622057

salt sls 状态管理批量管理文件包|服务

标签:already

原文地址:http://iamxiao.blog.51cto.com/6530374/1622057

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!