yum安裝salt
yum -y install epel-release 主: yum install -y salt-master salt-minion 奴才: yum install -y salt-minion chkconfig salt-master on chkconfig salt-minion on vim /etc/salt/minion master: 192.168.106.133(主的ip) service salt-master start service salt-minion start 主: salt-key -a 192* 測試: [[email protected]
使用:
vim /etc/salt/master file_roots: base: - /srv/salt mkdir -p /srv/salt service salt-master restart vim /srv/salt/apache.sls apache-install: pkg.installed: - names: - httpd - httpd-devel apache-service: service.running: - name: httpd - enable: True - reload: True salt ‘*‘ state.sls apache 192.168.106.134: ---------- ID: apache-install Function: pkg.installed Name: httpd Result: True Comment: Package httpd is already installed. Started: 18:00:36.804167 Duration: 544.478 ms Changes: ---------- ID: apache-install Function: pkg.installed Name: httpd-devel Result: True Comment: Package httpd-devel is already installed. Started: 18:00:37.348794 Duration: 0.355 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: 18:00:37.349596 Duration: 151.231 ms Changes: Summary ------------ Succeeded: 3 Failed: 0 ------------ Total states run: 3 192.168.106.133: ---------- ID: apache-install Function: pkg.installed Name: httpd Result: True Comment: Package httpd is already installed. Started: 18:00:36.811434 Duration: 552.655 ms Changes: ---------- ID: apache-install Function: pkg.installed Name: httpd-devel Result: True Comment: Package httpd-devel is already installed. Started: 18:00:37.364243 Duration: 0.372 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: 18:00:37.365119 Duration: 151.479 ms Changes: Summary ------------ Succeeded: 3 Failed: 0 ------------ Total states run: 3 [[email protected]