Issue 1:
ISSUE TYPE

Bug Report

COMPONENT NAME

elasticache

ANSIBLE VERSION

ansible 2.4.2.0
config file = /home/tessa/.ansible.cfg
configured module search path = [u'/home/tessa/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible
executable location = /usr/local/bin/ansible
python version = 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0]

CONFIGURATION

⟫ ansible-config dump --only-changed
ALLOW_WORLD_READABLE_TMPFILES(/home/tessa/.ansible.cfg) = True
DEFAULT_FORKS(/home/tessa/.ansible.cfg) = 16
DEPRECATION_WARNINGS(/home/tessa/.ansible.cfg) = False
HOST_KEY_CHECKING(/home/tessa/.ansible.cfg) = False

OS / ENVIRONMENT

ubuntu 17.10

SUMMARY

the elasticache module now thinks there's always changes to our redis deploy, when there are no changes to be made. worse, it says the changes always require "hard_modify = yes", so now every time our playbook runs it tears down and rebuilds our redis cluster. this is pretty brutal.

STEPS TO REPRODUCE

- name: create EC redis instance
elasticache:
region: "us-west-2"
name: "redis"
parameter_group: "mainapp-28"
engine: redis
cache_engine_version: 2.8.19
cache_subnet_group: "redis-subnets"
node_type: cache.m3.medium
security_group_ids: "some sg"
num_nodes: 1
state: present
hard_modify: yes
wait: yes

EXPECTED RESULTS

Say "no changes" and continue.

ACTUAL RESULTS

continuously destroys and rebuilds our redis instance.

TASK [create EC redis instance] ***********************************************************************************************************************************************************************************
task path: /home/tessa/ansible/vpc-redis.yml:60
Using module file /usr/local/lib/python2.7/dist-packages/ansible/modules/cloud/amazon/elasticache.py
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: tessa
<127.0.0.1> EXEC /bin/sh -c 'echo ~ && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/tessa/.ansible/tmp/ansible-tmp-1517443020.15-70458660838448 `" && echo ansible-tmp-1517443020.15-70458660838448="` echo /home/tessa/.ansible/tmp/ansible-tmp-1517443020.15-70458660838448 `" ) && sleep 0'
<127.0.0.1> PUT /tmp/tmpfjy7aP TO /home/tessa/.ansible/tmp/ansible-tmp-1517443020.15-70458660838448/elasticache.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/tessa/.ansible/tmp/ansible-tmp-1517443020.15-70458660838448/ /home/tessa/.ansible/tmp/ansible-tmp-1517443020.15-70458660838448/elasticache.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/usr/bin/python /home/tessa/.ansible/tmp/ansible-tmp-1517443020.15-70458660838448/elasticache.py; rm -rf "/home/tessa/.ansible/tmp/ansible-tmp-1517443020.15-70458660838448/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {
"changed": true,
"elasticache": {
"data": {
"AtRestEncryptionEnabled": false,
"AuthTokenEnabled": false,
"AutoMinorVersionUpgrade": true,
"CacheClusterCreateTime": "2018-02-01T00:05:33.508000+00:00",
"CacheClusterId": "redis",
"CacheClusterStatus": "available",
"CacheNodeType": "cache.m3.medium",
"CacheNodes": [
{
"CacheNodeCreateTime": "2018-02-01T00:05:33.508000+00:00",
"CacheNodeId": "0001",
"CacheNodeStatus": "available",
"CustomerAvailabilityZone": "us-west-2b",
"Endpoint": {
"Address": "some-endpoint.cache.amazonaws.com",
"Port": 6379
},
"ParameterGroupStatus": "in-sync"
}
],
"CacheParameterGroup": {
"CacheNodeIdsToReboot": [],
"CacheParameterGroupName": "mainapp-28",
"ParameterApplyStatus": "in-sync"
},
"CacheSecurityGroups": [],
"CacheSubnetGroupName": "redis-subnets",
"ClientDownloadLandingPage": "https://console.aws.amazon.com/elasticache/home#client-download:",
"Engine": "redis",
"EngineVersion": "2.8.19",
"NumCacheNodes": 1,
"PendingModifiedValues": {},
"PreferredAvailabilityZone": "us-west-2b",
"PreferredMaintenanceWindow": "sat:07:00-sat:08:00",
"SecurityGroups": [
{
"SecurityGroupId": "sg-0694177d",
"Status": "active"
}
],
"SnapshotRetentionLimit": 0,
"SnapshotWindow": "10:30-11:30",
"TransitEncryptionEnabled": false
},
"name": "staging-redis",
"status": "available"
},
"invocation": {
"module_args": {
"aws_access_key": null,
"aws_secret_key": null,
"cache_engine_version": "2.8.19",
"cache_parameter_group": "mainapp-28",
"cache_port": null,
"cache_security_groups": [],
"cache_subnet_group": "redis-subnets",
"ec2_url": null,
"engine": "redis",
"hard_modify": true,
"name": "redis",
"node_type": "cache.m3.medium",
"num_nodes": 1,
"parameter_group": "mainapp-28",
"profile": null,
"region": "us-west-2",
"security_group_ids": [
"sg-something"
],
"security_token": null,
"state": "present",
"validate_certs": true,
"wait": true,
"zone": ""
}
}
}

