将状态文件应用于盐上的爪牙时遇到问题,它们只是基本的测试对象,没什么复杂的。
在主配置文件中,我具有以下文件根定义:
file_roots:
base:
- /srv/salt/
我的/srv/salt/top.sls文件如下:
base:
'*':
- vim
然后在/srv/salt/vim/init.sls中,我具有以下内容:
vim:
pkg.installed
因此,应在应用时将其应用于所有仆从,所以我运行以下命令:
sudo salt '*' state.apply
我得到以下输出,但没有应用,因为它似乎没有检测到top.sls文件?
salt-master-1:
----------
ID: states
Function: no.None
Result: False
Comment: No Top file or master_tops data matches found.
Changes:
Summary for salt-master-1
------------
Succeeded: 0
Failed: 1
------------
Total states run: 1
Total run time: 0.000 ms
dev-docker-1:
----------
ID: states
Function: no.None
Result: False
Comment: No Top file or master_tops data matches found.
Changes:
Summary for dev-docker-1
------------
Succeeded: 0
Failed: 1
------------
Total states run: 1
Total run time: 0.000 ms
ERROR: Minions returned with non-zero exit code
如果我查看小仆的日志,则dev-docker-1不会记录任何错误,这就是我所看到的。
2018-11-08 18:33:12,993 [salt.minion :1429][INFO ][4883] User sudo_salt Executing command state.apply with jid 20181108183312990343
2018-11-08 18:33:13,015 [salt.minion :1564][INFO ][5438] Starting a new job with PID 5438
2018-11-08 18:33:13,331 [salt.state :933 ][INFO ][5438] Loading fresh modules for state activity
2018-11-08 18:33:13,448 [salt.minion :1863][INFO ][5438] Returning information for job: 20181108183312990343
任何帮助我都感激不尽,因为我对为什么它不起作用有些迷惑。 。 。
编辑1
我在小黄人上启用了详细日志记录,我看到了以下内容,似乎看不到top.sls文件
[DEBUG ] Could not find file 'salt://top.sls' in saltenv 'base'
[DEBUG ] No contents loaded for saltenv 'base'
[DEBUG ] No contents found in top file. If this is not expected, verify that the 'file_roots' specified in 'etc/master' are accessible. The 'file_roots' configuration is: {u'base': []}
答案 0 :(得分:0)
好,所以我解决了这个问题,操作错误。
我已在配置文件中启用了gitfs后端,该文件已覆盖默认的基本文件系统,因此我只需要这样做。
fileserver_backend:
- gitfs
- base
Do!