|
|
@ -340,7 +340,7 @@ try:
|
|
|
|
except ImportError:
|
|
|
|
except ImportError:
|
|
|
|
has_rds2 = False
|
|
|
|
has_rds2 = False
|
|
|
|
|
|
|
|
|
|
|
|
DEFAULT_PORTS= {
|
|
|
|
DEFAULT_PORTS = {
|
|
|
|
'aurora': 3306,
|
|
|
|
'aurora': 3306,
|
|
|
|
'mariadb': 3306,
|
|
|
|
'mariadb': 3306,
|
|
|
|
'mysql': 3306,
|
|
|
|
'mysql': 3306,
|
|
|
@ -349,6 +349,7 @@ DEFAULT_PORTS= {
|
|
|
|
'postgres': 5432,
|
|
|
|
'postgres': 5432,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class RDSException(Exception):
|
|
|
|
class RDSException(Exception):
|
|
|
|
def __init__(self, exc):
|
|
|
|
def __init__(self, exc):
|
|
|
|
if hasattr(exc, 'error_message') and exc.error_message:
|
|
|
|
if hasattr(exc, 'error_message') and exc.error_message:
|
|
|
@ -481,8 +482,8 @@ class RDS2Connection:
|
|
|
|
def create_db_instance(self, instance_name, size, instance_class, db_engine,
|
|
|
|
def create_db_instance(self, instance_name, size, instance_class, db_engine,
|
|
|
|
username, password, **params):
|
|
|
|
username, password, **params):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
result = self.connection.create_db_instance(instance_name, size, instance_class,
|
|
|
|
result = self.connection.create_db_instance(instance_name, size, instance_class, db_engine, username, password,
|
|
|
|
db_engine, username, password, **params)['CreateDBInstanceResponse']['CreateDBInstanceResult']['DBInstance']
|
|
|
|
**params)['CreateDBInstanceResponse']['CreateDBInstanceResult']['DBInstance']
|
|
|
|
return RDS2DBInstance(result)
|
|
|
|
return RDS2DBInstance(result)
|
|
|
|
except boto.exception.BotoServerError as e:
|
|
|
|
except boto.exception.BotoServerError as e:
|
|
|
|
raise RDSException(e)
|
|
|
|
raise RDSException(e)
|
|
|
@ -560,17 +561,17 @@ class RDSDBInstance:
|
|
|
|
|
|
|
|
|
|
|
|
def get_data(self):
|
|
|
|
def get_data(self):
|
|
|
|
d = {
|
|
|
|
d = {
|
|
|
|
'id' : self.name,
|
|
|
|
'id': self.name,
|
|
|
|
'create_time' : self.instance.create_time,
|
|
|
|
'create_time': self.instance.create_time,
|
|
|
|
'status' : self.status,
|
|
|
|
'status': self.status,
|
|
|
|
'availability_zone' : self.instance.availability_zone,
|
|
|
|
'availability_zone': self.instance.availability_zone,
|
|
|
|
'backup_retention' : self.instance.backup_retention_period,
|
|
|
|
'backup_retention': self.instance.backup_retention_period,
|
|
|
|
'backup_window' : self.instance.preferred_backup_window,
|
|
|
|
'backup_window': self.instance.preferred_backup_window,
|
|
|
|
'maintenance_window' : self.instance.preferred_maintenance_window,
|
|
|
|
'maintenance_window': self.instance.preferred_maintenance_window,
|
|
|
|
'multi_zone' : self.instance.multi_az,
|
|
|
|
'multi_zone': self.instance.multi_az,
|
|
|
|
'instance_type' : self.instance.instance_class,
|
|
|
|
'instance_type': self.instance.instance_class,
|
|
|
|
'username' : self.instance.master_username,
|
|
|
|
'username': self.instance.master_username,
|
|
|
|
'iops' : self.instance.iops
|
|
|
|
'iops': self.instance.iops
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Only assign an Endpoint if one is available
|
|
|
|
# Only assign an Endpoint if one is available
|
|
|
@ -594,8 +595,6 @@ class RDSDBInstance:
|
|
|
|
return d
|
|
|
|
return d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class RDS2DBInstance:
|
|
|
|
class RDS2DBInstance:
|
|
|
|
def __init__(self, dbinstance):
|
|
|
|
def __init__(self, dbinstance):
|
|
|
|
self.instance = dbinstance
|
|
|
|
self.instance = dbinstance
|
|
|
@ -639,12 +638,12 @@ class RDSSnapshot:
|
|
|
|
|
|
|
|
|
|
|
|
def get_data(self):
|
|
|
|
def get_data(self):
|
|
|
|
d = {
|
|
|
|
d = {
|
|
|
|
'id' : self.name,
|
|
|
|
'id': self.name,
|
|
|
|
'create_time' : self.snapshot.snapshot_create_time,
|
|
|
|
'create_time': self.snapshot.snapshot_create_time,
|
|
|
|
'status' : self.status,
|
|
|
|
'status': self.status,
|
|
|
|
'availability_zone' : self.snapshot.availability_zone,
|
|
|
|
'availability_zone': self.snapshot.availability_zone,
|
|
|
|
'instance_id' : self.snapshot.instance_id,
|
|
|
|
'instance_id': self.snapshot.instance_id,
|
|
|
|
'instance_created' : self.snapshot.instance_create_time,
|
|
|
|
'instance_created': self.snapshot.instance_create_time,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
# needs boto >= 2.21.0
|
|
|
|
# needs boto >= 2.21.0
|
|
|
|
if hasattr(self.snapshot, 'snapshot_type'):
|
|
|
|
if hasattr(self.snapshot, 'snapshot_type'):
|
|
|
@ -665,14 +664,14 @@ class RDS2Snapshot:
|
|
|
|
|
|
|
|
|
|
|
|
def get_data(self):
|
|
|
|
def get_data(self):
|
|
|
|
d = {
|
|
|
|
d = {
|
|
|
|
'id' : self.name,
|
|
|
|
'id': self.name,
|
|
|
|
'create_time' : self.snapshot['SnapshotCreateTime'],
|
|
|
|
'create_time': self.snapshot['SnapshotCreateTime'],
|
|
|
|
'status' : self.status,
|
|
|
|
'status': self.status,
|
|
|
|
'availability_zone' : self.snapshot['AvailabilityZone'],
|
|
|
|
'availability_zone': self.snapshot['AvailabilityZone'],
|
|
|
|
'instance_id' : self.snapshot['DBInstanceIdentifier'],
|
|
|
|
'instance_id': self.snapshot['DBInstanceIdentifier'],
|
|
|
|
'instance_created' : self.snapshot['InstanceCreateTime'],
|
|
|
|
'instance_created': self.snapshot['InstanceCreateTime'],
|
|
|
|
'snapshot_type' : self.snapshot['SnapshotType'],
|
|
|
|
'snapshot_type': self.snapshot['SnapshotType'],
|
|
|
|
'iops' : self.snapshot['Iops'],
|
|
|
|
'iops': self.snapshot['Iops'],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return d
|
|
|
|
return d
|
|
|
|
|
|
|
|
|
|
|
@ -712,7 +711,7 @@ def create_db_instance(module, conn):
|
|
|
|
valid_vars = ['backup_retention', 'backup_window',
|
|
|
|
valid_vars = ['backup_retention', 'backup_window',
|
|
|
|
'character_set_name', 'db_name', 'engine_version',
|
|
|
|
'character_set_name', 'db_name', 'engine_version',
|
|
|
|
'instance_type', 'iops', 'license_model', 'maint_window',
|
|
|
|
'instance_type', 'iops', 'license_model', 'maint_window',
|
|
|
|
'multi_zone', 'option_group', 'parameter_group','port',
|
|
|
|
'multi_zone', 'option_group', 'parameter_group', 'port',
|
|
|
|
'subnet', 'upgrade', 'zone']
|
|
|
|
'subnet', 'upgrade', 'zone']
|
|
|
|
if module.params.get('subnet'):
|
|
|
|
if module.params.get('subnet'):
|
|
|
|
valid_vars.append('vpc_security_groups')
|
|
|
|
valid_vars.append('vpc_security_groups')
|
|
|
@ -1068,40 +1067,40 @@ def validate_parameters(required_vars, valid_vars, module):
|
|
|
|
def main():
|
|
|
|
def main():
|
|
|
|
argument_spec = ec2_argument_spec()
|
|
|
|
argument_spec = ec2_argument_spec()
|
|
|
|
argument_spec.update(dict(
|
|
|
|
argument_spec.update(dict(
|
|
|
|
command = dict(choices=['create', 'replicate', 'delete', 'facts', 'modify', 'promote', 'snapshot', 'reboot', 'restore'], required=True),
|
|
|
|
command=dict(choices=['create', 'replicate', 'delete', 'facts', 'modify', 'promote', 'snapshot', 'reboot', 'restore'], required=True),
|
|
|
|
instance_name = dict(required=False),
|
|
|
|
instance_name=dict(required=False),
|
|
|
|
source_instance = 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',
|
|
|
|
db_engine=dict(choices=['mariadb', 'MySQL', 'oracle-se1', 'oracle-se', 'oracle-ee', 'sqlserver-ee', 'sqlserver-se', 'sqlserver-ex',
|
|
|
|
'sqlserver-web', 'postgres', 'aurora'], required=False),
|
|
|
|
'sqlserver-web', 'postgres', 'aurora'], required=False),
|
|
|
|
size = dict(required=False),
|
|
|
|
size=dict(required=False),
|
|
|
|
instance_type = dict(aliases=['type'], required=False),
|
|
|
|
instance_type=dict(aliases=['type'], required=False),
|
|
|
|
username = dict(required=False),
|
|
|
|
username=dict(required=False),
|
|
|
|
password = dict(no_log=True, required=False),
|
|
|
|
password=dict(no_log=True, required=False),
|
|
|
|
db_name = dict(required=False),
|
|
|
|
db_name=dict(required=False),
|
|
|
|
engine_version = dict(required=False),
|
|
|
|
engine_version=dict(required=False),
|
|
|
|
parameter_group = 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),
|
|
|
|
license_model=dict(choices=['license-included', 'bring-your-own-license', 'general-public-license', 'postgresql-license'], required=False),
|
|
|
|
multi_zone = dict(type='bool', default=False),
|
|
|
|
multi_zone=dict(type='bool', required=False),
|
|
|
|
iops = dict(required=False),
|
|
|
|
iops=dict(required=False),
|
|
|
|
security_groups = dict(required=False),
|
|
|
|
security_groups=dict(required=False),
|
|
|
|
vpc_security_groups = dict(type='list', required=False),
|
|
|
|
vpc_security_groups=dict(type='list', required=False),
|
|
|
|
port = dict(required=False),
|
|
|
|
port=dict(required=False),
|
|
|
|
upgrade = dict(type='bool', default=False),
|
|
|
|
upgrade=dict(type='bool', default=False),
|
|
|
|
option_group = dict(required=False),
|
|
|
|
option_group=dict(required=False),
|
|
|
|
maint_window = dict(required=False),
|
|
|
|
maint_window=dict(required=False),
|
|
|
|
backup_window = dict(required=False),
|
|
|
|
backup_window=dict(required=False),
|
|
|
|
backup_retention = dict(required=False),
|
|
|
|
backup_retention=dict(required=False),
|
|
|
|
zone = dict(aliases=['aws_zone', 'ec2_zone'], required=False),
|
|
|
|
zone=dict(aliases=['aws_zone', 'ec2_zone'], required=False),
|
|
|
|
subnet = dict(required=False),
|
|
|
|
subnet=dict(required=False),
|
|
|
|
wait = dict(type='bool', default=False),
|
|
|
|
wait=dict(type='bool', default=False),
|
|
|
|
wait_timeout = dict(type='int', default=300),
|
|
|
|
wait_timeout=dict(type='int', default=300),
|
|
|
|
snapshot = dict(required=False),
|
|
|
|
snapshot=dict(required=False),
|
|
|
|
apply_immediately = dict(type='bool', default=False),
|
|
|
|
apply_immediately=dict(type='bool', default=False),
|
|
|
|
new_instance_name = dict(required=False),
|
|
|
|
new_instance_name=dict(required=False),
|
|
|
|
tags = dict(type='dict', required=False),
|
|
|
|
tags=dict(type='dict', required=False),
|
|
|
|
publicly_accessible = dict(required=False),
|
|
|
|
publicly_accessible=dict(required=False),
|
|
|
|
character_set_name = dict(required=False),
|
|
|
|
character_set_name=dict(required=False),
|
|
|
|
force_failover = dict(type='bool', required=False, default=False)
|
|
|
|
force_failover=dict(type='bool', required=False, default=False)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|