Hi All,
I am trying to re-create the AWS Core infrastructure using ansible in another region. I am getting the following error
The task includes an option with an undefined variable. The error was: ‘dict object’ has no attribute ‘vpc_endpoints’\n\nThe error appears to be in ‘/home/ec2-user/environment/aws-rxgt-b2b-platform/ansible/rxgt-ps-rxgtb2b-playbook.yaml’: line 646, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: create rxgt-ps-b2b-app-vpc-endpoints changeset\n ^ here\n"}
I tried to debug this by creating a debug statement before this task and it prints out everything. But running this task gives the above error message.
Could someone please help me identify the problem?
Thanks
Kishore
Can you provide snapshot of what your task looks like?
From your mail , I can see vpc_endpoints is referenced from stack_output_result.
SecurityGroupIds: “{{ stack_output_result.net_stack_output_result.account_config.0.account_config.vpcs[stack_output_result.net_stack_output_result.account_config.1].app.vpc_endpoints.security_group_ids|join(‘,’) }}”
And the error you have pinged in the first mail is…
The task includes an option with an undefined variable. The error was: ‘dict object’ has no attribute ‘vpc_endpoints’\n\nThe error appears to be in ‘/home/ec2-user/environment/aws-rxgt-b2b-platform/ansible/rxgt-ps-rxgtb2b-playbook.yaml’: line 646, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: create rxgt-ps-b2b-app-vpc-endpoints changeset\n ^ here\n"}
So, I would suggest you to add a Debug task prior to this one and print the variable stack_output_result and go through it to find whether the dict stack_output_result is having vpc_endpoints or not.
Hi,
Thanks for coming back. Yes, I added the debug task before this task and it is printing correctly.
Now I managed to fix this issue by supplying the endpoint SG on the config file which has the endpoints which is what it is expecting.
Thanks again.