|
|
|
@ -694,7 +694,7 @@ def create_db_instance(module, conn):
|
|
|
|
|
try:
|
|
|
|
|
result = conn.create_db_instance(instance_name, module.params.get('size'),
|
|
|
|
|
module.params.get('instance_type'), module.params.get('db_engine'),
|
|
|
|
|
module.params.get('username'), module.params.get('password'), **params)
|
|
|
|
|
module.params.get('username'), module.params.get('password'), **params)
|
|
|
|
|
changed = True
|
|
|
|
|
except RDSException as e:
|
|
|
|
|
module.fail_json(msg="Failed to create instance: %s" % e.message)
|
|
|
|
@ -953,40 +953,40 @@ def validate_parameters(required_vars, valid_vars, module):
|
|
|
|
|
|
|
|
|
|
# map to convert rds module options to boto rds and rds2 options
|
|
|
|
|
optional_params = {
|
|
|
|
|
'port': 'port',
|
|
|
|
|
'db_name': 'db_name',
|
|
|
|
|
'zone': 'availability_zone',
|
|
|
|
|
'maint_window': 'preferred_maintenance_window',
|
|
|
|
|
'backup_window': 'preferred_backup_window',
|
|
|
|
|
'backup_retention': 'backup_retention_period',
|
|
|
|
|
'multi_zone': 'multi_az',
|
|
|
|
|
'engine_version': 'engine_version',
|
|
|
|
|
'upgrade': 'auto_minor_version_upgrade',
|
|
|
|
|
'subnet': 'db_subnet_group_name',
|
|
|
|
|
'license_model': 'license_model',
|
|
|
|
|
'option_group': 'option_group_name',
|
|
|
|
|
'size': 'allocated_storage',
|
|
|
|
|
'iops': 'iops',
|
|
|
|
|
'new_instance_name': 'new_instance_id',
|
|
|
|
|
'apply_immediately': 'apply_immediately',
|
|
|
|
|
'port': 'port',
|
|
|
|
|
'db_name': 'db_name',
|
|
|
|
|
'zone': 'availability_zone',
|
|
|
|
|
'maint_window': 'preferred_maintenance_window',
|
|
|
|
|
'backup_window': 'preferred_backup_window',
|
|
|
|
|
'backup_retention': 'backup_retention_period',
|
|
|
|
|
'multi_zone': 'multi_az',
|
|
|
|
|
'engine_version': 'engine_version',
|
|
|
|
|
'upgrade': 'auto_minor_version_upgrade',
|
|
|
|
|
'subnet': 'db_subnet_group_name',
|
|
|
|
|
'license_model': 'license_model',
|
|
|
|
|
'option_group': 'option_group_name',
|
|
|
|
|
'size': 'allocated_storage',
|
|
|
|
|
'iops': 'iops',
|
|
|
|
|
'new_instance_name': 'new_instance_id',
|
|
|
|
|
'apply_immediately': 'apply_immediately',
|
|
|
|
|
}
|
|
|
|
|
# map to convert rds module options to boto rds options
|
|
|
|
|
optional_params_rds = {
|
|
|
|
|
'db_engine': 'engine',
|
|
|
|
|
'password': 'master_password',
|
|
|
|
|
'parameter_group': 'param_group',
|
|
|
|
|
'instance_type': 'instance_class',
|
|
|
|
|
'db_engine': 'engine',
|
|
|
|
|
'password': 'master_password',
|
|
|
|
|
'parameter_group': 'param_group',
|
|
|
|
|
'instance_type': 'instance_class',
|
|
|
|
|
}
|
|
|
|
|
# map to convert rds module options to boto rds2 options
|
|
|
|
|
optional_params_rds2 = {
|
|
|
|
|
'tags': 'tags',
|
|
|
|
|
'publicly_accessible': 'publicly_accessible',
|
|
|
|
|
'parameter_group': 'db_parameter_group_name',
|
|
|
|
|
'character_set_name': 'character_set_name',
|
|
|
|
|
'instance_type': 'db_instance_class',
|
|
|
|
|
'password': 'master_user_password',
|
|
|
|
|
'new_instance_name': 'new_db_instance_identifier',
|
|
|
|
|
'force_failover': 'force_failover',
|
|
|
|
|
'tags': 'tags',
|
|
|
|
|
'publicly_accessible': 'publicly_accessible',
|
|
|
|
|
'parameter_group': 'db_parameter_group_name',
|
|
|
|
|
'character_set_name': 'character_set_name',
|
|
|
|
|
'instance_type': 'db_instance_class',
|
|
|
|
|
'password': 'master_user_password',
|
|
|
|
|
'new_instance_name': 'new_db_instance_identifier',
|
|
|
|
|
'force_failover': 'force_failover',
|
|
|
|
|
}
|
|
|
|
|
if has_rds2:
|
|
|
|
|
optional_params.update(optional_params_rds2)
|
|
|
|
@ -1029,40 +1029,40 @@ def validate_parameters(required_vars, valid_vars, module):
|
|
|
|
|
def main():
|
|
|
|
|
argument_spec = ec2_argument_spec()
|
|
|
|
|
argument_spec.update(dict(
|
|
|
|
|
command = dict(choices=['create', 'replicate', 'delete', 'facts', 'modify', 'promote', 'snapshot', 'reboot', 'restore'], required=True),
|
|
|
|
|
instance_name = dict(required=False),
|
|
|
|
|
source_instance = dict(required=False),
|
|
|
|
|
db_engine = dict(choices=['mariadb', 'MySQL', 'oracle-se1', 'oracle-se', 'oracle-ee', 'sqlserver-ee', 'sqlserver-se', 'sqlserver-ex', 'sqlserver-web', 'postgres', 'aurora'], required=False),
|
|
|
|
|
size = dict(required=False),
|
|
|
|
|
instance_type = dict(aliases=['type'], required=False),
|
|
|
|
|
username = dict(required=False),
|
|
|
|
|
password = dict(no_log=True, required=False),
|
|
|
|
|
db_name = dict(required=False),
|
|
|
|
|
engine_version = dict(required=False),
|
|
|
|
|
parameter_group = dict(required=False),
|
|
|
|
|
license_model = dict(choices=['license-included', 'bring-your-own-license', 'general-public-license', 'postgresql-license'], required=False),
|
|
|
|
|
multi_zone = dict(type='bool', default=False),
|
|
|
|
|
iops = dict(required=False),
|
|
|
|
|
security_groups = dict(required=False),
|
|
|
|
|
vpc_security_groups = dict(type='list', required=False),
|
|
|
|
|
port = dict(required=False),
|
|
|
|
|
upgrade = dict(type='bool', default=False),
|
|
|
|
|
option_group = dict(required=False),
|
|
|
|
|
maint_window = dict(required=False),
|
|
|
|
|
backup_window = dict(required=False),
|
|
|
|
|
backup_retention = dict(required=False),
|
|
|
|
|
zone = dict(aliases=['aws_zone', 'ec2_zone'], required=False),
|
|
|
|
|
subnet = dict(required=False),
|
|
|
|
|
wait = dict(type='bool', default=False),
|
|
|
|
|
wait_timeout = dict(type='int', default=300),
|
|
|
|
|
snapshot = dict(required=False),
|
|
|
|
|
apply_immediately = dict(type='bool', default=False),
|
|
|
|
|
new_instance_name = dict(required=False),
|
|
|
|
|
tags = dict(type='dict', required=False),
|
|
|
|
|
publicly_accessible = dict(required=False),
|
|
|
|
|
character_set_name = dict(required=False),
|
|
|
|
|
force_failover = dict(type='bool', required=False, default=False)
|
|
|
|
|
)
|
|
|
|
|
command = dict(choices=['create', 'replicate', 'delete', 'facts', 'modify', 'promote', 'snapshot', 'reboot', 'restore'], required=True),
|
|
|
|
|
instance_name = dict(required=False),
|
|
|
|
|
source_instance = dict(required=False),
|
|
|
|
|
db_engine = dict(choices=['mariadb', 'MySQL', 'oracle-se1', 'oracle-se', 'oracle-ee', 'sqlserver-ee', 'sqlserver-se', 'sqlserver-ex', 'sqlserver-web', 'postgres', 'aurora'], required=False),
|
|
|
|
|
size = dict(required=False),
|
|
|
|
|
instance_type = dict(aliases=['type'], required=False),
|
|
|
|
|
username = dict(required=False),
|
|
|
|
|
password = dict(no_log=True, required=False),
|
|
|
|
|
db_name = dict(required=False),
|
|
|
|
|
engine_version = dict(required=False),
|
|
|
|
|
parameter_group = dict(required=False),
|
|
|
|
|
license_model = dict(choices=['license-included', 'bring-your-own-license', 'general-public-license', 'postgresql-license'], required=False),
|
|
|
|
|
multi_zone = dict(type='bool', default=False),
|
|
|
|
|
iops = dict(required=False),
|
|
|
|
|
security_groups = dict(required=False),
|
|
|
|
|
vpc_security_groups = dict(type='list', required=False),
|
|
|
|
|
port = dict(required=False),
|
|
|
|
|
upgrade = dict(type='bool', default=False),
|
|
|
|
|
option_group = dict(required=False),
|
|
|
|
|
maint_window = dict(required=False),
|
|
|
|
|
backup_window = dict(required=False),
|
|
|
|
|
backup_retention = dict(required=False),
|
|
|
|
|
zone = dict(aliases=['aws_zone', 'ec2_zone'], required=False),
|
|
|
|
|
subnet = dict(required=False),
|
|
|
|
|
wait = dict(type='bool', default=False),
|
|
|
|
|
wait_timeout = dict(type='int', default=300),
|
|
|
|
|
snapshot = dict(required=False),
|
|
|
|
|
apply_immediately = dict(type='bool', default=False),
|
|
|
|
|
new_instance_name = dict(required=False),
|
|
|
|
|
tags = dict(type='dict', required=False),
|
|
|
|
|
publicly_accessible = dict(required=False),
|
|
|
|
|
character_set_name = dict(required=False),
|
|
|
|
|
force_failover = dict(type='bool', required=False, default=False)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
module = AnsibleModule(
|
|
|
|
@ -1073,15 +1073,15 @@ def main():
|
|
|
|
|
module.fail_json(msg='boto required for this module')
|
|
|
|
|
|
|
|
|
|
invocations = {
|
|
|
|
|
'create': create_db_instance,
|
|
|
|
|
'replicate': replicate_db_instance,
|
|
|
|
|
'delete': delete_db_instance_or_snapshot,
|
|
|
|
|
'facts': facts_db_instance_or_snapshot,
|
|
|
|
|
'modify': modify_db_instance,
|
|
|
|
|
'promote': promote_db_instance,
|
|
|
|
|
'snapshot': snapshot_db_instance,
|
|
|
|
|
'reboot': reboot_db_instance,
|
|
|
|
|
'restore': restore_db_instance,
|
|
|
|
|
'create': create_db_instance,
|
|
|
|
|
'replicate': replicate_db_instance,
|
|
|
|
|
'delete': delete_db_instance_or_snapshot,
|
|
|
|
|
'facts': facts_db_instance_or_snapshot,
|
|
|
|
|
'modify': modify_db_instance,
|
|
|
|
|
'promote': promote_db_instance,
|
|
|
|
|
'snapshot': snapshot_db_instance,
|
|
|
|
|
'reboot': reboot_db_instance,
|
|
|
|
|
'restore': restore_db_instance,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
region, ec2_url, aws_connect_params = get_aws_connection_info(module)
|
|
|
|
|