盐栈 - 解析配置文件时出错:/ etc / salt / master

时间:2014-04-18 09:58:08

标签: salt-stack

我正在努力学习盐。证明是繁琐的。甚至无法绕过主配置。下面这行出了什么问题?

#/etc/salt/master
file_roots:
   base:
      - /home/ubuntu/workspace/salt/states/base

salt-key -L
[ERROR   ] Error parsing configuration file: /etc/salt/master - expected '<document start>', but found '<block mapping start>'
  in "<string>", line 298, column 1:
    file_roots:
    ^




#####      File Server settings      #####
##########################################
# Salt runs a lightweight file server written in zeromq to deliver files to
# minions. This file server is built into the master daemon and does not
# require a dedicated port.

# The file server works on environments passed to the master, each environment
# can have multiple root directories, the subdirectories in the multiple file
# roots cannot match, otherwise the downloaded files will not be able to be
# reliably ensured. A base environment is required to house the top file.
# Example:
file_roots:
  base:
   - /home/ubuntu/workspace/salt/states/base
#    development:
#     - /home/ubuntu/workspace/salt/states/dev
#   dev:
#     - /srv/salt/dev/services
#     - /srv/salt/dev/states
#   prod:
#     - /srv/salt/prod/services
#     - /srv/salt/prod/states

#file_roots:
#  base:
#    - /srv/salt

2 个答案:

答案 0 :(得分:2)

问题在于:

在YAML中,间距和缩进非常重要。每个级别应该有两个空格。虽然base:有2个空格,但在

之前应该有4个空格

- /home/ubuntu/workspace/salt/states/base

这是正确的:

file_roots:
  base:
    - /home/ubuntu/workspace/salt/states/base

答案 1 :(得分:1)

如果没有看到/ etc / salt / master的更多相关部分,很难为您提供问题的准确答案,但是您会看到格式错误的yaml错误。您的file_roots部分应该类似于:

file_roots:
  base:
    - /srv/salt

这里有更多信息: http://docs.saltstack.com/en/latest/ref/file_server/file_roots.html#directory-overlay

此外,您可能会显示超出您正在显示的yaml的错误。 如果您发布更多配置(当然已经过消毒),我们可以更好地为您提供帮助。