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:logentries:tasks:logs.create.yml
Last active July 30, 2018 06:58
ansibled:logentries:tasks:logs
# 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
@tomwwright
tomwwright / ansibled:logentries:tasks:main.yml
Created July 30, 2018 06:54
ansibled:logentries:tasks:main
# 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
@tomwwright
tomwwright / ansibled:logentries:group_vars:project.ansibled.yml
Created July 30, 2018 06:44
ansibled:logentries:group_vars:project.ansibled
# 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
@tomwwright
tomwwright / docker-compose.yml
Created July 30, 2018 05:42
ansibled:logentries:docker-compose
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
@tomwwright
tomwwright / ansibled:aurora:aurora.yml
Created March 28, 2018 11:39
ansibled : aurora : aurora playbook (cluster and instances)
# 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:host_vars:dba.aurora.ansibled.yml
Created March 28, 2018 11:35
ansibled : aurora : inventory (cluster and instances), host vars for aurora instances
# 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
@tomwwright
tomwwright / ansibled:aurora:tasks:files:create-db-instance.json.j2
Created March 28, 2018 11:24
ansibled : aurora : tasks : aurora database instance
{
"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",
@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 }}"
@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: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: