amazon-web-services - Ansible ec2_vpc_route_table 剧本错误是:“dict object”没有属性子网
问题描述
我为以前的承包商继承了一个以前工作的 Ansible,我收到一条错误消息,它不会引导我朝着正确的方向前进。我已经尝试搜索了几天,没有任何乐趣,我的同事也无法弄清楚。
有问题的 Ansible 是:-
- 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
错误信息是:-
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\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Routes | Set up NAT-protected route table\n ^ here\n"}
我尝试为 az_to_private_sub 和 public_subnet_to_az 添加额外的调试,这些看起来不错。我试过阅读文档
谁能建议我接下来应该看哪里?
谢谢!
解决方案
After speaking to a different colleague, they pointed out that the version which works uses Ansible 2.5.5 and I was trying with 2.5.1 also the boto python libraries need to be using the correct version.
推荐阅读
- sql - 将“分组依据”查询中的值插入另一个表
- javascript - 从设计器视图调用文本的函数和存储值完成
- assembly - 为什么6502微控制器没有算术右移?
- ruby-on-rails - Rails 5 - 2 个具有相同名称的类及其调用错误的类
- amazon-web-services - 如何从cloudwatch查看日志流属于哪个ECS服务或任务?
- python - 无法为 Zipline 安装 Python 3.5 文件
- python - 来自excel报告的Python dict
- angular - Angular 的文档管理系统
- html - 在NodeJS中获取玉选择框值
- git - 如何为 VSTS 添加 GIT 子模块以用于 Visual Studio 2017