我是新来的Ansible,希望能为我的剧本提供一些帮助。我想在AWS中创建一个带有2个子网的VPC。下面是我遇到的错误:
[root@aws]# ansible-playbook --syntax-check vpc_pub_pri.yml
playbook: vpc_pub_pri.yml
ERROR: subnets is not a legal parameter in an Ansible task or handler任何帮助都是伟大的~干杯~
---
- name: Provision a VPC with public/private subnets and an IGW
hosts: local
connection: local
tasks:
- name: Create 2 subnets
module: ec2_vpc
region: us-west-2
cidr_block: 192.168.0.0/23
resource_tags: { "Name":"vpc" }
subnets:
- cidr: 192.168.0.0/24
az: us-west-2a
resource_tags: { "Name":"public" }
- cidr: 192.168.1.0/24
az: us-west-2c
resource_tags: { "Name":"private" }
internet_gateway: True
route_tables:
- subnets:
- 192.168.0.0/24
- 192.168.1.0/24
routes:
- dest: 0.0.0.0/0
gw: igw
register: vpc发布于 2015-10-22 13:59:58
我不知道其他参数是否正常,但这里的主要问题是缩进。子网等是ec2_vpc模块的参数。此外,我从来没有见过module:符号,可能是好的或不。但这应该是可行的:
---
- name: Provision a VPC with public/private subnets and an IGW
hosts: local
connection: local
tasks:
- name: Create 2 subnets
ec2_vpc:
region: us-west-2
cidr_block: 192.168.0.0/23
resource_tags: { "Name":"vpc" }
subnets:
- cidr: 192.168.0.0/24
az: us-west-2a
resource_tags: { "Name":"public" }
- cidr: 192.168.1.0/24
az: us-west-2c
resource_tags: { "Name":"private" }
internet_gateway: True
route_tables:
- subnets:
- 192.168.0.0/24
- 192.168.1.0/24
routes:
- dest: 0.0.0.0/0
gw: igw
register: vpchttps://stackoverflow.com/questions/33282590
复制相似问题