From bcc57875ed1dac6c4d6b4216abb654921b7a7254 Mon Sep 17 00:00:00 2001 From: Scot Spinner Date: Mon, 18 May 2015 10:34:21 -0700 Subject: [PATCH] adding parameter group option --- .../modules/cloud/amazon/elasticache.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/ansible/modules/cloud/amazon/elasticache.py b/lib/ansible/modules/cloud/amazon/elasticache.py index 6d0798c5287..c38954bda13 100644 --- a/lib/ansible/modules/cloud/amazon/elasticache.py +++ b/lib/ansible/modules/cloud/amazon/elasticache.py @@ -56,7 +56,12 @@ options: description: - The port number on which each of the cache nodes will accept connections required: false - default: none + default: 11211 + parameter_group: + description: + - Specify non-default parameter group names to be associated with cache cluster + required: false + default: None cache_subnet_group: description: - The subnet group name to associate with. Only use if inside a vpc. Required if inside a vpc @@ -148,7 +153,7 @@ class ElastiCacheManager(object): EXIST_STATUSES = ['available', 'creating', 'rebooting', 'modifying'] def __init__(self, module, name, engine, cache_engine_version, node_type, - num_nodes, cache_port, cache_subnet_group, + num_nodes, cache_port, parameter_group, cache_subnet_group, cache_security_groups, security_group_ids, zone, wait, hard_modify, region, **aws_connect_kwargs): self.module = module @@ -158,6 +163,7 @@ class ElastiCacheManager(object): self.node_type = node_type self.num_nodes = num_nodes self.cache_port = cache_port + self.parameter_group = parameter_group self.cache_subnet_group = cache_subnet_group self.cache_security_groups = cache_security_groups self.security_group_ids = security_group_ids @@ -216,6 +222,7 @@ class ElastiCacheManager(object): engine_version=self.cache_engine_version, cache_security_group_names=self.cache_security_groups, security_group_ids=self.security_group_ids, + cache_parameter_group_name=self.parameter_group, cache_subnet_group_name=self.cache_subnet_group, preferred_availability_zone=self.zone, port=self.cache_port) @@ -291,6 +298,7 @@ class ElastiCacheManager(object): num_cache_nodes=self.num_nodes, cache_node_ids_to_remove=nodes_to_remove, cache_security_group_names=self.cache_security_groups, + cache_parameter_group_name=self.parameter_group, security_group_ids=self.security_group_ids, apply_immediately=True, engine_version=self.cache_engine_version) @@ -480,7 +488,8 @@ def main(): cache_engine_version={'required': False}, node_type={'required': False, 'default': 'cache.m1.small'}, num_nodes={'required': False, 'default': None, 'type': 'int'}, - cache_port={'required': False, 'type': 'int'}, + cache_port={'required': False, 'default': 11211, 'type': 'int'}, + parameter_group={'required': False, 'default': None}, cache_subnet_group={'required': False, 'default': None}, cache_security_groups={'required': False, 'default': [default], 'type': 'list'}, @@ -514,6 +523,7 @@ def main(): zone = module.params['zone'] wait = module.params['wait'] hard_modify = module.params['hard_modify'] + parameter_group = module.params['parameter_group'] if cache_subnet_group and cache_security_groups == [default]: cache_security_groups = [] @@ -534,7 +544,7 @@ def main(): num_nodes, cache_port, cache_subnet_group, cache_security_groups, - security_group_ids, zone, wait, + security_group_ids, parameter_group, zone, wait, hard_modify, region, **aws_connect_kwargs) if state == 'present':