#salt ‘*‘ state.sls httpd
这个命令会先在目录/srv/salt下找httpd.sls(yml语法格式编写的)文件,若:有就安装文件内容执行,若没有的话就继续找/srv/salt/httpd目录下init.sls,找到了安装文件内容执行,没有的话就报错;
#salt ‘*‘ state.sls httpd.install
按照文件/srv/salt/httpd/install.sls文件内容执行,没有的话就报错;
[[email protected]_2 salt]# cat ./httpd/install.sls install_httpd: pkg: - installed - name: httpd service: - running - require: - pkg: httpd #/root/tt.txt: # file.managed: # - source: salt://file/tt.txt # - user: root # - group: root # - mode: 755
#salt ‘*‘ state.highstate
按照文件/srv/salt/top.sls 倒入的其他*.sls内容按顺序执行,没有的话就报错;
[[email protected]_2 ~]# cat /srv/salt/top.sls base: ‘*‘: - http #- httpd.install - users - files.ext-files-second ‘os:CentOS‘: - match: grain - centos - iptables ‘kernel:Linux‘: - match: grain - kernel
saltstack中stae用法
时间: 2024-11-09 04:01:50