尝试在AWS中收集实例的VPC子网事实显示错误

时间:2017-08-18 11:07:25

标签: ansible

fatal: [ubuntu@xx.xx.xx.xx]: FAILED! => {
    "changed": false, 
    "failed": true, 
    "invocation": {
        "module_args": {
            "aws_access_key": null, 
            "aws_secret_key": null, 
            "ec2_url": null, 
            "filters": {
                "region": "us-east-1", 
                "vpc-id": "xxxxxxxxx"
            }, 
            "profile": null, 
            "region": null, 
            "security_token": null, 
            "validate_certs": true
        }
    }, 
    "msg": "region must be specified"
}

当我尝试从AWS中的特定实例收集有关VPC子网事实的详细信息时,我会在很长一段时间内收到上述错误。如果我做错了什么,有人可以帮忙吗?我已经完成了相同的ansible文档,并基于YML创建的知识。

我的YML文件如下:

---
 - name: find vpc facts
   hosts: webservers
   gather_facts: True
   tasks:
    - name: vpc subnet facts
      ec2_vpc_subnet_facts:
       filters:
         region: us-east-1
         vpc-id: xxxxxxxx
      register: subnet_facts

1 个答案:

答案 0 :(得分:0)

  必须指定

区域

调用ec2模块时,应将region指定为模块参数:

- name: vpc subnet facts
  ec2_vpc_subnet_facts:
    region: us-east-1
    filters:
      vpc-id: xxxxxxxx
  register: subnet_facts