salt sls 狀態管理批量管理文件包|服務

 

[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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章