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
{ | |
"DBInstanceIdentifier": "{{ aurora_db_name }}", | |
"DBInstanceClass": "{{ aurora_instance_type }}", | |
"Engine": "aurora-mysql", | |
"AvailabilityZone": "{{ aurora_availability_zone }}", | |
"DBSubnetGroupName": "{{ aurora_cluster_name }}-subnets", | |
"PreferredMaintenanceWindow": "mon:11:00-mon:11:30", | |
"MultiAZ": false, | |
"AutoMinorVersionUpgrade": true, | |
"LicenseModel": "general-public-license", |
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/dba.aurora.ansibled.yml | |
# --- | |
# specific configuration for one of our Aurora DBs | |
aurora_cluster_name: ansibled-aurora-cluster | |
aurora_db_name: ansibled-aurora-a | |
aurora_instance_type: db.t2.small | |
aurora_availability_zone: "{{ aws_region }}a" | |
aurora_promotion_tier: 1 |
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
logentries-very-important-service: | |
container_name: logentries_very_important_service | |
image: logentries/docker-logentries | |
command: -t ${LOGENTRIES_VERY_IMPORTANT_SERVICE} --no-stats --matchByName very_important_service | |
restart: unless-stopped | |
volumes: | |
- /var/run/docker.sock:/var/run/docker.sock |
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/project.ansibled.yml | |
# Logentries REST API key -- read/write | |
logentries_api_key: !vault | | |
$ANSIBLE_VAULT;1.1;AES256 | |
62336430323434343665653736376339333661356535336132326634353934356634666338316333 | |
6264376536343862303962383638303037366634343137350a346364663835663964333136366330 | |
37333564373232393966616164643539373534393761303332306438353562663434636466353431 | |
3430373764336439330a386339636234323566653436393136313762356537343637326239356139 | |
6332 |
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
# pull down the current state of our Logentries logs from the REST API | |
- name: retrieve Logsets info from Logentries | |
uri: | |
url: https://rest.logentries.com/management/logsets | |
headers: | |
x-api-key: "{{ logentries_api_key }}" | |
method: GET | |
return_content: yes | |
register: logentries_logsets_info |
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
# POST to Logentries and create the new log, note: | |
# - provide our API key in the `x-api-key` header | |
# - Logentries API responds with a 201, so that is a successful response (status_code) | |
# - provide our Logset id so that our new log will be created in it | |
- name: create Log in Logentries if it doesn't exist - {{ item }} | |
uri: | |
url: https://rest.logentries.com/management/logs | |
headers: | |
x-api-key: "{{ logentries_api_key }}" | |
method: POST |
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
- name: add each Logentries token to Docker Compose .env settings | |
lineinfile: | |
dest: "{{ docker_compose_directory }}/.env" | |
regexp: "^LOGENTRIES_{{ item.key | upper }}=.*" | |
line: "LOGENTRIES_{{ item.key | upper }}={{ item.value }}" | |
create: yes | |
with_dict : "{{ logentries_log_tokens }}" |
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: localhost | |
tasks: | |
- name: create an S3 bucket -- we'll see this one is 'changed' | |
s3_bucket: | |
name: mysupercoolexamplebucket | |
region: ap-southeast-2 | |
state: present | |
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: localhost | |
vars: | |
aurora_cluster_name: mycoolauroracluster | |
aurora_cluster_engine: aurora-mysql | |
aurora_cluster_version: 5.7.12 | |
aws_region: ap-southeast-2 | |
tasks: | |
- name: create Aurora Cluster with the AWS CLI | |
command: > |