I have a previously working piece of Ansible that I've inherited for a previous contractor, and I'm getting an error message that doesn't lead me in the right direction. I have tried searching for a few days now, with no joy, and my colleagues can't figure it out either.
The Ansible in question is :-
- name: Routes | Set up NAT-protected route table
ec2_vpc_route_table:
vpc_id: "{{ ec2_vpc_net_reg.vpc.id }}"
region: "{{ vpc_region }}"
tags:
Name: "Internal {{ item.subnet_id }}"
subnets:
- "{{ az_to_private_sub[public_subnets_to_az[item.subnet_id]] }}"
- "{{ az_to_private_data_sub[public_subnets_to_az[item.subnet_id]] }}"
routes:
- dest: 0.0.0.0/0
gateway_id: "{{ item.nat_gateway_id }}"
loop: "{{ existing_nat_gateways.result|flatten(levels=1) }}"
#with_items: "{{ existing_nat_gateways.result }}"
register: nat_route_table
retry: 2
delay: 10
And the error message is :-
fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute u'subnet-0facefaceface9'\n\nThe error appears to have been in '/cup/core-kubernetes-linux/ansible/roles/aws_vpc/tasks/routes.yml': line 62, column 3, but may\n
be elsewhere in the file depending on the exact syntax problem.\n\n
The offending line appears to be:\n\n\n
- name: Routes | Set up NAT-protected route table\n
^ here\n
"}
I have added some carriage returns to make it a bit more readable.
I have tried adding extra debug, for az_to_private_sub and public_subnet_to_az, and these look OK. I've tried reading the docs
Can anyone suggest where I should look next?
Thanks!
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/e1bd8cda-ae5a-4a3b-bcf3-13293d72c5b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Use debug statements so that you know what is in "existing_nat_gateways.result" and "public_subnets_to_az".It looks to me as if there is no element called "subnet-0facefaceface9" in the dictionary "public_subnets_to_az" (that is a very cool subnet ID by the way).Regards, K.
On Tue, Jan 22, 2019 at 10:51 PM Steve Button <steve....@gmail.com> wrote:
And the error message is :-
The error appears to have been in '/cup/core-kubernetes-linux/ansible/roles/aws_vpc/tasks/routes.yml': line 62, column 3, but may\n