ansible语法错误 - yaml - ansible-galaxy角色

时间:2018-05-12 11:26:27

标签: ansible yaml

我正在尝试使用ansible-galaxy中的jdauphant.ssl-certs角色。 我正在从他们的README(页面底部的最后一个示例)中复制示例,但是我收到了语法错误消息。

这是我的playbook.yml文件:

---
- name: Web01
  hosts: all
  become: yes

  gather_facts: true

  roles:
    - common
    - jdauphant.ssl-certs
      ssl_certs_generate_dh_param: true
    - role: jdauphant.nginx
      nginx_configs:
        ssl:
              - ssl_certificate_key {{ssl_certs_privkey_path}}
              - ssl_certificate     {{ssl_certs_cert_path}}
              - ssl_dhparam         {{ssl_certs_dhparam_path}}
      nginx_sites:
        default:
              - listen 443 ssl
              - server_name _
              - root "/usr/share/nginx/html"
              - index index.html

以下是我收到的错误消息:

ERROR! Syntax Error while loading YAML.
  mapping values are not allowed in this context

The error appears to have been in '/home/blah/example/provisioning/development.yml': line 11, column 34, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

    - jdauphant.ssl-certs
      ssl_certs_generate_dh_param: true
                                 ^ here

Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.

任何帮助将不胜感激!

1 个答案:

答案 0 :(得分:2)

例子说:

- hosts: all
  roles:
   - role: jdauphant.ssl-certs
     ssl_certs_common_name: "example.com"

您的代码:

    - jdauphant.ssl-certs
      ssl_certs_generate_dh_param: true

role:

之前您遗失了jdauphant.ssl-certs