Salt无法再解析文件:必需的声明...不会形成单个关键字典

时间:2017-07-18 08:11:02

标签: salt-stack

大约两个月的 sls 文件不再有效。我试着把最小的例子放在下面:

salt 'myserver.internal' state.highstate 给了:

myserver.internal:
    Data failed to compile:
----------
    Requisite declaration dhparam in SLS nginx is not formed as a single key dictionary

----------
    Requisite declaration /etc/nginx/sites-available/myapp.conf in SLS nginx is not formed as a single key dictionary
ERROR: Minions returned with non-zero exit code

使用以下nginx.sls

/etc/nginx/sites-available/myapp.conf:
  file.managed:
    - name: /etc/nginx/sites-available/myapp.conf
    - source: salt://nginx-myapp.conf.jinja
    - template: jinja
    - require:
      - dhparam

dhparam:
  cmd:
    - run
    - name: "mkdir -p /etc/nginx/ssl/; openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048"
    - unless: ls /etc/nginx/ssl/dhparam.pem

当我运行整个配置时,有几十个错误。我错过了什么吗?也许,一些关键的依赖没有安装/更新/破坏? yamllint在我的SLS文件中没有发现任何问题。两个月前,同一文件在另一台服务器上运行良好。

版本:

salt-master 2016.11.6 + ds-1

salt-minion 2015.8.8 + ds-1

主人和奴才的系统都是Ubuntu Xenial 16.04.2 LTS

1 个答案:

答案 0 :(得分:1)

问题是小兵的版本。虽然我为saltstack添加了repo密钥,但我忘了添加

deb http://repo.saltstack.com/apt/ubuntu/16.04/amd64/latest xenial main 

/etc/apt/sources.list.d/saltstack.list并在安装salt-minion之前运行apt update

当我更正时,文件再次开始工作。