Skip to content

Instantly share code, notes, and snippets.

@tomwwright
Last active March 28, 2018 11:07
Show Gist options
  • Save tomwwright/89f62db58cdcf33d8503885ab3bb1d18 to your computer and use it in GitHub Desktop.
Save tomwwright/89f62db58cdcf33d8503885ab3bb1d18 to your computer and use it in GitHub Desktop.
ansibled : aurora : inventory (cluster), group vars for Aurora clusters, host vars for example cluster, playbook
# aurora.yml
# ---
# playbook that builds Aurora clusters and Aurora DB instances
# first run a play for any cluster hosts to create them
- hosts: aurora.cluster
environment:
AWS_ACCESS_KEY_ID: "{{ aws_access_key }}"
AWS_SECRET_ACCESS_KEY: "{{ aws_secret_key }}"
AWS_REGION: "{{ aws_region }}"
tasks:
- import_tasks: tasks/vpc/facts.yml
- import_tasks: tasks/aurora/setup.subnet-group.yml
- import_tasks: tasks/aurora/setup.parameter-groups.yml
- import_tasks: tasks/aurora/setup.cluster.yml
# group_vars/aurora.cluster.yml
# ---
# default variables for hosts in the group for Aurora clusters
aurora_cluster_port: 3306
aurora_cluster_security_group_ids:
- "{{ vpc_security_group_ids['vpc'] }}"
aurora_cluster_availability_zones:
- "{{ aws_region }}a"
- "{{ aws_region }}b"
- "{{ aws_region }}c"
aurora_cluster_subnet_ids:
- "{{ vpc_subnet_ids['private-a'] }}"
- "{{ vpc_subnet_ids['private-b'] }}"
- "{{ vpc_subnet_ids['private-c'] }}"
# host_vars/cluster.aurora.ansibled.yml
# ---
# specific variables for the "auroradb.ansibled" host
aurora_cluster_name: ansibled-aurora-cluster
aurora_cluster_dns: auroradb.{{ vpc_dns_zone }}
# credentials for the master user of our db cluster -- password (ansibled-db-password) encrypted with Ansible Vault
aurora_cluster_username: ansibled_db_user
aurora_cluster_password: !vault |
$ANSIBLE_VAULT;1.1;AES256
63313164666335343165616234663938376539393163336233336535623831383135393731393938
6561346464306536303161303261363334303566616663390a336636623566333737363830316335
30636161396231646130353939373236353833313164353462646535646432623939343937346438
3635303438343963660a323534613431643465316630353735663437333430393232316636313364
36383330363532363963666432313262623134366465333532623865356139376161
# hosts.inventory
# ---
# the host and group list for this example "Ansibled" project
[elasticsearch]
big.elasticsearch.ansibled
small.elasticsearch.ansibled
[aurora.cluster]
cluster.aurora.ansibled
[vpc]
vpc.ansibled
[project.ansibled:children]
vpc
aurora.cluster
elasticsearch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment