Tampa
Tampa

Reputation: 78254

Salt stack - error parsing configuration file: /etc/salt/master

I am trying to learn Salt. Proving to be cumbersome. Can't even get around master config. What is wrong with the below line?

#/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

Upvotes: 0

Views: 6438

Answers (2)

nmadhok
nmadhok

Reputation: 1784

Here's the problem:

In YAML, spacing and indentation is really important. You should have two spaces for each level. While you have 2 spaces for base:, you should have 4 spaces before

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

Here's the correct one:

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

Upvotes: 2

Utah_Dave
Utah_Dave

Reputation: 4581

Without seeing more of the relevant section of your /etc/salt/master it's difficult to give you the exact answer to your problem, but you're seeing a malformed yaml error. Your file_roots section should look similar to this:

file_roots:
  base:
    - /srv/salt

There's more info here: http://docs.saltstack.com/en/latest/ref/file_server/file_roots.html#directory-overlay

Also, it's possible that there's an error above the yaml you're displaying. If you'll post more of your config (sanitized of course) we can better help you.

Upvotes: 1

Related Questions