Commit 93056a9b by Kevin Falcone

A new playbook we can use to create RDSes

parent c58ce173
# This play will create an RDS for an application.
# It can be run like so:
#
# ansible-playbook -c local -i 'localhost,' create_rds.yml -e@./db.yml
#
# where the content of db.yml contains the following settings
#
# It can read from the same config as create_dbs_and_users.yml and needs this
# part of that config
# database_connection:
# login_user: "root"
# login_password: "super-secure-password"
#
# database_name: your-database-name
# database_size: number of gigabytes (integer)
# instance_type: Choose an AWS RDS instance type such as "db.t2.medium"
# aws_region: a full region (such as us-east-1 or us-west-2) not an AZ
# database_engine_version: You should use either or standard or the newest possible, such as "5.6.39"
# maintenance_window: UTC time and day of week to allow maintenance "Mon:16:00-Mon:16:30"
# vpc_security_groups: What security group in the VPC your RDS should belong to (this is separate from your app or elb SG)
# subnet_group: a name of a group in the RDS console that contains subnets, it will pick the appropriate one
# parameter_group: name of the parameter group with overriddent defaults for this RDS
# backup_window: UTC time of the day to take a backup "08:00-08:30"
# backup_retention: Days to keep backups (integer)
# multi_zone: yes or no (whether this RDS is multi-az)
# tags:
# environment: "environment"
# deployment: "deployment"
# cluster: "cluster"
- name: Create databases and users
hosts: all
gather_facts: False
tasks:
- name: create RDS
rds:
command: create
instance_name: "{{ database_name }}"
db_engine: "{{ database_engine|default('MySQL') }}"
size: "{{ database_size }}"
instance_type: "{{ instance_type }}"
region: "{{ aws_region }}"
username: "{{ database_connection.login_user }}"
password: "{{ database_connection.login_password }}"
engine_version: "{{ database_engine_version }}"
maint_window: "{{ maintenance_window }}"
multi_zone: "{{ multi_zone }}"
vpc_security_groups: "{{ vpc_security_groups }}"
subnet: "{{ subnet_group }}"
parameter_group: "{{ parameter_group }}"
backup_window: "{{ backup_window }}"
backup_retention: "{{ backup_retention }}"
tags: "{{ tags }}"
# It would be nice to wait for success, but this takes a while and I routinely tripped
# the API call limit at AWS. Add it back if we know how to limit those.
# wait: yes
# wait_timeout: 900
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment