【问题标题】:Cannot delete routing table in AWS using ansible无法使用 ansible 删除 AWS 中的路由表
【发布时间】:2017-02-17 00:10:33
【问题描述】:

在 AWS 中,我有一个 VPC 和一个路由表。我创建了最小的剧本来删除它,它看起来像这样:

---
- hosts: localhost
  connection: local

  tasks:
  - name: Delete routing table
    ec2_vpc_route_table:
      vpc_id: "vpc-db5a65bf"
      route_table_id: "rtb-bb61b7dc"
      region: "eu-west-1"
      state: absent

所有的 ID 都可以。这是运行 playbook 的结果:

15:21 $ ansible-playbook shutdown_rt.yml
[WARNING]: provided hosts list is empty, only localhost is available


PLAY [localhost] ***************************************************************

TASK [setup] *******************************************************************
ok: [localhost]

TASK [Delete routing table] ****************************************************
ok: [localhost]

PLAY RECAP *********************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=0

所以看起来路由表不存在(changed=0),并且没有被删除。正如在 AWS 控制台中检查的那样,它仍然存在。

我错过了一些模块参数吗?是不是什么bug?有什么解决方法吗?

【问题讨论】:

  • 谢谢,我会尝试使用标签,但文档说“当未提供 route_table_id 时,标签用于唯一标识 VPC 中的路由表。”在可用时通过 ID 识别路由表也更有意义,不是吗?不过,我会尝试使用标签。
  • lookup: id 帮助了。让它成为一个答案,这样我就可以投票了! :)

标签: amazon-web-services ansible ansible-2.x


【解决方案1】:

Based on the documentation of the module 默认情况下,它会按标签而不是 id 进行查找。由于您没有添加任何标签,它只是拒绝做任何事情。

添加 lookup: id 参数以确保模块通过 id 而不是标签进行搜索。

【讨论】:

    猜你喜欢
    • 2021-12-27
    • 2015-11-28
    • 1970-01-01
    • 2014-04-09
    • 1970-01-01
    • 2021-09-17
    • 2020-09-09
    • 1970-01-01
    • 2018-12-20
    相关资源
    最近更新 更多