This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# hosts.inventory | |
# --- | |
# the host and group list for this example "Ansibled" project | |
[elasticsearch] | |
big.elasticsearch.ansibled | |
small.elasticsearch.ansibled | |
[vpc] | |
vpc.ansibled |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 }}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 }}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# hosts.inventory | |
# --- | |
# the host and group list for this example "Ansibled" project | |
[elasticsearch] | |
big.elasticsearch.ansibled | |
small.elasticsearch.ansibled | |
[aurora.cluster] | |
cluster.aurora.ansibled |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 }}" |