Search code examples
amazon-web-servicesbotoansibleamazon-elasticache

default subnets error for Elasticache creation using Ansible


I am trying to create an elastic cache cluster using Ansible. I have a default subnet group already created in my VPC. After executing the below script I am getting an error of default subnet group not being present.

- 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

I am getting the below error. I have tried following all examples on the web.

TASK: [Creating Elastic Cache Queue] ****************************************** failed: [localhost -> 127.0.0.1] => {"failed": true} msg: The account does not have any default subnets.

FATAL: all hosts have already failed -- aborting

I have followed Ansible documentation and did some research still not able to figure out the problem. Can someone point error I am missing ? .


Solution

  • This functionality is simply not exposed. Unfortunately working via Ansible you'll be bound to the slowest maintained project between you and the API.

    In this case, boto exposes the subnet group (CloudFormation incidentally also does). See here http://boto.readthedocs.org/en/latest/ref/elasticache.html

    Ansible does not. See here https://github.com/ansible/ansible-modules-core/blob/devel/cloud/amazon/elasticache.py

    Patching the modules is very easy to do, and if you find the time, be sure to contribute back. Hope this helps.