Saltstack匹配Minion ID的多种方法
# vim /srv/salt/top.slsbase:
'web:nginx':
- match: grain
- apache
# salt '*' state.highstate linux-node2.example.com:
----------
ID: states
Function: no.None
Result: False
Comment: No Top file or external nodes data matches found
Started:
Duration:
Changes:
Summary
------------
Succeeded: 0
Failed: 1
------------
Total states run: 1
linux-node1.example.com:
----------
ID: apache-install
Function: pkg.installed
Name: httpd
Result: True
Comment: Package httpd is already installed.
Started: 19:59:18.844017
Duration: 2694.508 ms
Changes:
----------
ID: apache-install
Function: pkg.installed
Name: httpd-devel
Result: True
Comment: Package httpd-devel is already installed.
Started: 19:59:21.539596
Duration: 2.807 ms
Changes:
----------
ID: apache-service
Function: service.running
Name: httpd
Result: True
Comment: Service httpd is already enabled, and is in the desired state
Started: 19:59:21.545357
Duration: 122.63 ms
Changes:
Summary
------------
Succeeded: 3
Failed: 0
------------
Total states run: 3
# cat /srv/salt/apache.sls
apache-install:
pkg.installed:
- names:
- httpd
- httpd-devel
apache-service:
service.running:
- name: httpd
- enable: True
- reload: True
页:
[1]