Amazon web services 访问ansible中的寄存器变量值时出错

Amazon web services 访问ansible中的寄存器变量值时出错,amazon-web-services,ansible,Amazon Web Services,Ansible,我试图在另一个任务中访问寄存器变量值,但我遇到了一个错误,甚至知道我可能犯了一个错误,但无法解决。我将感谢您的帮助。 我的密码是: hosts: localhost connection: local gather_facts: false tasks: - ec2_vpc_net: name: Module_dev2 cidr_block: 10.10.0.0/16 region: us-east-1 tags

我试图在另一个任务中访问寄存器变量值,但我遇到了一个错误,甚至知道我可能犯了一个错误,但无法解决。我将感谢您的帮助。 我的密码是:

hosts: localhost
  connection: local
  gather_facts: false
  tasks:
    - ec2_vpc_net:
        name: Module_dev2
        cidr_block: 10.10.0.0/16
        region: us-east-1
        tags:
          module: ec2_vpc_net
          this: works
        tenancy: default
      register: vpc_v

    - name: show the VPC info
      debug: 
        var: vpc_v

    - ec2_vpc_igw:
        vpc_id: "{{ vpc_v.stdout.id }}"
        state: present
      register: igw
我得到的错误是

TASK [ec2_vpc_igw] ***************************************************************************************************************************
task path: /home/kamaljit/Desktop/v3/playbooks/vpc_cr.yaml:20
fatal: [localhost]: FAILED! => {
    "msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'id'\n\nThe error appears to be in '/home/kamaljit/Desktop/v3/playbooks/vpc_cr.yaml': line 20, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n    - ec2_vpc_igw:\n      ^ here\n"
}
密码正确吗

我想,寄存器变量可以通过变量\ name.module.attribute来实现。谢谢

---
- hosts: localhost
  connection: local
  gather_facts: false
  tasks:
    - ec2_vpc_net:
        name: Module_dev2
        cidr_block: 10.10.0.0/16
        region: us-east-1
        tags:
          module: ec2_vpc_net
          this: works
        tenancy: default
      register: vpc_v

    - name: show the VPC info
      debug: 
        var: vpc_v

    - ec2_vpc_igw:
        vpc_id: "{{ vpc_v.vpc.id }}"
        state: present
        region: us-east-1
      register: igw