1

I am having an issue with ansible playbook that I am using to setup my AWS VPC.

Here is the snippet of YML file that is causing the issue

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

The last line is where the syntax error is being raised. The error is

 [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
nael
  • 1,441
  • 19
  • 36

1 Answers1

3

You're running into YAML tag syntax. See What does a single exclamation mark do in YAML? for more info.

The quick answer is to wrap the Value variable with double quotes.

Value:  "!Sub '${AWS::StackName}'"
kfreezy
  • 1,499
  • 12
  • 16