ansible for large scale deployment
TRANSCRIPT
Large Scale MySQL Deployment Using Ansible
Karthik .P.R
Lead MySQL DBA – Yahoo!
(26-06-2015)
About : Karthik.P.R
• 5+ years of experience as a DBA• Currently : Lead DBA at Yahoo!• Current Focus : MySQL Tools and Automation.• Student : M.Sc ( FOSS )• Blogger : remotemysqldba.blogspot.in• Contact :
• Email : [email protected]• Linkedin : https://in.linkedin.com/in/prkart• Twitter : @prkart• Slideshare : https://www.slideshare.net/prkart
Current Operation Model
• Deploy using SSH login.• Custom shell scripts or .bat file.• Manual Installation.• Operation run books.• Scheduled jobs• Add node to monitoring.
Central Configuration Management
Need for Central Configuration Management ?
Central Configuration Management
Need for Central Configuration Management ?
• Large scale deployment• Configuration changes• User management • Avoid manual intervention• Track changes
Central Configuration Management
General Architecture
Available Tools
• Ansible• Chef• Puppet• Salt• CFEngine• Vagrant
Available Tools
• Ansible :
GPL V3,Python , agent less , Playbook ( YAML )
• Chef :
Apache license ,Ruby/Erlang , Cookbooks ( Ruby )
• Puppet :
Apache license ,Ruby, Manifests ( Puppet Language )
• Salt :
Apache license ,Python, States ( YAML )
Why Ansible ?
• Agent less • Simple and more readable• Uses SSH protocol• Push based ( Pull is also possible )• idempotent• Orchestration
Software Requirements
• Control Machine ( Unix based )• Python 2.6 or 2.7• Ansible• pip
• Managed nodes
• Python 2.5• Python-simplejson• libselinux-python ( For SELinux )• Native Power Shell ( Windows )
Terminology
• Playbook : Collection of plays. They define the configuration and Orchestration.
• Inventory : List of hosts and host groups.
• Modules : Can be any language execute remotely.
• Play : Is the minimal mapping for set of hosts.
• Facts : Data collected from target hosts.
Ansible Architecture
Configuration
• Config File
• ANSIBLE_CONFIG Env variable• ./ansible_config • ~/.ansible_config• /etc/ansible/ansible.cfg
• Inventory • /etc/ansible/hosts• (OR) Dynamic Inventory
Configuration
• Inventory • Hosts• Groups• Sub groups• Group configs
Playbooks has their own inventory list in INI format
Configuration
• Sample Inventory
[master]
sports.db1.com
finance.db1.com
[slave]
sports.db2.com
finance.db2.com
[dbserver]
master
slave
Modules
MySQL Modules:
• mysql_replication• mysql_user• mysql_variables• mysql_db
# Set read_only variable to 1- mysql_variables: variable=read_only value=1 login_host=db2.finance.com
Sample YAML
MySQL Use cases
• Version Specific MySQL Config
Eg) Enable GTID on MySQL 5.6• Hardware Based Tuning• Property based variables• User configuration• Backup set up• Monitoring setup using Nagios• Cronjob or schedulers
Best Practices
• Use Version Control for Playbooks.• Headless user for deployment.• Use push based method.• YAML needs a good editor ( Atom, Notepad ++ , etc )
To get started
• Ansible galaxy make things more simple
More Reading
• Ansible Official
• Slideshare
• Books : Ansible Up & Running.
Thanks !!!