Practical Database
Automation with Ansible®
@derek_downey
linkedin.com/in/derekjdowney/
Open Source DBA
Practical automation enthusiast
Derek Downey
Headshot
optional
About me
Copyright 2021 - Distributed Database Administrators, LLC - All rights reserved
Practical Database Automation
● Why automate databases?
● Using Ansible to manage databases
● Automate with caution
Copyright 2021 - Distributed Database Administrators, LLC - All rights reserved
Assumption: Automation is bad
● Leads to job loss
● Prone to mistakes
● Data is too critical
FEAR
Copyright 2021 - Distributed Database Administrators, LLC - All rights reserved
Database tasks
● Config management
● User control
● Schema migrations
● Patching/Upgrading
● Backup and Restores
● Failovers
● Shard management
Copyright 2021 - Distributed Database Administrators, LLC - All rights reserved
Automate anyway
● DBaaS is doing some of this already
● Config management
● User control
● Schema migrations
● Patching/Upgrading
● Backup and Restores
● Failovers
● Shard management
Copyright 2021 - Distributed Database Administrators, LLC - All rights reserved
Automate anyway
● DBaaS is doing some of this already
● Low value consumers of time
● Bring safety to managing databases
● Become a linchpin!
Copyright 2021 - Distributed Database Administrators, LLC - All rights reserved
Automate with Ansible
● Simple configuration language
● Minimal dependencies
● Open Source!
● Push or Pull automation
Copyright 2021 - Distributed Database Administrators, LLC - All rights reserved
Ansible Concepts
● Orchestration
● Idempotency
● Inventories
● Playbooks
● Handling secrets
Copyright 2021 - Distributed Database Administrators, LLC - All rights reserved
Orchestration
MySQL A (source)
T 0 T 1 T 2 T 3
MySQL A (replica)
MySQL B (source)
MySQL B (replica)
Create
user
Replicate
Validate
Copyright 2021 - Distributed Database Administrators, LLC - All rights reserved
Idempotency
Copyright 2021 - Distributed Database Administrators, LLC - All rights reserved
Idempotency
MySQL A (source)
T 0 T 1 T 2 T 3
MySQL A (replica)
MySQL B (source)
MySQL B (replica)
Create
user
Replicate
Validate
Copyright 2021 - Distributed Database Administrators, LLC - All rights reserved
Inventories
Copyright 2021 - Distributed Database Administrators, LLC - All rights reserved
Playbooks
$ ansible-playbook users.yml
Copyright 2021 - Distributed Database Administrators, LLC - All rights reserved
Handling secrets
Copyright 2021 - Distributed Database Administrators, LLC - All rights reserved
Handling secrets
$ ansible-playbook --ask-vault-pass 
-e @passwords.yml 
users.yml
Copyright 2021 - Distributed Database Administrators, LLC - All rights reserved
Demo
Copyright 2021 - Distributed Database Administrators, LLC - All rights reserved
Beyond user control
Orchestration, Idempotency, Secrets
● Config management
● User control
● Schema migrations
● Patching/Upgrading
● Backup and Restores
● Failovers
● Shard management
Copyright 2021 - Distributed Database Administrators, LLC - All rights reserved
CAUTION!
Nails everywhere
Credit: Quora
Copyright 2021 - Distributed Database Administrators, LLC - All rights reserved
CAUTION!
Nails everywhere
BEWARE: Humans
Copyright 2021 - Distributed Database Administrators, LLC - All rights reserved
CAUTION!
Nails everywhere
BEWARE: Humans
Tunnel vision
Credit: CNN
Website:
Distributeddba.com
E-Mail:
info@distributeddba.com
LinkedIn:
linkedin.com/company/distributeddba
Copyright 2021 - Distributed Database Administrators, LLC - All rights reserved
Cut out fear and automate databases responsibly!

