【问题标题】:default subnets error for Elasticache creation using Ansible使用 Ansible 创建 Elasticache 的默认子网错误
【发布时间】:2026-01-08 12:35:02
【问题描述】:

我正在尝试使用 Ansible 创建一个弹性缓存集群。我的 VPC 中已经创建了一个默认子网组。执行以下脚本后,我收到默认子网组不存在的错误。

- name: Creating Elastic Cache Queue
  local_action:
    module: elasticache
    region: us-east-1
    name: devcachecluster
    state: present
    engine: redis
    cache_engine_version: 2.8.6
    node_type: cache.m1.small
    num_nodes: 1
    cache_port: 6379
    cache_security_groups: []
    wait: yes
  register: dev_cachecluster

我收到以下错误。我已经尝试按照网络上的所有示例进行操作。

任务:[创建弹性缓存队列] *************************************** *** 失败:[localhost -> 127.0.0.1] => {“失败”:真} msg:该帐户没有任何默认子网。

致命:所有主机都已失败 -- 正在中止

我已按照 Ansible 文档进行了一些研究,但仍然无法找出问题所在。有人可以指出我错过的错误吗? .

【问题讨论】:

  • 看不到任何错误。但也看不到任何可以识别模块的 VPC 或子网组的参数。

标签: amazon-web-services boto ansible ansible-playbook amazon-elasticache


【解决方案1】:

此功能根本没有公开。不幸的是,通过 Ansible 工作,您将被绑定到您和 API 之间维护最慢的项目。

在这种情况下,boto 会公开子网组(CloudFormation 也会这样做)。看这里http://boto.readthedocs.org/en/latest/ref/elasticache.html

Ansible 没有。看这里https://github.com/ansible/ansible-modules-core/blob/devel/cloud/amazon/elasticache.py

修补模块非常容易,如果您有时间,请务必回馈。希望这会有所帮助。

【讨论】: