ERROR: subnets is not a legal parameter in an Ansible task or handler
ERROR: subnets is not a legal parameter in an Ansible task or handler
我是 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
不知道其他的参数会不会没问题,这里主要的问题是缩进。 subnet 等是 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: vpc
我是 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
不知道其他的参数会不会没问题,这里主要的问题是缩进。 subnet 等是 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: vpc