【问题标题】:Ansible Playbook Syntax IssueAnsible Playbook 语法问题
【发布时间】:2018-02-07 06:52:51
【问题描述】:

我在设置 AWS VPC 时遇到了 ansible playbook 的问题。

这是导致问题的 YML 文件的 sn-p

Outputs:
  TemplateID:
    Description: cloudonaut.io template id
    Value: vpc/vpc-2azs
  StackName:
    Description: Stack name
    Value: !Sub '${AWS::StackName}'

最后一行是引发语法错误的地方。错误是

 [WARNING]: Host file not found: /etc/ansible/hosts

 [WARNING]: provided hosts list is empty, only localhost is available

ERROR! Syntax Error while loading YAML.


The error appears to have been in '/vagrant/Devel/chalktalk-config/chalktalk-config/cloudformation/vpc2az.yaml': line 233, column 13, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

    Description: Stack name
    Value:  !Sub '${AWS::StackName}'
            ^ here

【问题讨论】:

    标签: ansible syntax-error amazon-vpc


    【解决方案1】:

    您遇到了 YAML 标记语法。请参阅What does a single exclamation mark do in YAML? 了解更多信息。

    快速的答案是将Value 变量用双引号括起来。

    Value:  "!Sub '${AWS::StackName}'"
    

    【讨论】:

    • 请在YAML中添加关于!的解释
    猜你喜欢
    • 1970-01-01
    • 2020-12-04
    • 1970-01-01
    • 2019-11-21
    • 2021-09-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多