问题环境:
我已经用salt-master 配置好了salt-minion:172.25.17.5 的nginx 宾伽服务已经启动,现在在salt-master 执行:
ERROR:
[root@server1 salt]# salt server5 state.highstate
server5:
----------
ID: states
Function: no.None
Result: False
Comment: No Top file or master_tops data matches found.
Changes:
Summary for server5
------------
Succeeded: 0
Failed: 1
------------
Total states run: 1
Total run time: 0.000 ms
ERROR: Minions returned with non-zero exit code
解决;
修改/srv/salt/top.sls
[root@server1 salt]# cat top.sls
base:
'server2':
- httpd.service
'server5':
- nginx.service
此时重新推进:
[root@server1 salt]# salt '*' state.highstate
server2:
----------
ID: install-httpd
Function: pkg.installed
Result: True
Comment: All specified packages are already installed
Started: 08:10:14.587003
Duration: 1071.229 ms
Changes:
----------
ID: /etc/httpd/conf/httpd.conf
Function: file.managed
Result: True
Comment: File /etc/httpd/conf/httpd.conf is in the correct state
Started: 08:10:15.662873
Duration: 45.82 ms
Changes:
----------
ID: httpd-service
Function: service.running
Name: httpd
Result: True
Comment: The service httpd is already running
Started: 08:10:15.711142
Duration: 64.609 ms
Changes:
Summary for server2
------------
Succeeded: 3
Failed: 0
------------
Total states run: 3
Total run time: 1.182 s
server5:
----------
ID: nginx-install
Function: pkg.installed
Result: True
Comment: All specified packages are already installed
Started: 08:10:14.760569
Duration: 1059.632 ms
Changes:
----------
ID: nginx-install
Function: file.managed
Name: /mnt/nginx-1.15.7.tar.gz
Result: True
Comment: File /mnt/nginx-1.15.7.tar.gz is in the correct state
Started: 08:10:15.825096
Duration: 84.16 ms
Changes:
----------
ID: nginx-install
Function: cmd.run
Name: cd /mnt && tar zxf nginx-1.15.7.tar.gz && cd nginx-1.15.7 && sed -i 's/CFLAGS="$CFLAGS -g"/#CFLAGS="$CFLAGS -g"/g' auto/cc/gcc && ./configure --prefix=/usr/local/nginx && make && make install && cd .. && rm -fr nginx-1.15.7
Result: True
Comment: /usr/local/nginx exists
Started: 08:10:15.912183
Duration: 1.319 ms
Changes:
----------
ID: nginx
Function: user.present
Result: True
Comment: User nginx is present and up to date
Started: 08:10:15.914960
Duration: 2.706 ms
Changes:
----------
ID: /usr/local/nginx/conf/nginx.conf
Function: file.managed
Result: True
Comment: File /usr/local/nginx/conf/nginx.conf is in the correct state
Started: 08:10:15.918005
Duration: 29.772 ms
Changes:
----------
ID: nginx-service
Function: file.managed
Name: /etc/systemd/system/nginx.service
Result: True
Comment: File /etc/systemd/system/nginx.service is in the correct state
Started: 08:10:15.948519
Duration: 32.801 ms
Changes:
----------
ID: nginx-service
Function: service.running
Name: nginx
Result: True
Comment: The service nginx is already running
Started: 08:10:15.984769
Duration: 58.095 ms
Changes:
Summary for server5
------------
Succeeded: 7
Failed: 0
------------
Total states run: 7
Total run time: 1.268 s
ERROR: Minions returned with non-zero exit code