Skip to content

Instantly share code, notes, and snippets.

View tomwwright's full-sized avatar
🎯
Focusing

Tom Wright tomwwright

🎯
Focusing
View GitHub Profile
@tomwwright
tomwwright / ansibled:es:hosts.inventory
Last active March 28, 2018 10:23
ansibled : es : hosts.inventory
# hosts.inventory
# ---
# the host and group list for this example "Ansibled" project
[elasticsearch]
big.elasticsearch.ansibled
small.elasticsearch.ansibled
[vpc]
vpc.ansibled
@tomwwright
tomwwright / ansible:es:group_vars:elasticsearch.yml
Last active March 19, 2018 10:55
ansibled : es : group_vars : elasticsearch
# group_vars/elasticsearch.yml
# ---
# specify defaults for our Elasticsearch clusters
elasticsearch_version: 6.0
elasticsearch_instance_type: r4.large
elasticsearch_instance_count: 3
elasticsearch_dedicated_masters_enabled: false
@tomwwright
tomwwright / ansible:es:elasticsearch.yml
Last active March 19, 2018 11:42
ansible : elasticsearch : elasticsearch playbook
# elasticsearch.yml
# ---
# playbook that builds elasticsearch clusters: run our facts tasks for the VPC
# to define some necessary details, then run the setup tasks
- hosts: elasticsearch
environment:
AWS_ACCESS_KEY_ID: "{{ aws_access_key }}"
AWS_SECRET_ACCESS_KEY: "{{ aws_secret_key }}"
AWS_REGION: "{{ aws_region }}"
@tomwwright
tomwwright / ansibled:aurora:tasks:parameter-group.yml
Last active March 28, 2018 10:18
ansibled : aurora : tasks : subnet group and default parameter group
# tasks/aurora/setup.parameter-group.yml
# ---
# use the AWS CLI to create a (default) parameter group for Aurora clusters
# list existing cluster parameter groups using the AWS CLI
- name: check for DB cluster parameter group
command: >
aws rds describe-db-cluster-parameter-groups
--no-paginate
--region {{ aws_region }}
@tomwwright
tomwwright / ansibled:aurora:tasks:cluster.yml
Last active March 28, 2018 11:12
ansibled : aurora : tasks : setup cluster
# tasks/auroradb/setup.cluster.yml
# ---
# check if an Aurora DB cluster exists, and create it if it doesn't. Then update the VPC DNS
# look for an existing Aurora DB cluster for this host using the AWS CLI
- name: check for Aurora DB cluster
command: aws rds describe-db-clusters --filters Name=db-cluster-id,Values={{ aurora_cluster_name }} --region {{ aws_region }}
changed_when: false
register: aurora_cluster_query
@tomwwright
tomwwright / ansibled:aurora:aurora.yml
Last active March 28, 2018 11:07
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 }}"
@tomwwright
tomwwright / ansibled:aurora:hosts.inventory
Created March 28, 2018 11:16
ansibled : aurora : inventory (cluster)
# hosts.inventory
# ---
# the host and group list for this example "Ansibled" project
[elasticsearch]
big.elasticsearch.ansibled
small.elasticsearch.ansibled
[aurora.cluster]
cluster.aurora.ansibled
@tomwwright
tomwwright / ansibled:aurora:group_vars:aurora.cluster.yml
Created March 28, 2018 11:17
ansibled : aurora : group vars : aurora cluster
# 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:
@tomwwright
tomwwright / ansibled:aurora:host_vars:cluster.aurora.ansibled.yml
Created March 28, 2018 11:18
ansibled : aurora : host_vars : example aurora cluster
# 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 |
@tomwwright
tomwwright / ansibled:aurora:aurora.yml
Created March 28, 2018 11:20
ansibled : aurora : aurora playbook (cluster only)
# aurora.yml
# ---
# playbook that builds Aurora clusters
# 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 }}"