Overview

In this section, we will build 3 servers.

1 Ansible Central

2 MySQL servers

All that will be automated, so let's get going:

Configuration

Since all will be automated, we will use both:

Vagrant: For the Virtual Machines

Ansible: For the MySQL Replication

That will allow us to automate the entire process :)

Let's get firstly with the VM:

VM Automation

I have prepared some simple vagrant file, which when you run, you will have the following output:

VM CreationFile

You can see the vagrant file in the APPENDIX at the end of the section, alongside with the other automation files:

Once we have the VMs, connect to the “ansiblecentral” using the following oriantation:

Network topology

MySQL Replication Automation

Using Ansible, I have created several files, which are all automated and deploy MySQL Replication in the matter of minutes:

Deplyo MySQL Replication

Your OK and changed values, might differ.

All that will deploy MySQL with Replication.

Appendix

Vagrant File

Vagrant file

MySQL Basic Config

Ansible Basic Config

MySQL Replication Config

MySQL Replication Config

MySQL Switchover

MySQL Switchover