Issue 2:
ISSUE TYPE

Bug Report

COMPONENT NAME

elasticache

ANSIBLE VERSION

ansible 2.4.0.0
config file = /Users/lkostka/devbox/prov/ansible.cfg
configured module search path = [u'/Users/lkostka/devbox/prov/modules']
ansible python module location = /Users/lkostka/.virtualenvs/prov/lib/python2.7/site-packages/ansible
executable location = /Users/lkostka/.virtualenvs/prov/bin/ansible
python version = 2.7.13 (default, Dec 18 2016, 07:03:39) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]

CONFIGURATION

ANSIBLE_PIPELINING(/Users/lkostka/devbox/prov/ansible.cfg) = True
ANSIBLE_SSH_ARGS(env: ANSIBLE_SSH_ARGS) =
DEFAULT_CALLBACK_PLUGIN_PATH(/Users/lkostka/devbox/prov/ansible.cfg) = [u'/Users/lkostka/devbox/prov/callbacks']
DEFAULT_FILTER_PLUGIN_PATH(/Users/lkostka/devbox/prov/ansible.cfg) = [u'/Users/lkostka/devbox/prov/filters']
DEFAULT_FORKS(/Users/lkostka/devbox/prov/ansible.cfg) = 40
DEFAULT_LOOKUP_PLUGIN_PATH(/Users/lkostka/devbox/prov/ansible.cfg) = [u'/Users/lkostka/devbox/prov/lookups']
DEFAULT_MODULE_PATH(/Users/lkostka/devbox/prov/ansible.cfg) = [u'/Users/lkostka/devbox/prov/modules']
DEFAULT_SCP_IF_SSH(/Users/lkostka/devbox/prov/ansible.cfg) = true
DEFAULT_TRANSPORT(/Users/lkostka/devbox/prov/ansible.cfg) = ssh
DEPRECATION_WARNINGS(/Users/lkostka/devbox/prov/ansible.cfg) = True
RETRY_FILES_ENABLED(/Users/lkostka/devbox/prov/ansible.cfg) = False

OS / ENVIRONMENT

mac os

SUMMARY

Module must receive null (None in python) to be able to work. If zone is not specified then module receives ''. We do not care about in which az redis is. Without explicit zone, module fails because it receives empty string as a value of zone and tries to do destructive change.

STEPS TO REPRODUCE

Just create a cluster without specifying zone.

EXPECTED RESULTS

Module should try to do destructive change when no zone key is missing from yaml file.

ACTUAL RESULTS

https://github.com/ansible/ansible/blob/v2.4.0.0-1/lib/ansible/modules/cloud/amazon/elasticache.py#L420

No zone key in module params causes module to see zone key value as ''