需要在master端操作
=========================
1.vim /etc/salt/master
file_roots:
base:
- /srv/salt
==========================
2.mkdir /srv/salt/
==========================
3.vim /srv/salt/aaa.sls
aaa-service:
pkg.installed:
- names:
- httpd
service.running:
- name: httpd
- enable: True
==========================
4.vim /srv/salt/top.sls
base:
'*':
- aaa
===========================================
有top.sls执行状态文件
salt '*' state.highstate
salt "*" cmd.run "systemctl is-active httpd"
salt "*" cmd.run "ps aux|grep httpd"
===========================================
无top.sls执行状态文件
1.cd /stv/salt
2.vim ftp.sls
ftp-test:
pkg.installed:
- name: vsftpd
service.running:
- name: vsftpd
- enable: True
3.salt '*' state.sls ftp