# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
DOCUMENTATION = '''
---
module: rds
short_description: create or delete an Amazon rds instance
description:
- Creates or deletes rds instances. When creating an instance it can be either a new instance or a read-only replica of an existing instance. This module has a dependency on python-boto >= 2.5.
- Name of the database to replicate. Used only when action=replicate.
required: false
default: null
aliases: []
db_engine:
description:
- The type of database. Used only when action=create. Must be one of: MySQL | oracle-se1 | oracle-se | oracle-ee | sqlserver-ee | sqlserver-se | sqlserver-ex | sqlserver-web
required: false
default: null
aliases: []
size:
description:
- Size in gigabytes of the initial storage for the DB instance. Used only when action=create.
required: false
default: null
aliases: []
instance_type:
description:
- The instance type of the database. Must be specified when action=create. Optional when action=replicate. If not specified then the replica inherits the same instance type as the source instance. Must be one of: db.t1.micro | db.m1.small | db.m1.medium | db.m1.large | db.m1.xlarge | db.m2.xlarge | db.m2.2xlarge | db.m2.4xlarge
required: false
default: null
aliases: []
username:
description:
- Master database username. Used only when action=create.
required: false
default: null
aliases: []
password:
description:
- Password for the master database username. Used only when action=create.
required: false
default: null
aliases: []
ec2_region:
description:
- the EC2 region to use. If not specified then the EC2_REGION environment variable is used. If neither exist then the AWS is queried for the region that the host invoking the module is located in.
required: true
default: null
aliases: []
db_name:
description:
- Name of a database to create within the instance. If not specified then no database is created. Used only when action=create.
required: false
default: null
aliases: []
engine_version:
description:
- Version number of the database engine to use. Used only when action=create. If not specified then the current Amazon RDS default engine version is used.
required: false
default: null
aliases: []
parameter_group:
description:
- Name of the DB parameter group to associate with this instance. If omitted then the RDS default DBParameterGroup will be used. Used only when action=create.
required: false
default: null
aliases: []
license_model:
description:
- The license model for this DB instance. Used only when action=create. Must be one of: license-included | bring-your-own-license | general-public-license
required: false
default: null
aliases: []
multi_zone:
description:
- Specifies if this is a Multi-availability-zone deployment. Can not be used in conjunction with zone parameter. Used only when action=create. Valid values: true | false
required: false
default: null
aliases: []
iops:
description:
- Specifies the number of IOPS for the instance. Used only when action=create. Must be an integer greater than 1000.
required: false
default: null
aliases: []
security_groups:
description:
- Comma separated list of one or more security groups. Used only when action=create. If a subnet is specified then this is treated as a list of VPC security groups.
required: false
default: null
aliases: []
port:
description:
- Port number that the DB instance uses for connections. Defaults to 3306 for mysql, 1521 for Oracle, 1443 for SQL Server. Used only when action=create or action=replicate.
required: false
default: null
aliases: []
upgrade:
description:
- Indicates that minor version upgrades should be applied automatically. Used only when action=create or action=replicate.
required: false
default: no
choices: [ "yes", "no" ]
aliases: []
option_group:
description:
- The name of the option group to use. If not specified then the default option group is used. Used only when action=create.
required: false
default: null
aliases: []
maint_window:
description:
- Maintenance window in format of ddd:hh24:mi-ddd:hh24:mi. (Example: Mon:22:00-Mon:23:15) If not specified then a random maintenance window is assigned. Used only when action=create.
required: false
default: null
aliases: []
backup_window:
description:
- Backup window in format of hh24:mi-hh24:mi. If not specified then a random backup window is assigned. Used only when action=create.
required: false
default: null
aliases: []
backup_retention:
description:
- Number of days backups are retained. Set to 0 to disable backups. Default is 1 day. Valid range: 0-35. Used only when action=create.
required: false
default: null
aliases: []
zone:
description:
- availability zone in which to launch the instance. Used only when action=create or action=replicate.
required: false
default: null
aliases: []
subnet:
description:
- VPC subnet group. If specified then a VPC instance is created. Used only when action=create.
required: false
default: null
aliases: []
snapshot:
description:
- Name of final snapshot to take when deleting an instance. If no snapshot name is provided then no snapshot is taken. Used only when action=delete.
required: false
default: null
aliases: []
ec2_secret_key:
description:
- EC2 secret key. If not specified then the EC2_SECRET_KEY environment variable is used.
required: false
default: null
aliases: []
ec2_access_key:
description:
- EC2 access key. If not specified then the EC2_ACCESS_KEY environment variable is used.
required: false
default: null
aliases: []
wait:
description:
- When action=create or action=replicate, wait for the database to enter the 'available' state. When action=delete wait for the database to be terminated.
required: false
default: "no"
choices: [ "yes", "no" ]
aliases: []
wait_timeout:
description:
- how long before wait gives up, in seconds
default: 300
aliases: []
requirements: [ "boto" ]
author: Bruce Pennypacker
'''
EXAMPLES = '''
# Basic mysql provisioning example
action: rds
action=create
instance_name=new_database
db_engine=MySQL
size=10
instance_type=db.m1.small
username=mysql_admin
password=1nsecure
# Create a read-only replica and wait for it to become available
action: rds
action=replicate
instance_name=new_database_replica
source_instance=new_database
wait=yes
wait_timeout=600
# Delete an instance, but create a snapshot before doing so