· 在master上面配置
· [root@node01 salt]# vim /etc/salt/master
· 打开注释
file_roots:
base:
- /srv/salt/
创建目录
[root@node01 salt]# mkdir /srv/salt
[root@node01 salt]# cd /srv/salt
[root@node01 salt]# vim top.sls
base:
'*':
- apache
[root@node01 salt]# vim apache.sls
apache-service:
pkg.installed:
- names:
- httpd
- httpd-devel
service.running:
- name: httpd
- enable: True
· 执行命令
salt 'node02' state.highstate
node02:
----------
ID: apache-service
Function: pkg.installed
Name: httpd
Result: True
Comment: Package httpd is already installed.
Started: 06:54:53.098683
Duration: 578.804 ms
Changes:
----------
ID: apache-service
Function: pkg.installed
Name: httpd-devel
Result: True
Comment: Package httpd-devel is already installed.
Started: 06:54:53.677770
Duration: 0.805 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: 06:54:53.679299
Duration: 46.398 ms
Changes:
Summary
------------
Succeeded: 3
Failed: 0
------------
Total states run: 3