gpt4 book ai didi

ansible - Ansible Playbook语法问题

转载 作者:行者123 更新时间:2023-12-03 08:20:42 28 4
gpt4 key购买 nike

我用于设置AWS VPC的ansible剧本出现问题。

这是导致问题的YML文件的片段

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

最佳答案

您正在遇到YAML标记语法。有关更多信息,请参见What does a single exclamation mark do in YAML?

快速的答案是用双引号包裹Value变量。

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

关于ansible - Ansible Playbook语法问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45945483/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com