Percona live 2021 Practical Database Automation with Ansible

  • 1.
  • 2.
    @derek_downey linkedin.com/in/derekjdowney/ Open Source DBA Practicalautomation enthusiast Derek Downey Headshot optional About me
  • 3.
    Copyright 2021 -Distributed Database Administrators, LLC - All rights reserved Practical Database Automation ● Why automate databases? ● Using Ansible to manage databases ● Automate with caution
  • 4.
    Copyright 2021 -Distributed Database Administrators, LLC - All rights reserved Assumption: Automation is bad ● Leads to job loss ● Prone to mistakes ● Data is too critical FEAR
  • 5.
    Copyright 2021 -Distributed Database Administrators, LLC - All rights reserved Database tasks ● Config management ● User control ● Schema migrations ● Patching/Upgrading ● Backup and Restores ● Failovers ● Shard management
  • 6.
    Copyright 2021 -Distributed Database Administrators, LLC - All rights reserved Automate anyway ● DBaaS is doing some of this already ● Config management ● User control ● Schema migrations ● Patching/Upgrading ● Backup and Restores ● Failovers ● Shard management
  • 7.
    Copyright 2021 -Distributed Database Administrators, LLC - All rights reserved Automate anyway ● DBaaS is doing some of this already ● Low value consumers of time ● Bring safety to managing databases ● Become a linchpin!
  • 8.
    Copyright 2021 -Distributed Database Administrators, LLC - All rights reserved Automate with Ansible ● Simple configuration language ● Minimal dependencies ● Open Source! ● Push or Pull automation
  • 9.
    Copyright 2021 -Distributed Database Administrators, LLC - All rights reserved Ansible Concepts ● Orchestration ● Idempotency ● Inventories ● Playbooks ● Handling secrets
  • 10.
    Copyright 2021 -Distributed Database Administrators, LLC - All rights reserved Orchestration MySQL A (source) T 0 T 1 T 2 T 3 MySQL A (replica) MySQL B (source) MySQL B (replica) Create user Replicate Validate
  • 11.
    Copyright 2021 -Distributed Database Administrators, LLC - All rights reserved Idempotency
  • 12.
    Copyright 2021 -Distributed Database Administrators, LLC - All rights reserved Idempotency MySQL A (source) T 0 T 1 T 2 T 3 MySQL A (replica) MySQL B (source) MySQL B (replica) Create user Replicate Validate
  • 13.
    Copyright 2021 -Distributed Database Administrators, LLC - All rights reserved Inventories
  • 14.
    Copyright 2021 -Distributed Database Administrators, LLC - All rights reserved Playbooks $ ansible-playbook users.yml
  • 15.
    Copyright 2021 -Distributed Database Administrators, LLC - All rights reserved Handling secrets
  • 16.
    Copyright 2021 -Distributed Database Administrators, LLC - All rights reserved Handling secrets $ ansible-playbook --ask-vault-pass -e @passwords.yml users.yml
  • 17.
    Copyright 2021 -Distributed Database Administrators, LLC - All rights reserved Demo
  • 18.
    Copyright 2021 -Distributed Database Administrators, LLC - All rights reserved Beyond user control Orchestration, Idempotency, Secrets ● Config management ● User control ● Schema migrations ● Patching/Upgrading ● Backup and Restores ● Failovers ● Shard management
  • 19.
    Copyright 2021 -Distributed Database Administrators, LLC - All rights reserved CAUTION! Nails everywhere Credit: Quora
  • 20.
    Copyright 2021 -Distributed Database Administrators, LLC - All rights reserved CAUTION! Nails everywhere BEWARE: Humans
  • 21.
    Copyright 2021 -Distributed Database Administrators, LLC - All rights reserved CAUTION! Nails everywhere BEWARE: Humans Tunnel vision Credit: CNN
  • 22.
    Website: Distributeddba.com E-Mail: info@distributeddba.com LinkedIn: linkedin.com/company/distributeddba Copyright 2021 -Distributed Database Administrators, LLC - All rights reserved Cut out fear and automate databases responsibly!